Пример #1
0
        public override IEnumerator Activate(GameObject go)
        {
            if (!IsInPreviewMode && go.tag.Contains("Wolf"))
            {
                GameObject boom = CFX_SpawnSystem.GetNextObject(ExplosionEffect);
                boom.transform.position = gameObject.transform.position;

                foreach (var superTarget in Physics
                         .OverlapSphere(transform.position, GameVariables.Trap.LandMine.radius[Level - 1])
                         .Where(T => T.gameObject.tag.Contains("Wolf")))
                {
                    WolfHealth wolf = (WolfHealth)superTarget.GetComponent <WolfHealth>();
                    wolf.takeDamage(Pows[Level - 1]);
                }
                Durability--;
                if (Durability == 0)
                {
                    Destroy(gameObject);
                }
            }
            yield break;
        }
Пример #2
0
        public override IEnumerator Activate(GameObject go)
        {
            if (go.tag.Contains("Wolf"))
            {
                TrapPrefab.GetComponent <Animation>().Play();
                IsActive = true;
                foreach (var superTarget in Physics
                         .OverlapBox(TrapPrefab.transform.position, GetComponent <BoxCollider>().bounds.size)
                         .Where(T => T.gameObject.tag.Contains("Wolf")))
                {
                    WolfHealth wolf = (WolfHealth)go.GetComponent <WolfHealth>();
                    wolf.takeDamage(Pows[Level - 1]);
                }
                yield return(new WaitForSeconds(2f));

                Durability--;
                if (Durability == 0)
                {
                    Destroy(TrapPrefab);
                }
                IsActive = false;
            }
            yield break;
        }