private void OnTriggerEnter2D(Collider2D collision) { if (seepingEnabled) { if (collision.gameObject.name == "SeepingCollider") { cc.enabled = false; bc.enabled = false; } else if (collision.gameObject.name == "RightPoolBoundary") { stopMoving = true; rb.velocity = new Vector2(0, 0); manager.setWaterInPool1(manager.getWaterInPool1() + 1); Destroy(gameObject); } else if (collision.gameObject.name == "WaterPoolColliderRight") { manager.setWaterInPool1(manager.getWaterInPool1() + 1); } } else { if (collision.transform.tag == "bullet2") { heatEnergyThreshold -= heatEnergyIncrement; if (frozen) { Destroy(collision.gameObject); } } else if (collision.gameObject.name == "WaterPoolColliderLeft" && !frozen) { manager.setWaterInPool2(manager.getWaterInPool2() + 1); AudioManager.playSplash(); Destroy(gameObject); } else if (collision.transform.tag == "FreezeCollider") { this.transform.GetChild(0).gameObject.SetActive(false); sr.enabled = true; bc.enabled = true; cc.enabled = false; this.transform.localScale = new Vector3(1, 1, 1); frozen = true; } } if (SceneManager.GetActiveScene().name == "Level 5") { if (collision.tag == "WaterPool" && !frozen) { ILevelManagerWater manager5 = GameObject.Find("GameManager").GetComponent <ILevelManagerWater>(); manager5.SetWaterInPool(manager5.GetWaterInPool() + 1); isInPool = true; AudioManager.playSplash(); Destroy(gameObject); } } }
protected override void Update() { base.Update(); waterBar1.BarValue = manager.getWaterInPool1(); waterBar2.BarValue = manager.getWaterInPool2(); }