示例#1
0
    // Decreases lives and checks for death
    private void HandleLives()
    {
        LivesManager lv = FindObjectOfType <LivesManager>();

        lv.RemoveLife();
        if (lv.GetLives() <= 0)
        {
            // Game over
            SceneManager.LoadScene(1);
            RpcGameOver();
        }
    }
示例#2
0
 void OnCollisionEnter2D(Collision2D Col)
 {
     if (Col.gameObject.CompareTag("Enemy"))
     {
         Destroy(Col.gameObject);
         LM.DecrementLives();
         PlayerAnimator.Play("Hit");
         if (LM.GetLives() == 0)
         {
             GameObject GOScreen = Instantiate(GameoverPrefab, Vector3.zero, Quaternion.identity);
             GOScreen.transform.SetParent(GameObject.Find("Canvas").transform, false);
             gameObject.SetActive(false);
         }
     }
 }