Example #1
0
 public AIGoalDescriptor(float priority, float tenacityMultiplier = 1.0f, AIGoalType type = AIGoalType.Scripted, AIGoalStatus status = AIGoalStatus.Pending)
 {
     this.priority = priority;
     this.tenacityMultiplier = tenacityMultiplier;
     this.type = type;
     this.status = status;
 }
Example #2
0
        private bool CanJumpBack()
        {
            if (this.m_GoalsModule.m_JumpBackGoal == null)
            {
                return(false);
            }
            AIGoal activeGoal = this.m_GoalsModule.m_ActiveGoal;

            if (activeGoal == null)
            {
                return(false);
            }
            AIGoalType type = activeGoal.m_Type;

            if (type == AIGoalType.JumpBack)
            {
                return(false);
            }
            if ((type == AIGoalType.ReactOnHit || type == AIGoalType.HumanPunchBack) && this.m_Animator.GetCurrentAnimatorStateInfo(0).normalizedTime <= 0.5f)
            {
                return(false);
            }
            float num = base.transform.position.Distance(Player.Get().transform.position);

            return(num <= this.m_Params.m_JumpBackRange && UnityEngine.Random.Range(0f, 1f) <= this.m_GoalsModule.m_JumpBackGoal.m_Probability);
        }
Example #3
0
 //   public AIGoalPrioritizer prioritizer;       //might be a string lookup
 //   public AIGoalTargetSelector targetSelector; //might be a string lookup
 //todo introduce AIGoalStatus.Valid|Invalid.
 //use case would be target list but some have not entered battle yet
 public AIGoal(AIGoalDescriptor descriptor)
 {
     this.status = descriptor.status;
     this.type = descriptor.type;
     this.priority = descriptor.priority;
     this.tenacityMultiplier = descriptor.tenacityMultiplier;
     if (this.status == AIGoalStatus.Pending) {
         OnActivate();
     }
 }
Example #4
0
 public void OnGoalActivate(AIGoalType goal_type)
 {
     if (goal_type == AIGoalType.Idle)
     {
         this.RequestSound(AISoundType.Idle);
         return;
     }
     if (goal_type != AIGoalType.MoveAwayFromEnemy)
     {
         return;
     }
     this.RequestSound(AISoundType.Panic);
 }
Example #5
0
        public bool CanReceiveHit()
        {
            if (this.m_GoalsModule.m_ActiveGoal == null)
            {
                return(true);
            }
            AIGoalType type = this.m_GoalsModule.m_ActiveGoal.m_Type;

            if (type == AIGoalType.HumanHitReaction)
            {
                return(this.m_Animator.GetCurrentAnimatorStateInfo(0).length *this.m_Animator.GetCurrentAnimatorStateInfo(0).normalizedTime > 0.1f);
            }
            return(type != AIGoalType.HumanJumpBack || this.m_Animator.GetCurrentAnimatorStateInfo(0).normalizedTime > 0.5f);
        }
        public override bool ShouldPerform()
        {
            if (this.m_Active)
            {
                return(base.GetDuration() < this.m_Length);
            }
            if (this.m_AI.m_GoalsModule.m_PrevGoal == null)
            {
                return(true);
            }
            AIGoalType type = this.m_AI.m_GoalsModule.m_PrevGoal.m_Type;

            return(type == AIGoalType.HumanAttack || type == AIGoalType.HumanJumpAttack);
        }
Example #7
0
        private bool CanJumpBack()
        {
            if (this.m_GoalsModule.m_JumpBackGoal == null)
            {
                return(false);
            }
            AIGoal activeGoal = this.m_GoalsModule.m_ActiveGoal;

            if (activeGoal == null)
            {
                return(false);
            }
            AIGoalType type = activeGoal.m_Type;

            return(type != AIGoalType.JumpBack && ((type != AIGoalType.ReactOnHit && type != AIGoalType.HumanPunchBack) || this.m_Animator.GetCurrentAnimatorStateInfo(0).normalizedTime > 0.5f) && base.transform.position.Distance(this.m_EnemyModule.m_Enemy.transform.position) <= this.m_Params.m_JumpBackRange && UnityEngine.Random.Range(0f, 1f) <= this.m_GoalsModule.m_JumpBackGoal.m_Probability);
        }
        private bool CanJumpBack()
        {
            if (this.m_AI.m_GoalsModule.m_JumpBackGoal == null)
            {
                return(false);
            }
            AIGoal activeGoal = this.m_AI.m_GoalsModule.m_ActiveGoal;

            if (activeGoal == null)
            {
                return(false);
            }
            AIGoalType type = activeGoal.m_Type;

            return(type != AIGoalType.HumanJumpBack && type != AIGoalType.HumanJumpAttack && ((type != AIGoalType.HumanHitReaction && type != AIGoalType.HumanPunchBack) || this.m_AI.m_Animator.GetCurrentAnimatorStateInfo(0).normalizedTime > 0.5f) && base.transform.position.Distance(Player.Get().transform.position) <= this.m_AI.m_Params.m_JumpBackRange && (!(this.m_LastFailedJumpBackPos != Vector3.zero) || this.m_LastFailedJumpBackPos.Distance(base.transform.position) >= 5f) && Vector3.Dot(base.transform.forward, (Player.Get().transform.position - base.transform.position).normalized) >= 0.25f && UnityEngine.Random.Range(0f, 1f) <= this.m_AI.m_GoalsModule.m_JumpBackGoal.m_Probability);
        }
Example #9
0
 public void ActivateGoal(AIGoalType type)
 {
     if (this.m_Goals.Count == 0)
     {
         this.m_GoalToActivate = type;
         return;
     }
     for (int i = 0; i < this.m_Goals.Count; i++)
     {
         if (this.m_Goals[i].m_Type == type)
         {
             this.ActivateGoal(this.m_Goals[i]);
             return;
         }
     }
 }
Example #10
0
        public bool CanReceiveHit(Item damage_item = null)
        {
            if (this.m_GoalsModule.m_ActiveGoal == null)
            {
                return(true);
            }
            if (damage_item && damage_item.IsSpikes())
            {
                return(true);
            }
            AIGoalType type = this.m_GoalsModule.m_ActiveGoal.m_Type;

            if (type == AIGoalType.HumanHitReaction && this.m_Animator)
            {
                return(this.m_Animator.GetCurrentAnimatorStateInfo(0).length *this.m_Animator.GetCurrentAnimatorStateInfo(0).normalizedTime > 0.1f);
            }
            return(type != AIGoalType.HumanJumpBack || !this.m_Animator || this.m_Animator.GetCurrentAnimatorStateInfo(0).normalizedTime > 0.5f);
        }
        public override bool ShouldPerform()
        {
            if (this.m_HunterAI.m_WeaponType != HumanAI.WeaponType.Primary)
            {
                return(false);
            }
            if (this.m_Active)
            {
                return(base.GetDuration() < this.m_Length);
            }
            if (this.m_AI.m_GoalsModule.m_PrevGoal == null)
            {
                return(true);
            }
            AIGoalType type = this.m_AI.m_GoalsModule.m_PrevGoal.m_Type;

            return(type == AIGoalType.HunterBowAttack);
        }
        public override bool ShouldPerform()
        {
            if (this.m_Active)
            {
                return(true);
            }
            if (this.m_AI.m_GoalsModule.m_PrevGoal == null)
            {
                return(false);
            }
            AIGoalType type = this.m_AI.m_GoalsModule.m_PrevGoal.m_Type;

            if (type != AIGoalType.HumanAttack)
            {
                bool flag = type == AIGoalType.HumanJumpAttack;
            }
            return((type == AIGoalType.HumanAttack || type == AIGoalType.HumanJumpAttack) && type != AIGoalType.HumanMoveToEnemy);
        }