void OnTriggerEnter(Collider other) { if ((other.tag == "Boundary") || (other.tag == "enemy") || (other.tag == "pickUp") || (other.tag == "powerShotPickup") || (other.tag == "powerFire")) { if (other.tag == "powerFire") { Instantiate(asteroidExplosionVFX, transform.position, transform.rotation); } else { return; } } else { Instantiate(asteroidExplosionVFX, transform.position, transform.rotation); if (other.tag == "Player") { Control11.lifeDown(); Instantiate(playerExplosionVFX, transform.position, transform.rotation); } Control11.addScore(scoreIncrement); Destroy(other.gameObject); Destroy(gameObject); int i = Random.Range(0, pickUps.Length); int randNo = Random.Range(0, 10 * pickUps.Length); if (i == randNo) { SpawnPickUp(i); } } }
void OnTriggerEnter(Collider other) { if ((other.tag == "Boundary") || (other.tag == "enemy")) { return; } else { if (other.tag == "Player") { Instantiate(asteroidExplosionVFX, transform.position, transform.rotation); Instantiate(playerExplosionVFX, transform.position, transform.rotation); Control11.lifeDown(); } if (wallHealth > 0) { wallHealth -= 1; Destroy(other.gameObject); //To destroy the bolt after collision return; } else { Control11.addScore(scoreIncrement); } Destroy(other.gameObject); Destroy(gameObject); Instantiate(asteroidExplosionVFX, transform.position, transform.rotation); } }
private void OnCollisionEnter(Collision other) { if (other.gameObject.tag == "ball") { gc.addScore(); ball.Play(); Destroy(other.gameObject); titleControler.tC.GetComponent <AudioSource>().PlayOneShot(catchBall); // ball.enableEmission = false; } if (other.gameObject.tag == "gloden") { gc.addGolden(); golden.Play(); Destroy(other.gameObject); titleControler.tC.GetComponent <AudioSource>().PlayOneShot(catchBall); // golden.enableEmission = false; } if (other.gameObject.tag == "bonus") { gc.addBall(); bonus.Play(); Destroy(other.gameObject); titleControler.tC.GetComponent <AudioSource>().PlayOneShot(catchBonus); // bonus.enableEmission = false; } if (other.gameObject.tag == "ground") { isJump = false; } }
void OnTriggerEnter(Collider other) { if (other.tag == "bolt") { con.Decrease(); game.addScore(); Instantiate(explosion, transform.position, transform.rotation); Destroy(other.gameObject); Destroy(gameObject); } }
// Update is called once per frame void Update() { if (controller.getCurrentState() != gameStates.INGAME) { return; } transform.position += new Vector3(speed, 0, 0) * Time.deltaTime; if (transform.position.x < -15) { gameObject.SetActive(false); } if (transform.position.x < controller.player.transform.position.x && !passed) { passed = true; controller.addScore(); } }
private void OnTriggerEnter(Collider other) { if (other.CompareTag("Boundary") || other.CompareTag("Enemy") || other.CompareTag("Boss")) { return; } { if (explosion != null) { Instantiate(explosion, transform.position, transform.rotation); } gamecontroller.addScore(score_value); if (other.CompareTag("Player")) { Instantiate(Player_explosion, other.transform.position, other.transform.rotation); gamecontroller.GameOver(); gamecontroller.RestartButtonActivate(); } Destroy(other.gameObject); Destroy(gameObject); } }