コード例 #1
0
 //ghost collides with player
 private void OnTriggerEnter2D(Collider2D collision)
 {
     if (collision.tag == LevelTwoTags.PlayerTwo)
     {
         player.PlayerDamaged();
     }
     else if (collision.tag == Tags.flameBulletTag)
     {
         main.GetDamagedSound();
         Destroy(collision.gameObject);
         Damaged();
     }
 }
コード例 #2
0
 //player Damaged
 public void PlayerDamaged()
 {
     StartCoroutine(FlashWhenDamaged(0.1f));
     main.GetDamagedSound();
     lives = lives - 1;
     uiManager.UpdatePlayerLivesUIText(lives);
     if (lives < 1)
     {
         main.GameOverClip();
         uiManager.DisplayGameOverText();
         Destroy(this.gameObject);
         levelLoader.LoadMainMenuScene();
         //ime.timeScale = 0;
     }
 }
コード例 #3
0
 private void OnTriggerEnter2D(Collider2D collision)
 {
     if (collision.gameObject.tag == LevelTwoTags.PlayerTwo)
     {
         Debug.Log("Player Damaged");
         player.PlayerDamaged();
     }
     else if (collision.gameObject.tag == Tags.flameBulletTag)
     {
         Debug.Log("Destroy!");
         main.GetDamagedSound();
         Destroy(this.gameObject, 0.5f);
         Destroy(collision.gameObject);
         anim.SetBool("Dead", true);
     }
 }
コード例 #4
0
 private void OnTriggerEnter2D(Collider2D collision)
 {
     if (collision.gameObject.tag == LevelTwoTags.PlayerTwo)
     {
         Debug.Log("Player Damaged");
         player.PlayerDamaged();
     }
     else if (collision.gameObject.tag == Tags.flameBulletTag)
     {
         Debug.Log("Destroy!");
         main.GetDamagedSound();
         Destroy(this.gameObject, 1f);
         Destroy(collision.gameObject);
         anim.Play("SpiderDead");
         body.isKinematic = false;
     }
 }