Esempio n. 1
0
        private void UnregisterAttack(AttackAction attack)
        {
            incomingAttacks.Remove(attack);

            AttackSightLostEvent?.Invoke(attack);

            if (!incomingAttacks.Any())
            {
                enabled = false;
            }
        }
Esempio n. 2
0
        private bool IsAttackAgainstMe(GameObject gameObject, out AttackAction attack)
        {
            AttackBox attackBox = gameObject.GetComponent <AttackBox>();

            if (attackBox && attackBox.Attack.SourceEntity.TargetedEnemy == entityCombatController)
            {
                attack = attackBox.Attack;
                return(true);
            }

            attack = null;
            return(false);
        }
        private DefenceAction SelectDefence(AttackAction attack, IEnumerable <DefenceAction> availableDefences)
        {
            DefenceAction selectedDefence = null;
            List <DefensiveActionData> possibleDefences = attack.ActionData.PossibleDefences;
            int bestDefenceIndex = int.MaxValue, currentIndex;

            foreach (var defence in availableDefences)
            {
                if ((currentIndex = possibleDefences.IndexOf(defence.ActionData)) < bestDefenceIndex)
                {
                    bestDefenceIndex = currentIndex;
                    selectedDefence  = defence;
                }
            }

            return(selectedDefence);
        }
Esempio n. 4
0
 public void RemoveDefendedAttack(AttackAction attack)
 {
     DefendedAttacks.Remove(attack);
 }
Esempio n. 5
0
 public ReactionToAttack(AttackAction attack, float reactionTimestamp)
 {
     Attack            = attack;
     ReactionTimestamp = reactionTimestamp;
 }