Beispiel #1
0
    void OnTriggerEnter2D(Collider2D col)
    {
        foreach (GameObject GObject in GameObject.FindGameObjectsWithTag("Ghost"))
        {
            var moveGhost = GObject.GetComponent <MoveGhost>();
            if (moveGhost)
            {
                moveGhost.cur = 0;
            }
        }

        if (col.gameObject.tag == "Player")
        {
            if (SceneManager.GetActiveScene().buildIndex < maxSceneIndex)
            {
                SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex + 1);
            }
            else
            {
                GameObject score_board = GameObject.FindWithTag("Score");
                score_board.GetComponent <ScoreManager>().SetTextAfter("\nThat's all the levels we have so far, so I guess you win!");
                Destroy(this.gameObject);
            }
        }
    }
 public override void SetTarget(GObject target)
 {
     targetEnemy = target.GetComponent <Enemy>();
 }