示例#1
0
    private void OnCollisionEnter2D(Collision2D col)
    {
        if (col.relativeVelocity.magnitude > 0.03f)
        {
            GetComponent <Collider2D>().enabled = false;
            Invoke("Respawn", 0.2f);
            Lives--;



            if (Lives <= 0)
            {
                //gameover
                GameOver();
                PlayerMovement move  = GetComponent <PlayerMovement>();
                PlayerShooting shoot = GetComponent <PlayerShooting>();
                shoot.enabled = false;
                move.enabled  = false;
                Debug.Log(gameOverPannel.scene);
                Invoke("gameOverPannel", 0.3f);

                ScoreMenuController sc = gameObject.AddComponent <ScoreMenuController>() as ScoreMenuController;
                sc.score = score;

                Debug.Log(end.enabled);
            }
        }
    }
示例#2
0
 void Start()
 {
     score = 0;
     gameOverPannel.SetActive(false);
     scoreText.text = "score " + score;
     liveText.text  = "levens " + Lives;
     Invoke("Invulnerable", 2f);
     end = GetComponent <ScoreMenuController>();
 }