Пример #1
0
 void OnCollisionEnter(Collision other)
 {
     if (other.collider.tag == "Walker")
     {
         GameObject tmpBlood = Instantiate(m_blood, new Vector3(transform.position.x, transform.position.y, transform.position.z), Quaternion.identity);
         Destroy(tmpBlood.gameObject, 5f);
         other.gameObject.GetComponent <ZombieWalker>().m_isAlive = false;
         Destroy(this.gameObject);
         m_scoreTracker.AddBonusScore(20);
     }
 }
Пример #2
0
 void OnTriggerEnter(Collider other)
 {
     // Death
     if (other.tag == "Zombie")
     {
         PlayerPrefs.SetInt("Score", (int)m_scoreScript.GetScore());
         SceneManager.LoadScene("GameOver");
     }
     // Pick-Ups
     if (other.tag == "Ammo")
     {
         m_scoreScript.AddBonusScore(10);
         m_reloadSource.PlayOneShot(m_reloadSound, 14.0f);
         m_ammo += 3;
         Destroy(other.gameObject);
     }
 }
Пример #3
0
    private void OnTriggerEnter(Collider collider)
    {
        if (state == State.Alive)
        {
            switch (collider.gameObject.tag)
            {
            case "Bonus Score":
                scoreTracker.AddBonusScore();
                GameObject bonus = GameObject.FindGameObjectWithTag("Bonus Score Pickup");
                bonusScoreParticles.Play();
                bonus.SetActive(false);
                break;

            case "Enemy Laser":
                break;

            case "Fuel":
                break;

            default:
                break;
            }
        }
    }