Example #1
0
        public override bool MatchedChangeCondition(AICharacterBrain _Brain)
        {
            animator            = _Brain.GetComponent <Animator>();
            animStateInfomation = animator.GetCurrentAnimatorStateInfo(0);



            if (_Brain.m_SensorManager.m_SensorData.m_HaveEnemy)
            {
                float DistanceBetweenAIAndEnemy = (_Brain.m_SensorManager.m_SensorData.m_EnemyTarget.transform.position - _Brain.m_CurrentTransform.position).sqrMagnitude;
                if (DistanceBetweenAIAndEnemy <= shortRangeDistance * shortRangeDistance)
                {
                    for (int i = 0; i < matchAnimatorName.Length; i++)
                    {
                        if ((animStateInfomation.IsName(matchAnimatorName[i])))
                        {
                            // Debug.Log("Stop because of" + matchAnimatorName[i]);
                            return(false);
                        }
                    }
                    return(true);
                }
            }
            return(false);
        }
 public override bool MatchedChangeCondition(AICharacterBrain _Brain)
 {
     //if (_Brain.GetComponent<MonsterHealth>())
     //{
     //    if (_Brain.GetComponent<MonsterHealth>().m_CharacterHealthPoint <=injuredHealthPercent*_Brain.GetComponent<MonsterHealth>().m_CharacterOriginalHealth)
     //    {
     //        return true;
     //    }
     //}
     if (_Brain.GetComponent <NPCAI.Damageable>())
     {
         if (_Brain.GetComponent <NPCAI.Damageable>().GetHealth() <= injuredHealthPercent * _Brain.GetComponent <NPCAI.Damageable>().startHealth)
         {
             return(true);
         }
     }
     return(false);
 }