mirror of
https://github.com/kuhyx/WUT_Computer_Science.git
synced 2026-07-04 15:43:16 +02:00
sort of fix
This commit is contained in:
parent
42452e6e64
commit
28f7e76c0b
@ -21,7 +21,6 @@ public class Entity : MonoBehaviour
|
||||
|
||||
[HideInInspector] public UnityEvent<Entity> OnDeath = new UnityEvent<Entity>();
|
||||
|
||||
|
||||
public Team GetOwnTeam()
|
||||
{
|
||||
return myTeam;
|
||||
@ -51,6 +50,18 @@ public class Entity : MonoBehaviour
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual void Awake()
|
||||
{
|
||||
TickSystem.OnTick += HandleTick;
|
||||
}
|
||||
|
||||
protected virtual void Die()
|
||||
{
|
||||
TickSystem.OnTick -= HandleTick;
|
||||
OnDeath.Invoke(this);
|
||||
Destroy(gameObject);
|
||||
}
|
||||
|
||||
public void SetOwnTeam(Team type)
|
||||
{
|
||||
myTeam = type;
|
||||
@ -61,17 +72,16 @@ public class Entity : MonoBehaviour
|
||||
healthPoints -= damage;
|
||||
|
||||
if (healthPoints <= 0)
|
||||
Destroy(gameObject);
|
||||
Die();
|
||||
|
||||
UpdateHPDisplay();
|
||||
Debug.Log("I took damage, my HP is now: " + healthPoints + " noooo!!!!", gameObject);
|
||||
}
|
||||
|
||||
protected virtual void Die()
|
||||
{
|
||||
OnDeath.Invoke(this);
|
||||
Destroy(gameObject);
|
||||
}
|
||||
protected virtual void HandleTick(TickSystem.OnTickEventArgs tickEventArgs)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void OnDestroy()
|
||||
{
|
||||
|
||||
@ -66,19 +66,10 @@ public class Soldier : Entity
|
||||
else enemyType = Team.Ally;
|
||||
}
|
||||
|
||||
void Awake()
|
||||
{
|
||||
TickSystem.OnTick += HandleTick;
|
||||
}
|
||||
|
||||
protected override void Die()
|
||||
protected override void HandleTick(TickSystem.OnTickEventArgs tickEventArgs)
|
||||
{
|
||||
TickSystem.OnTick -= HandleTick;
|
||||
base.Die();
|
||||
}
|
||||
// base.HandleTick(tickEventArgs);
|
||||
|
||||
private void HandleTick(TickSystem.OnTickEventArgs tickEventArgs)
|
||||
{
|
||||
ref Queue<Action> queueToHandle = ref interrupts;
|
||||
if (interrupts.Count < 1) // if no interrupt actions to do, handle regular queue
|
||||
queueToHandle = actions;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user