コード例 #1
0
    void TakeDamage()
    {
        _hearts.playerHealth = _hearts.playerHealth - damage;
        _hearts.UpdateHealth();

        changeAnimationState(PLAYER_HIT);
        AudioManager.PlaySound("player_hurt");

        if (_hearts.playerHealth <= 0)
        {
            // player dead
            SceneManager.LoadScene(SceneManager.GetActiveScene().name);
            changeAnimationState(PLAYER_DEAD);
        }
    }