예제 #1
0
    void OnTriggerEnter(Collider other)
    {
        // Snack
        if (other.gameObject.CompareTag("Snack"))
        {
            if (audioManager == null)
            {
                audioManager = FindObjectOfType <AudioManager>();
            }
            BodyPartObject.GetComponent <Player_GrowScript>().Grow();
            other.gameObject.SetActive(false);
            audioManager.Play("EatSound");
            pickUpCount++;
        }

        // When Colliding with itself
        if (other.gameObject.CompareTag("Player"))
        {
            gameController.GameOver();
            activeControls = false;
        }

        // When colliding with a collidable object(s)
        if (other.gameObject.CompareTag("Collider"))
        {
            gameController.GameOver();
            activeControls = false;
        }
    }
예제 #2
0
 void OnTriggerEnter(Collider other)
 {
     if (other.tag == "Boundary")
     {
         Vector3    spawnPosition = transform.position + new Vector3(0.0f, 0.0f, 27.5f);
         Quaternion spawnRotation = Quaternion.identity;
         Instantiate(hazardOrigin, spawnPosition, spawnRotation);
         Destroy(gameObject);
     }
     if (other.tag == "Asteroid")
     {
         Instantiate(explosion, transform.position, transform.rotation);
         Destroy(other.gameObject);
         Destroy(gameObject);
     }
     if (other.tag == "Bolt")
     {
         gameController.AddScore(scoreValue);
         Instantiate(explosion, transform.position, transform.rotation);
         Destroy(other.gameObject);
         Destroy(gameObject);
     }
     if (other.tag == "Player")
     {
         Instantiate(playerExplosion, other.transform.position, other.transform.rotation);
         gameController.GameOver();
         Destroy(other.gameObject);
         Destroy(gameObject);
     }
 }
    private void OnTriggerEnter(Collider other)
    {
        if (other.CompareTag("Boundary") || other.CompareTag("Enemy"))
        {
            return;
        }

        if (explosion != null)
        {
            Instantiate(explosion, transform.position, transform.rotation);
            Destroy(gameObject);
        }

        if (other.tag == "Player")
        {
            Instantiate(playerExplosion, other.transform.position, other.transform.rotation);
            gameController.GameOver();
            Destroy(other.gameObject);
            Destroy(gameObject);
        }

        if (other.tag == "Bolt")
        {
            Instantiate(explosion, transform.position, transform.rotation);
            Destroy(gameObject);
            Destroy(other.gameObject);
        }
        gameController.AddScore(scoreValue);
    }
예제 #4
0
 public void Die()
 {
     dead = true;
     StopAllCoroutines();
     canMelee = false;
     canPing  = false;
     weaponhand.gameObject.SetActive(false);
     GameObject.Instantiate(grave, transform.position, transform.rotation, null);
     gc.GameOver();
     Debug.Log("Alien dead");
 }
예제 #5
0
 public void Die()
 {
     dead = true;
     StopAllCoroutines();
     movespeed        = 0;
     movespeedBoosted = 0;
     movespeedNormal  = 0;
     sr.enabled       = false;
     GameObject.Instantiate(grave, transform.position, transform.rotation, null);
     gc.GameOver();
     Debug.Log("Rover dead");
 }
예제 #6
0
    void OnCollisionEnter2D(Collision2D coll)
    {
        if (coll.gameObject.tag == "enemy")
        {
            Destroy(coll.gameObject);
            scoreValue = 10;
            gameControler.AddScore(scoreValue);
        }

        if (coll.gameObject.tag == "ship")
        {
            gameControler.GameOver();
            Destroy(coll.gameObject);
        }
    }
예제 #7
0
 private void died()
 {
     gc.GameOver();
     reset_Player();
     line_Creator.Reset();
 }