void Update()
        {
            if (combatController.currentState == CombatController.State.animationFreeze)
            {
                return;
            }

            if (GetComponent <PlayerStats>().isDead)
            {
                return;
            }

            if (stateMachine.state == State.neutral)
            {
                CoolDownTimer[] cdTimers = FindObjectsOfType <CoolDownTimer>();

                foreach (CoolDownTimer cdTimer in cdTimers)
                {
                    if (cdTimer.cooldown == cooldown)
                    {
                        if (!cdTimer.ready)
                        {
                            return;
                        }
                    }
                }


                //attackIndicator.HighlightTargettedCells(selectedAbility, enemyTarget);

                PresetAttack();
            }

            if (stateMachine.state == State.channeling)
            {
                if (!channel.isChanneling)
                {
                    //apply madness if necessary here
                    selectedTargets = GetTargets(selectedAbility, enemyTarget);
                    if (selectedAbility.linkedAbility != null && linkedAbility.targettingClass != selectedAbility.targettingClass)
                    {
                        linkedTargets = GetTargets(linkedAbility, enemyTarget);
                    }

                    attackExecutor.PerformAttack(selectedAbility, selectedTargets, enemyTarget, false);

                    if (selectedAbility.linkedAbility != null)
                    {
                        attackExecutor.PerformAttack(linkedAbility, linkedTargets, enemyTarget, true);
                    }

                    stateMachine.Animate();
                    animationHandler.SetAnimationTimer(testAnimationFrameLength);
                }
            }
        }
示例#2
0
        //used for all other attack targeting types
        public void PerformAttack(List <AttackReceiver> targets, Ability ability)
        {
            GetComponent <AttackReceiver>().BreakNeutralState(false);


            attackExecutor.PerformAttack(ability, targets, this, false);

            if (ability.linkedAbility != null)
            {
                attackExecutor.PerformAttack(ability.linkedAbility, targets, this, true);
            }
        }