コード例 #1
0
ファイル: PlayerScript.cs プロジェクト: CamYuan/OmniGaming
    //takes away health point
    public void Damage(int dmg)
    {
        if (gameObject.GetComponent <Animation>().IsPlaying("Player_RedFlash") == false)
        {
            gameObject.GetComponent <Animation>().Play("Player_RedFlash");
            curHealth += dmg;

            //checks to see if hit will kill you
            if (curHealth > maxHealth)
            {
                print("GAME OVER!");
                Death.YouLost();
                //resets health
                curHealth = 2;
            }
        }

        else
        {
            print("Invinsible");
        }
    }