예제 #1
0
파일: TickAgent.cs 프로젝트: molvin/LD48
    protected void OnDamageTaken(int Health)
    {
        if (Health == CurrentHealth)
        {
            return;
        }

        if (Health < CurrentHealth)
        {
            AudioSystem.Play(HurtSound);
            if (AbilitySystem.HasActiveTag(TypeTag.Poison))
            {
                StartCoroutine(PlayEffect(PoisonedEffect));
            }
            else
            {
                StartCoroutine(PlayEffect(DamageEffect));
            }
        }

        if (Health <= 0)
        {
            IsAlive = false;
            Grid.setOccupied((Vector3Int)GridPos, false);
            Animator.SetBool("Death", true);
            AudioSystem.Play(DeathSound);
            StartCoroutine(PlayEffect(DeathEffect));
        }

        CurrentHealth = Health;
    }