Пример #1
0
 void OnTriggerEnter(Collider other)
 {
     if (other.CompareTag("Multiplier"))
     {
         Destroy(other.gameObject);
         m_scoreManager.AddMultiplier(m_multiplier);
         m_objWithSound.Play();
         //Debug.Log("Score: " + m_score + "\n");
     }
 }
Пример #2
0
    void CheckEaten(GameObject other)
    {
        var edible = other.GetComponent <Edible>();

        if (edible != null)
        {
            health.AddHealth(edible.healthValue);
            scoreManager.AddScore(edible.pointValue);
            scoreManager.AddMultiplier(edible.multiplierValue);

            if (managers != null)
            {
                managers.BroadcastMessage("OnEdibleEaten", edible.edibleType, SendMessageOptions.DontRequireReceiver);
            }
        }
    }
Пример #3
0
    public void DamageEnemy(int amt)
    {
        audioSource      = GameObject.Find("GameControl/AudioSystem/Enemy").GetComponent <AudioSource>();
        enemyHealth     -= amt;
        audioSource.clip = enemyHit;
        if (!audioSource.isPlaying)
        {
            audioSource.Play();
        }
        if (enemyHealth < 0 && !isDead)
        {
            enemyHealth = 0;

            Explode();
            SphereCollider col = GetComponent <SphereCollider>();
            col.enabled = false;
            ScoreManager scoreManager = GameObject.Find("GameControl/ScoreManager").GetComponent <ScoreManager>();
            scoreManager.AddScore(enemyScorePoints);
            scoreManager.AddMultiplier(enemyScoreMultiplier);
            Destroy(gameObject, .4f);
            isDead = true;
        }
    }