void OnCollisionEnter(Collision other) { if (other.gameObject.tag.Equals("Lethal")) { loseHP(); other.gameObject.SetActive(false); Debug.Log("Get Hit"); if (health == 0) { GM.Instance.GameOver(); GameControl.instance.MainDie(); } } if (other.gameObject.tag.Equals("Die")) { while (health > 0) { loseHP(); } GM.Instance.GameOver(); GameControl.instance.MainDie(); } if (other.gameObject.tag.Equals("PowerUp")) { other.gameObject.SetActive(false); if (health <= 2) { HealthPanel.addHearth(health); health += 1; } else { GM.Instance.point += 3; } } if (other.gameObject.tag.Equals("Coin")) { Debug.Log("Coin collected"); GM.Instance.coinCollected += 1; audio.Play(); other.gameObject.transform.parent.gameObject.SetActive(false); } if (other.gameObject.tag.Equals("Fight")) { hitSmoke = true; audio.Play(); Debug.Log("Giai quyet van de"); GM.Instance.point += 1; whereX = other.transform.position.x; whereY = other.transform.position.y - 0.5f; whereZ = other.transform.position.z; other.gameObject.SetActive(false); } }
public void PlusHP() { if (PlayerController.health < 3) { HealthPanel.addHearth(PlayerController.health); PlayerController.health += 1; } else { GM.Instance.point += 10; } }