From 99bc60321c04d9c57781ec0b149d6dd3a68119a9 Mon Sep 17 00:00:00 2001 From: Valera <76255437+xzxADIxzx@users.noreply.github.com> Date: Wed, 22 Nov 2023 19:53:17 +0300 Subject: [PATCH] fixes --- net/entity-types/Enemy.cs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/net/entity-types/Enemy.cs b/net/entity-types/Enemy.cs index d2bee6d8..b8a941f3 100644 --- a/net/entity-types/Enemy.cs +++ b/net/entity-types/Enemy.cs @@ -70,6 +70,15 @@ private void Awake() Id = Entities.NextId(); Type = (EntityType)index; + + // in the second phase the same object is used as in the anticipatory one + if (SceneHelper.CurrentScene == "Level 4-4" && enemyId.enemyType == EnemyType.V2 && healthBar != null && + TryGetComponent(out var V2) && !V2.firstPhase) + { + Networking.Entities[Id] = this; + DestroyImmediate(healthBar); + healthBar = gameObject.AddComponent(); + } } // run a loop that will update the target id of the idol every second @@ -165,7 +174,7 @@ public void Kill() if (!fake) enemyId.InstaKill(); // reduce health to zero because the host destroyed enemy - health.target = 0f; + enemyId.health = 0f; // destroy the boss bar, because it looks just awful if (healthBar != null) healthBar.Invoke("DestroyBar", 2f);