Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
xzxADIxzx committed Nov 22, 2023
1 parent 9cc83ae commit 99bc603
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion net/entity-types/Enemy.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<V2>(out var V2) && !V2.firstPhase)
{
Networking.Entities[Id] = this;
DestroyImmediate(healthBar);
healthBar = gameObject.AddComponent<BossHealthBar>();
}
}

// run a loop that will update the target id of the idol every second
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 99bc603

Please sign in to comment.