コード例 #1
0
    public void Damage(int amount)
    {
        //this.currentHealth -= amount;
        this.currentHealth -= CheckBlockFor(amount);

        //Play damage sprite here
        if (this.currentHealth <= 0)
        {
            this.currentHealth = 0;
            this.isDead        = true;
        }

        if (isDead)
        {
            monsterState = State.DEAD;

            //run death animation here
            //Design decision: either fade out and disable now, or allow them to be revived?

            if (team == Team.PLAYER)
            {
                //display losing text
                BC.PlayerLose();
            }

            if (team == Team.ENEMY)
            {
                if (BC.AllEnemiesDead())
                {
                    BC.PlayerWin();
                }
            }
        }
    }