void Start()
        {
            abilities        = GetComponent <EnemySpells>().ability;
            safeAbility      = GetComponent <EnemySpells>().safeAbility;
            targets          = FindObjectsOfType <Fighter>();
            mover            = GetComponent <Mover>();
            onRailsMover     = GetComponent <OnRailsMover>();
            cooldown         = GetComponent <CoolDown>();
            channel          = GetComponent <Channel>();
            attackIndicator  = GetComponent <AttackIndicator>();
            attackReceiver   = GetComponent <AttackReceiver>();
            attackExecutor   = GetComponent <AttackExecutor>();
            enemyTarget      = GetComponent <EnemyTarget>();
            spline           = GetComponent <splineMove>();
            stateMachine     = GetComponent <StateMachine>();
            animationHandler = GetComponent <AnimationHandler>();

            allEnemies   = FindObjectsOfType <EnemyTarget>();
            allActors    = FindObjectsOfType <Fighter>();
            allPushables = FindObjectsOfType <Pushable>();

            combatController     = FindObjectOfType <CombatController>();
            cooldown.isOnCD      = true;
            channel.isChanneling = false;
            channel.channel      = 0f;

            //print("allPushables start count: " + allPushables.Length);

            //perform attack once will be used to check if the current attack is in progress
        }
        public void DealDamageByInstance(AttackReceiver targetInstance)
        {
            if (!savedTargets.Contains(targetInstance))
            {
                return;
            }

            //print("dealing damage by instance");
            //print("enemies saved: " + savedTargets.Count);


            print("target name: " + targetInstance);
            if (targetInstance.isProtected)
            {
                savedTargets.Remove(targetInstance);
                SpawnProtectorVFX(targetInstance);
                targetInstance = GetTargetProtector(targetInstance);
            }

            targetInstance.GetComponent <AnimationHandler>().GetHurtLight();

            savedTargets.Remove(targetInstance);

            if (savedTargets.Count < 1)
            {
                ClearTargetCache();
            }

            //EDIT THIS TO SCALE ANIMATION BASED ON INCOMING DAMAGE, USE SAVED ENEMY ATTACK AND SAVED ABILITY FOR THIS
        }
        private void SpawnProtectorVFX(AttackReceiver attackReceiver)
        {
            Vector3        yOffset   = new Vector3(5f, 5f, 0f);
            ProtectGhostFX protectFX = Instantiate(myProtectFX);

            protectFX.transform.position = attackReceiver.transform.position + yOffset;
            protectFX.currentSprite      = attackReceiver.protector.GetComponent <FXHandler>().protectFX;
        }
Exemple #4
0
        // Start is called before the first frame update
        void Start()
        {
            combatController = FindObjectOfType <CombatController>();
            attackReceiver   = GetComponent <AttackReceiver>();
            playerStats      = GetComponent <PlayerStats>();

            goodStatusTimerMax = goodStatusTimer;
            badStatusTimerMax  = badStatusTimer;
        }
        private static AttackReceiver GetTargetProtector(AttackReceiver targetInstance)
        {
            AttackReceiver oldTarget = targetInstance;

            print("switching target to protector");
            targetInstance              = targetInstance.protector;
            oldTarget.isProtected       = false;
            targetInstance.isProtecting = false;
            return(targetInstance);
        }
Exemple #6
0
        public void TrapTrigger(AttackReceiver attackReceiver)
        {
            switch (trapType)
            {
            case TrapType.spikes:
                attackReceiver.TakeDamage(damage);
                print("trap dealt " + damage + " to " + attackReceiver.name);
                break;

            case TrapType.poppy:
                attackReceiver.ApplyBadStatusEffect(StatusEffect.madness, poppyTimer);
                print("trap caused " + attackReceiver.name + " to go MAD!");
                break;

            case TrapType.caltrop:
                attackReceiver.GetComponent <StatHandler>().ApplyNerf(StatHandler.StatChanges.StrengthNerf, 1);
                print("trap caused " + attackReceiver.name + "to lose strength!");
                break;

            case TrapType.tar:
                attackReceiver.GetComponent <StatHandler>().ApplyNerf(StatHandler.StatChanges.SpeedNerf, 1);
                print("trap caused " + attackReceiver.name + "to lose speed!");
                break;

            case TrapType.ice:
                attackReceiver.GetComponent <StatHandler>().ApplyNerf(StatHandler.StatChanges.ArmorNerf, 1);
                print("trap caused " + attackReceiver.name + "to lose armor!");
                break;

            case TrapType.pit:
                print(attackReceiver.name + "has disappeared!");
                attackReceiver.GetComponent <Fighter>().Remove();
                break;

            case TrapType.shadow:
                attackReceiver.ApplyBadStatusEffect(StatusEffect.burn, poppyTimer);
                print("trap burned " + attackReceiver.name);
                break;

            case TrapType.meat:
                attackReceiver.Heal(damage, false);
                print(attackReceiver.name + " ate the raw meat and gained " + damage + " health!");
                break;

            default:
                print("trap did nothing");
                break;
            }
        }
Exemple #7
0
 public void AddTarget(AttackReceiver target)
 {
     targets.Add(target);
 }
 private void Start()
 {
     transform.position = GetComponentInParent <AbilityFX>().caster.transform.position + targetHeightOffset;
     target             = GetComponentInParent <AbilityFX>().targets[0];
 }