Esempio n. 1
0
        public void CombatAnalysis(out float vertical, out float horizontal, out bool IsAttack, Control.AICombosRegistration m_CombosRegistrarion)
        {
            vertical   = 0f;
            horizontal = 0f;
            IsAttack   = false;
            if (IsAFK)
            {
                return;
            }
            float currentDistance = GetDistance();

            if (Math.Abs(currentDistance) < m_SafeDistance)
            {
                horizontal = 0f;
                if (m_AIController.CurrentFSMState == Control.StatesNames.HitReaction)
                {
                    StopAllCoroutines();
                    IsTakingDecision = false;
                }
                else if (m_PlayerController.CurrentFSMState == Control.StatesNames.Attack)
                {
                    if (!IsTakingDecision)
                    {
                        StopAllCoroutines();
                        StartCoroutine(DodgeDelay());
                    }
                }
                else
                {
                    if (!IsTakingDecision)
                    {
                        StopAllCoroutines();
                        StartCoroutine(AttackDelay());
                    }
                }

                if (IsNeedToDodgeAttack)
                {
                    DodgeAttack(out horizontal, out vertical);
                    IsAttack            = false;
                    IsNeedToDodgeAttack = false;
                    IsNeedToAttack      = false;
                }
                else if (IsNeedToAttack)
                {
                    vertical = 0f;
                    IsAttack = true;
                    int numberOfCombo = UnityEngine.Random.Range(0, m_CombosRegistrarion.AmountOfCombos);
                    m_CombosRegistrarion.ChooseCombo(numberOfCombo);
                    IsNeedToDodgeAttack = false;
                    IsNeedToAttack      = false;
                }
                else
                {
                    vertical = 0f;
                    IsAttack = false;
                }
            }
            else
            {
                StopAllCoroutines();
                if (currentDistance < 0f)
                {
                    IsNeedToAttack      = false;
                    IsNeedToDodgeAttack = false;
                    IsTakingDecision    = false;
                    vertical            = 0f;
                    horizontal          = -1f;
                    IsAttack            = false;
                }
                else
                {
                    IsNeedToAttack      = false;
                    IsNeedToDodgeAttack = false;
                    IsTakingDecision    = false;
                    vertical            = 0f;
                    horizontal          = 1f;
                    IsAttack            = false;
                }
            }
            previousPlayerState = m_PlayerController.CurrentFSMState;
        }
Esempio n. 2
0
 public void SetEnemyData(HeroController enemyController, Control.AICombosRegistration m_CombosRegistrarion)
 {
     m_PlayerController = enemyController;
     m_PlayerTransform  = enemyController.transform;
     m_CombosRegistrarion.OnResetCombo += EndTakingDecision;
 }