Пример #1
0
        public void RegisterHit(Collider hit)
        {
            GameObject other = hit.gameObject;

            if (other.CompareTag("Player") || other.CompareTag("ProjectileShield"))
            {
                if (ebFound)
                {
                    eb.ApplyDamage(recoilDamage);
                }

                lm.IncrementHealth(playerDamage); //decreases health by passing in a negative
                lm.CollectPollen(pollenLoss);     //decreases pollen by passing in a negative

                if (hitSfx != null)
                {
                    AudioSource.PlayClipAtPoint(hitSfx, other.transform.position);
                }
            }
            else if (other.CompareTag("Hive"))
            {
                if (ebFound)
                {
                    eb.ApplyDamage(recoilDamage);
                }

                hm.IncrementHealth(hiveDamage);
            }
        }
Пример #2
0
        public void FinishSting(int enemyDamage, GameObject target, bool autoKill = false)
        {
            EnemyBehaviour targetEB = target.GetComponent <EnemyBehaviour>();

            targetEB.ApplyDamage(-Math.Abs(enemyDamage));
            if (autoKill)
            {
                targetEB.EnemyDefeated();
            }
        }