Beispiel #1
0
 void OnTriggerEnter2D(Collider2D col)
 {
     if (col.CompareTag("enemy"))
     {
         print("death awaits");
         changer.sceneChange(3);
     }
     else if (col.CompareTag("Player"))
     {
         changer.sceneChange(21);
     }
 }
Beispiel #2
0
    // when character collides with this key object...
    void OnTriggerEnter2D(Collider2D col)
    {
        if (col.CompareTag("death"))
        {
            print("You Died");
            // play death animation
            anim.SetBool("isDead", true);

            // change to gameOver scene
            changer.sceneChange(4);
        }
        else if (col.CompareTag("enemy"))
        {
            if (gm.rings > 0)
            {
                gm.rings = 0;
                hit.Play();
            }
            else
            {
                changer.sceneChange(4);
            }
        }
        else if (col.CompareTag("changeScene"))
        {
            // change to the transit screen for the second stage
            changer.sceneChange(2);
        }
        else if (col.CompareTag("win"))
        {
            // change to the end scene where you win
            changer.sceneChange(4);
        }
        else if (col.CompareTag("lvltwo"))
        {
            // change to the end scene where you win
            changer.sceneChange(3);
        }
        else if (col.CompareTag("spring"))
        {
            // change to the end scene where you win
        }
    }
Beispiel #3
0
 // Update is called once per frame
 void Update()
 {
     if (timerStarted == true)
     {
         countdownValue -= Time.deltaTime;
         if (countdownValue <= 0f)
         {
             timerStarted = false;
             gm.endNo     = 1;
             changer.sceneChange(3);
         }
     }
 }