コード例 #1
0
ファイル: HealthScript.cs プロジェクト: ner33/GDDSchmup
    /// <summary>
    /// Inflicts damage and check if the object should be destroyed
    /// </summary>
    /// <param name="damageCount"></param>
    public void Damage(int damageCount)
    {
        hp = hp - damageCount;

        if (hp <= 0)
        {
            // Dead!
            if (isEnemy)
            {
                highscore.IncreaseHighscore(1);
            }
            Destroy(gameObject);
        }
    }