EnemyPortal이 작동하지 않는 문제 수정

Network 환경 대응
This commit is contained in:
2026-02-13 15:18:05 +09:00
parent 31e8adcb06
commit 1aa65ce615
4 changed files with 110 additions and 42 deletions

View File

@@ -154,3 +154,8 @@ MonoBehaviour:
SourcePrefabToOverride: {fileID: 0} SourcePrefabToOverride: {fileID: 0}
SourceHashToOverride: 0 SourceHashToOverride: 0
OverridingTargetPrefab: {fileID: 0} OverridingTargetPrefab: {fileID: 0}
- Override: 0
Prefab: {fileID: 3432047510330746227, guid: 11e3760dda2c0164abf759c18d918893, type: 3}
SourcePrefabToOverride: {fileID: 0}
SourceHashToOverride: 0
OverridingTargetPrefab: {fileID: 0}

View File

@@ -9,6 +9,7 @@ GameObject:
serializedVersion: 6 serializedVersion: 6
m_Component: m_Component:
- component: {fileID: 228462577495887354} - component: {fileID: 228462577495887354}
- component: {fileID: 8411098988276399395}
- component: {fileID: 6859825394817103090} - component: {fileID: 6859825394817103090}
m_Layer: 0 m_Layer: 0
m_Name: EnemyPortal m_Name: EnemyPortal
@@ -33,6 +34,31 @@ Transform:
- {fileID: 1144932316349886388} - {fileID: 1144932316349886388}
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &8411098988276399395
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3432047510330746227}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: d5a57f767e5e46a458fc5d3c628d0cbb, type: 3}
m_Name:
m_EditorClassIdentifier: Unity.Netcode.Runtime::Unity.Netcode.NetworkObject
GlobalObjectIdHash: 2651171896
InScenePlacedSourceGlobalObjectIdHash: 0
DeferredDespawnTick: 0
Ownership: 1
AlwaysReplicateAsRoot: 0
SynchronizeTransform: 1
ActiveSceneSynchronization: 0
SceneMigrationSynchronization: 1
SpawnWithObservers: 1
DontDestroyWithOwner: 0
AutoObjectParentSync: 1
SyncOwnerTransformWhenParented: 1
AllowOwnerToParent: 0
--- !u!114 &6859825394817103090 --- !u!114 &6859825394817103090
MonoBehaviour: MonoBehaviour:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@@ -45,8 +71,10 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: cb91abd3aae74d941a739a48aefb74a1, type: 3} m_Script: {fileID: 11500000, guid: cb91abd3aae74d941a739a48aefb74a1, type: 3}
m_Name: m_Name:
m_EditorClassIdentifier: Assembly-CSharp::EnemyPortal m_EditorClassIdentifier: Assembly-CSharp::EnemyPortal
Enemies: ShowTopMostFoldoutHeaderGroup: 1
- {fileID: 5176576196123937037, guid: 951b69041a2ace947afd721fefb3eaba, type: 3} monsterEntries: []
initialCost: 4
costIncreaseRate: 10
--- !u!1001 &606055883085645919 --- !u!1001 &606055883085645919
PrefabInstance: PrefabInstance:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0

View File

@@ -1762,6 +1762,18 @@ PrefabInstance:
propertyPath: monsterEntries.Array.data[1].monsterData propertyPath: monsterEntries.Array.data[1].monsterData
value: value:
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 8411098988276399395, guid: 11e3760dda2c0164abf759c18d918893, type: 3}
propertyPath: GlobalObjectIdHash
value: 3475466684
objectReference: {fileID: 0}
- target: {fileID: 8411098988276399395, guid: 11e3760dda2c0164abf759c18d918893, type: 3}
propertyPath: SceneMigrationSynchronization
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8411098988276399395, guid: 11e3760dda2c0164abf759c18d918893, type: 3}
propertyPath: InScenePlacedSourceGlobalObjectIdHash
value: 2651171896
objectReference: {fileID: 0}
m_RemovedComponents: [] m_RemovedComponents: []
m_RemovedGameObjects: [] m_RemovedGameObjects: []
m_AddedGameObjects: [] m_AddedGameObjects: []
@@ -2231,7 +2243,7 @@ MonoBehaviour:
cycleLength: 90 cycleLength: 90
autoStart: 1 autoStart: 1
pauseOnZero: 0 pauseOnZero: 0
exceptionalFirstCycleLength: 0 exceptionalFirstCycleLength: 10
showDebugLogs: 1 showDebugLogs: 1
--- !u!4 &1442785555 --- !u!4 &1442785555
Transform: Transform:
@@ -2989,6 +3001,18 @@ PrefabInstance:
propertyPath: monsterEntries.Array.data[1].monsterData propertyPath: monsterEntries.Array.data[1].monsterData
value: value:
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 8411098988276399395, guid: 11e3760dda2c0164abf759c18d918893, type: 3}
propertyPath: GlobalObjectIdHash
value: 4252027324
objectReference: {fileID: 0}
- target: {fileID: 8411098988276399395, guid: 11e3760dda2c0164abf759c18d918893, type: 3}
propertyPath: SceneMigrationSynchronization
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8411098988276399395, guid: 11e3760dda2c0164abf759c18d918893, type: 3}
propertyPath: InScenePlacedSourceGlobalObjectIdHash
value: 2651171896
objectReference: {fileID: 0}
m_RemovedComponents: [] m_RemovedComponents: []
m_RemovedGameObjects: [] m_RemovedGameObjects: []
m_AddedGameObjects: [] m_AddedGameObjects: []

View File

@@ -4,8 +4,8 @@ using System.Collections.Generic;
using Unity.Netcode; using Unity.Netcode;
using UnityEngine; using UnityEngine;
public class EnemyPortal : NetworkBehaviour public class EnemyPortal : NetworkBehaviour
{ {
[System.Serializable] [System.Serializable]
public class MonsterEntry public class MonsterEntry
{ {
@@ -24,10 +24,21 @@ public class EnemyPortal : NetworkBehaviour
private float currentCost; private float currentCost;
public override void OnNetworkSpawn()
{
base.OnNetworkSpawn();
GlobalTimer.Instance.OnCycleStart += OnCycleStart;
}
public override void OnNetworkDespawn()
{
GlobalTimer.Instance.OnCycleStart -= OnCycleStart;
base.OnNetworkDespawn();
}
void Start() void Start()
{ {
currentCost = initialCost; currentCost = initialCost;
GlobalTimer.Instance.OnCycleStart += OnCycleStart;
} }
private void OnCycleStart(int cycleNumber) private void OnCycleStart(int cycleNumber)