void OnTriggerEnter(Collider coll) { if (coll.gameObject.tag == "upgradecrate") { upgrade_if_better(coll.gameObject); cs.GetComponent <CrateSpawnerScript>().return_crate(coll.gameObject); } else if (coll.gameObject.tag == "upgradefrontgun") { // What do we want to do here? Destroy(coll.gameObject); } else if (coll.gameObject.tag == "upgradesidegun") { // What do we want to do here? Destroy(coll.gameObject); } else if (coll.gameObject.tag == "shell") { // Week08 Week 08 ShipStatsScript sss = GetComponent <ShipStatsScript>(); ShellScript shellScript = coll.gameObject.GetComponent <ShellScript>(); sss.take_damage(shellScript.damage); shellHolderScript.return_shell(coll.gameObject); shellHolderScript.get_Exp(); //coll.point } else if (coll.gameObject.tag == "mine") { ShipStatsScript sss = GetComponent <ShipStatsScript>(); MineScript mineScript = coll.gameObject.GetComponent <MineScript>(); sss.take_damage(mineScript.damage); } }
private void Update() { if (transform.position.y < -5.0f) { shellHolderScript.return_shell(gameObject); this.gameObject.SetActive(false); } }