public void OnFighterActionStart(FighterController fighter, FighterAction action, List <FighterController> targets)
 {
     if (!_fightersTakingAction.Contains(fighter))
     {
         _fightersTakingAction.Add(fighter);
     }
 }
 public void OnFighterActionComplete(FighterController fighter, FighterAction action, List <FighterController> targets)
 {
     if (_fightersTakingAction.Contains(fighter))
     {
         _fightersTakingAction.Remove(fighter);
     }
 }
Exemplo n.º 3
0
 public void PlayerFighterActionSelected(FighterAction action)
 {
     if (_currentTrigger == CameraStates.VIEW_PLAYERS)
     {
         UpdateAnimationTrigger(CameraStates.VIEW_ENEMIES);
     }
 }
Exemplo n.º 4
0
 public void PlayerInputComplete(FighterController fighter, FighterAction action, List <FighterController> targets)
 {
     if (fighter == _fighter)
     {
         UpdateAnimationTrigger(CameraStates.DEFAULT);
     }
 }
 public void SubmitFighterInput(FighterController fighter, FighterAction action, List <FighterController> targets)
 {
     if (submitFighterInput != null)
     {
         submitFighterInput.Broadcast(fighter, action, targets);
     }
 }
        private IEnumerator ExecuteActionCoroutine(FighterAction action, List <FighterController> targets)
        {
            // INGRESS
            if (fighterActionStart != null)
            {
                fighterActionStart.Broadcast(this, action, targets);
            }
            yield return(action.ingress.Play(this, action, targets));

            // ACT
            yield return(action.actionSequence.Play(this, action, targets));

            if (fighterActionHandleEffects != null)
            {
                fighterActionHandleEffects.Broadcast(this, action, targets);
            }

            // EGRESS
            yield return(action.egress.Play(this, action, targets));

            if (fighterActionComplete != null)
            {
                fighterActionComplete.Broadcast(this, action, targets);
            }

            // Action finished, reset battle meter
            ResetBattleMeter();
        }
Exemplo n.º 7
0
 public void UpdateIfTargeted(FighterController attacker, FighterAction action, List <FighterController> targets)
 {
     if (targets.Contains(_fighter))
     {
         UpdateUiElements();
     }
 }
Exemplo n.º 8
0
        public override IEnumerator Play(FighterController fighter, FighterAction action, List <FighterController> targets)
        {
            fighter.fighterAnimationController.UpdateAnimationTrigger(runAnimation.trigger);
            yield return(fighter.agentController.SetDestination(fighter.startingPosition, 0));

            fighter.transform.rotation = fighter.startingRotation;
            fighter.fighterAnimationController.UpdateAnimationTrigger(fighter.startingTrigger);
        }
        public void SetActiveFighterAction(FighterAction action)
        {
            input.action = action;

            var targets = action.actionType == ActionType.Healing ? ownFighters.fighters : opposingFighters.fighters;

            var deadOrAliveTargets = targets.Where(target =>
                                                   action.canBeUsedOnDead ? target.stats.currentHealth <= 0 : target.stats.currentHealth > 0
                                                   ).ToList();

            if (availableTargets != null)
            {
                availableTargets.Broadcast(deadOrAliveTargets);
            }
        }
Exemplo n.º 10
0
        private FighterAction GetFighterAction(Fighter fighter, List <Fighter> opponents)
        {
            var action = new FighterAction();

            action.Move = fighter.Position;

            var damagePoints = 10;
            int patternSize  = fighter.PatternSize;

            if (patternSize == 0)
            {
                patternSize = 4;
            }

            var damagePercentage = 1d / patternSize;
            var damage           = damagePoints * damagePercentage;

            for (int i = 0; i < 4; i++)
            {
                if (!fighter.IsAttackingPosition(i))
                {
                    continue;
                }

                var attackAction = new FighterAttack()
                {
                    Position         = i,
                    DamagePercentage = damagePercentage
                };

                var opponentsAtPosition = opponents.Where(x => x.Position == i).ToList();

                foreach (var opponent in opponentsAtPosition)
                {
                    attackAction.Damages.Add(new FighterAttackDamage()
                    {
                        Victim = opponent.Id,
                        Damage = damage
                    });
                }

                action.Attacks.Add(attackAction);
            }

            return(action);
        }
        public override IEnumerator Play(FighterController fighter, FighterAction action, List <FighterController> targets)
        {
            var centerPoint = FighterController.FindCenterPoint(targets);

            // TODO How can I rewrite this to NOT use enum?
            // fighter.ingressAnimation?
            var playRunAnimation = new Action(() =>
            {
                if (action.actionType == ActionType.Healing)
                {
                    fighter.fighterAnimationController.Running();
                }
                else
                {
                    fighter.fighterAnimationController.Charging();
                }
            });

            // End TODO

            playRunAnimation();
            yield return(fighter.agentController.SetDestination(centerPoint, action.ingressStoppingDistance));
        }
 public override List <Transform> FindTransforms(FighterController fighter, FighterAction action, List <FighterController> targets)
 {
     return(new List <Transform> {
         fighter.gameObject.transform
     });
 }
Exemplo n.º 13
0
 public void OnEventBroadcast(FighterAction action) => onEventRaisedHandlers.Invoke(action);
 public BattleCommand(FighterController fighter, FighterAction action, List <FighterController> targets)
 {
     Fighter        = fighter;
     _fighterAction = action;
     _targets       = targets;
 }
Exemplo n.º 15
0
 public abstract IEnumerator Play(FighterController fighter, FighterAction action, List <FighterController> targets);
 public void EnqueueFighterAction(FighterController fighter, FighterAction action, List <FighterController> targets)
 {
     _battleCommandQueue.Enqueue(new BattleCommand(fighter, action, targets));
 }
Exemplo n.º 17
0
 public FighterSkill()
 {
     m_action = (FighterAction)PlayerData.GetInstance().action;
 }
Exemplo n.º 18
0
 public override List <FighterController> FindTargets(FighterController fighter, FighterAction action, List <FighterController> targets)
 {
     return(targets);
 }
 public override List <Transform> FindTransforms(FighterController fighter, FighterAction action, List <FighterController> targets)
 {
     return(targets.Select(target => target.gameObject.transform).ToList());
 }
 public void OnFighterActionStart(FighterController fighter, FighterAction action, List <FighterController> targets)
 {
     EnqueueBattleMessage(fighter.stats.fighterName + " casts " + action.actionName + " on " + targets.Count + " targets");
 }
Exemplo n.º 21
0
 public FighterSkill()
 {
     m_action = (FighterAction)PlayerData.GetInstance().action;
 }
 public void ExecuteAction(FighterAction action, List <FighterController> targets)
 {
     _actionExecutionCoroutine = ExecuteActionCoroutine(action, targets);
     StartCoroutine(_actionExecutionCoroutine);
 }
 public void Hide(FighterController fighter, FighterAction action, List <FighterController> targets) => Hide();
Exemplo n.º 24
0
 public void Broadcast(FighterController fighter, FighterAction action, List <FighterController> targets) =>
 _listeners.ForEach(listener => listener.OnEventBroadcast(fighter, action, targets));
Exemplo n.º 25
0
 public void Broadcast(FighterAction action) => _listeners.ForEach(listener => listener.OnEventBroadcast(action));
Exemplo n.º 26
0
 public void OnEventBroadcast(FighterController fighter, FighterAction action, List <FighterController> targets) =>
 onEventRaisedHandlers.Invoke(fighter, action, targets);