diff --git a/Assets/Scripts/Entity.cs b/Assets/Scripts/Entity.cs index 5fc8a74..9886edf 100644 --- a/Assets/Scripts/Entity.cs +++ b/Assets/Scripts/Entity.cs @@ -35,7 +35,7 @@ public abstract class Entity : LevelObject Animation.SpeedMultiplier = SpeedMultiplier; } //Start the animation of death and the fading of the entity - public void Death() + public virtual void Death() { _animation.PlayDieAnim(); Invoke("Dying", 0.1f); diff --git a/Assets/Scripts/Opponent/Opponent.cs b/Assets/Scripts/Opponent/Opponent.cs index 6846178..a8ca40f 100644 --- a/Assets/Scripts/Opponent/Opponent.cs +++ b/Assets/Scripts/Opponent/Opponent.cs @@ -23,7 +23,7 @@ public class Opponent : Entity _rigidbody = GetComponent(); Animation = gameObject.AddComponent(); _observer = WaveObserver.Instance; - _toughness = Mathf.Round((base.Hp / 10) / 2); + _toughness = Mathf.Round((Hp / 10) / 2); _observerIndex = _observer.NotifyEnemy(transform.position.y, _toughness); } @@ -61,9 +61,10 @@ public class Opponent : Entity AttackSpeedWait += Time.deltaTime; } - private void OnDestroy() + public override void Death() { _observer.NotifyDies(_observerIndex, _toughness); + base.Death(); } }