void OnTriggerEnter(Collider other) { if (other.name.StartsWith("Alien") && other.tag != "AlienArea") { Vector3 alienTransform = new Vector3(other.gameObject.transform.position.x, other.gameObject.transform.position.y, other.gameObject.transform.position.z); Destroy(other.gameObject); InstantiateExplosion(alienTransform); Destroy(gameObject); switch (other.tag) { case "Alien1": scoreToAdd = alien1Value; break; case "Alien2": scoreToAdd = alien2Value; break; case "Alien3": scoreToAdd = alien3Value; break; } scoreController.AddScore(scoreToAdd); incrementHitCounter(); } else if (other.tag == "Brick") { consecutiveHitController.ResetConsecutiveHits(); } }
void OnTriggerExit(Collider other) { if (other.tag != "FighterJet") { Destroy(other.gameObject); } if (other.tag == "TankBullet") { consecutiveHitController.ResetConsecutiveHits(); } }
void OnTriggerEnter(Collider other) { if (other.tag == "Tank") { tankSoundController.PlayTankExplosionSound(); Destroy(other.gameObject); Destroy(gameObject); lifeController.decrementNumOfLives(); consecutiveHitController.ResetConsecutiveHits(); airStrikeController.HideAirStrikeText(); } }
void Update() { if (consecutiveHitController.AirStrikeIsReady()) { ShowAirStrikeText(); } if (Input.GetKeyDown(KeyCode.E) && consecutiveHitController.AirStrikeIsReady()) { HideAirStrikeText(); consecutiveHitController.ResetConsecutiveHits(); CallAirStrike(); } }