コード例 #1
0
ファイル: PowerUp.cs プロジェクト: shoalinbatman/UnityDemo
    //when something runs into it
    void OnCollisionEnter2D(Collision2D other)
    {
        //make sure the player is the one that hit the power up
        if (other.gameObject.tag == "Player")
        {
            //at this point, just one effect - add a life
            GameControl.Add_Hits(hitGain);

            //pickup is worth 50 points
            GameControl.Add_Score(50);

            //powerup has been used, get rid of it
            Destroy(gameObject);
        }
    }