コード例 #1
0
    void OnCollisionEnter(Collision collision)
    {
        Asteroid a = collision.gameObject.GetComponent <Asteroid>();

        if (a == null)
        {
            return;
        }

        if (Time.time < LAST_COLLISION + COLLISION_DELAY)
        {
            return;
        }
        else
        {
            LAST_COLLISION = Time.time;
        }

        JUMPS--;
        if (JUMPS < 0)
        {
            gameObject.SetActive(false);
            AsteraX.GameOver();
            return;
        }

        // Respawn in a new location
        Respawn();
    }
    void OnCollisionEnter(Collision collision)
    {
        Asteroid a = collision.gameObject.GetComponent <Asteroid>();

        if (a == null)
        {
            return;
        }

        _teleportDissapearParticleSystem.transform.position = collision.transform.position;
        _teleportDissapearParticleSystem.ParticlesPlay();

        if (Time.time < LAST_COLLISION + COLLISION_DELAY)
        {
            return;
        }
        else
        {
            LAST_COLLISION = Time.time;
        }

        JUMPS--;
        if (JUMPS < 0)
        {
            gameObject.SetActive(false);
            AsteraX.GameOver();
            return;
        }

        // Respawn in a new location
        Respawn();
    }
コード例 #3
0
ファイル: PlayerShip.cs プロジェクト: adammyhre/AsteraX
 // Setting this function to public so it can be called from the Asteroid's OnCollisionEnter function
 public void Jump()
 {
     JUMPS--;
     JUMPS_TEXT.text = "Jumps: " + JUMPS;
     if (JUMPS <= 0)
     {
         gameObject.SetActive(false);
         AsteraX.GameOver();
     }
     else
     {
         Respawn();
     }
 }
コード例 #4
0
 private void RunGameOver()
 {
     ScoreManager.FinalScore();
     AsteraX.GameOver();
 }