예제 #1
0
 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);
         }
     }
 }
예제 #2
0
 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);
     }
 }
예제 #3
0
 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;
     }
 }
예제 #4
0
 void OnTriggerEnter(Collider other)
 {
     if (other.tag == "bolt")
     {
         con.Decrease();
         game.addScore();
         Instantiate(explosion, transform.position, transform.rotation);
         Destroy(other.gameObject);
         Destroy(gameObject);
     }
 }
예제 #5
0
    // 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();
        }
    }
예제 #6
0
 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);
     }
 }