//Столкневение с другим объектом private void OnTriggerEnter(Collider other) { if (other.tag == "GameBoundary" || other.tag == "Shield" || other.tag == "Ammo" || other.tag == "WingSupport") { return; } if (other.tag == "Asteroid" && gameObject.transform.position.z > 10f) { return; } if (other.tag != "Player" && other.tag != "PlayerShield" && other.tag != "Boss") { Destroy(other.gameObject); } else if (other.tag == "Player") { gameControllerScript.DecreaseLives(); } if (other.tag == "PlayerShield") { Destroy(this.gameObject); gameControllerScript.LoseShields(); gameControllerScript.LazerManfunction(); } //Destroy(other.gameObject); Destroy(this.gameObject); Instantiate(asteroidExplosion, transform.position, Quaternion.identity); if (other.tag == "Player") { Instantiate(playerExplosion, other.transform.position, Quaternion.identity); } if (other.tag == "Lazer") { gameControllerScript.IncreaseScore(10); Destroy(other.gameObject); Destroy(this.gameObject); } if (other.tag == "Ally") { Instantiate(playerExplosion, other.transform.position, Quaternion.identity); Destroy(other.gameObject); Destroy(this.gameObject); Instantiate(downedAlly, other.transform.position, Quaternion.identity); } }
private void OnTriggerEnter(Collider other) { // столконовение с дополнительным источником щита if (other.tag == "Shield") { gameControllerScript.RiseShields(); Destroy(other.gameObject); StartCoroutine(ShowShieldsRiseStatus()); } // Столкновение с дополнительным источником снарядов для главного и вспосомгательного калибров if (other.tag == "Ammo") { Destroy(other.gameObject); ammoLargeLazer += 10; gameControllerScript.largeLaserTxt.text = "Large Laser " + ammoLargeLazer; ammoSmallLazer += 10; gameControllerScript.smallLaserTxt.text = "Small Laser " + ammoSmallLazer; StartCoroutine(StatusSphereLaunch()); } // Столкновение с бонусом Wing Support if (other.tag == "WingSupport") { Destroy(other.gameObject); if (gameControllerScript.ShowWingSupportCount() != 5 && gameControllerScript.ShowWingSupportCount() < 6) { gameControllerScript.AddWingSupport(); StartCoroutine(AddWingSupportText()); } else if (gameControllerScript.ShowWingSupportCount() == 5) { StartCoroutine(WingSupportIsFull()); gameControllerScript.IncreaseScore(75); } } }