コード例 #1
0
    public void attackEnemy(Attack attack, float multiplier)
    {
        currentEnemyHealth -= (int)(attack.enemyDamage * multiplier);
        health.updateHealth(enemy.health, currentEnemyHealth);

        if (currentEnemyHealth <= 0)
        {
            FindObjectOfType <CombatDisplay>().playerVictory();
        }
    }
コード例 #2
0
ファイル: Player.cs プロジェクト: nickbarrash/ld-48
 public void updateHealth(int diff)
 {
     health += diff;
     health  = Mathf.Min(health, maxHealth);
     if (health <= 0)
     {
         GameManager.instance.gameOver(false);
     }
     healthDisplay.updateHealth(maxHealth, health);
 }