Exemple #1
0
    public void Kill()
    {
        if (Character != null)
        {
            CurrentHP = 0;
            DamageDisabled();

            Character.GetScored(PointsWhenDestroyed);
            Character.currentCharacterState = GameUnit.CharacterState.Dead;

            On_Death?.Invoke();

            if (InstantiatedOnDeath != null)
            {
                Instantiate(InstantiatedOnDeath, transform.position, Quaternion.identity);
            }

            if (AutoRespawn != null)
            {
                AutoRespawn.Kill();
            }

            Character.RemoveFromGame();
        }
        else
        {
            Destroy(gameObject);
        }
    }