public void Encounter() { isBear = false; if (player.GetComponent <PlayerControl>().GetInjured()) { choiseScreen.SetActive(false); StartCoroutine(LoadMain()); Desicion.Stop(); Dead.Play(); } else { choiseScreen.SetActive(false); Desicion.Stop(); gun.Play(); End.Play(); bear.Stop(); StartCoroutine(LoadEnd()); } }
// Update is called once per frame void Update() { if (isBear) { if (Input.GetKeyDown(KeyCode.LeftArrow) || Input.GetKeyDown(KeyCode.A)) { GameManager.Instance.SpawnLocation = SpotInScene1; GameManager.Instance.SpawnRotation = RotationInScene1; choiseScreen.SetActive(false); Desicion.Stop(); Main.Play(); isBear = false; } else if (Input.GetKeyDown(KeyCode.RightArrow) || Input.GetKeyDown(KeyCode.D)) { if (player.GetComponent <PlayerControl>().GetInjured()) { choiseScreen.SetActive(false); Desicion.Stop(); Dead.Play(); StartCoroutine(LoadMain()); isBear = false; } else { choiseScreen.SetActive(false); Desicion.Stop(); gun.Play(); End.Play(); bear.Stop(); StartCoroutine(LoadEnd()); isBear = false; } } } }
void OnCollisionEnter2D(Collision2D other) { if (other.gameObject.tag == "Enemy") { count += 1; print("ouch"); if (count == 6 && player.curhealth > 0) { health -= 1; player.curhealth -= 1; if (player.curhealth < 0) { player.curhealth = 0; } count = 0; } else if (count >= 1 && player.curhealth <= 0) { health -= 1; } if (health > 0) { Ouch.Play(); } else { Dead.Play(); } print(health); } else if (other.gameObject.tag == "BBossBull") { print("ouch"); health -= 1; if (health > 0) { Ouch.Play(); } else { Dead.Play(); } print(health); } else if (other.gameObject.tag == "eb") { print("ouch"); health -= 1; if (health > 0) { Ouch.Play(); } else { Dead.Play(); } print(health); } }