Exemplo n.º 1
0
        void Death()
        {
            // The enemy is dead.
            isDead = true;

            // Turn the collider into a trigger so shots can pass through it.
            capsuleCollider.isTrigger = true;

            // Find and disable the Nav Mesh Agent.
            GetComponent <NavMeshAgent> ().enabled = false;

            // Find the rigidbody component and make it kinematic (since we use Translate to sink the enemy).
            GetComponent <Rigidbody> ().isKinematic = true;

            // The enemy should no sink.
            isSinking = true;

            // Increase the score by the enemy's score value.
            DayManager.credits += dayValue;

            // After 2 seconds destory the enemy.
            Destroy(gameObject, 8f);

            enemyMaster.CallEventEnemyDie();


            // Change the audio clip of the audio source to the death clip and play it (this will stop the hurt clip playing).
            enemyAudio.clip = deathClip;
            enemyAudio.Play();
        }
Exemplo n.º 2
0
        public void DeductHealth(int healthChange)
        {
            enemyHealth -= healthChange;
            if (enemyHealth <= 0)
            {
                enemyHealth = 0;
                GetComponent <NavMeshAgent> ().enabled   = false;
                GetComponent <SphereCollider> ().enabled = false;
                DayManager.credits        += dayValue;
                ShardsCollected.creditss  += dayValue;
                EnemiesKilledEnd.killends += killendvalue;
                enemyMaster.CallEventEnemyDie();
                RewardOrder.rewardCount  -= dederAl;
                RewardOrder2.rewardCount -= dederAl;
                RewardOrder3.rewardCount -= dederAl;

                partsyscryst.SetActive(true);

                Destroy(gameObject, Random.Range(7, 8));

                moneySource.clip = munnyClip;
                moneySource.Play();
                int dedCclip = Random.Range(0, deathClip.Length);
                enemySource.clip = deathClip[dedCclip];
                enemySource.Play();

                kilstrek.strtKillsTime();

                Killstreak.killstreaks += 1;

                this.enabled = false;
            }
        }
        void DeductHealth(int healthChange)
        {
            enemyHealth -= healthChange;
            if (enemyHealth <= 0)
            {
                enemyHealth = 0;
                enemyMaster.CallEventEnemyDie();
                Destroy(gameObject, Random.Range(10, 20));
            }

            CheckHealthFraction();
        }
Exemplo n.º 4
0
        void DeductHealth(int healthChange)
        {
            int index1 = Random.Range(0, golemHealth.Length);

            AudioSource.PlayClipAtPoint(golemHealth[index1], myTransform.position);
            enemyHealth -= healthChange;
            if (enemyHealth <= 0)
            {
                enemyHealth = 0;
                int index2 = Random.Range(0, golemDie.Length);
                AudioSource.PlayClipAtPoint(golemDie[index2], myTransform.position);
                enemyMaster.CallEventEnemyDie();
                Destroy(gameObject, Random.Range(3, 4));
            }
        }