示例#1
0
        public override float GetScore(BaseContext c)
        {
            if (this.requireRanged && c.GetFact(NPCPlayerApex.Facts.CurrentWeaponType) == (byte)1)
            {
                return(this.Equality <= HasHumanFactAmmo.EqualityEnum.Equal ? 0.0f : 1f);
            }
            byte fact = c.GetFact(NPCPlayerApex.Facts.CurrentAmmoState);

            switch (this.Equality)
            {
            case HasHumanFactAmmo.EqualityEnum.Greater:
                return((NPCPlayerApex.AmmoStateEnum)fact >= this.value ? 0.0f : 1f);

            case HasHumanFactAmmo.EqualityEnum.Gequal:
                return((NPCPlayerApex.AmmoStateEnum)fact > this.value ? 0.0f : 1f);

            case HasHumanFactAmmo.EqualityEnum.Lequal:
                return((NPCPlayerApex.AmmoStateEnum)fact < this.value ? 0.0f : 1f);

            case HasHumanFactAmmo.EqualityEnum.Lesser:
                return((NPCPlayerApex.AmmoStateEnum)fact <= this.value ? 0.0f : 1f);

            default:
                return((NPCPlayerApex.AmmoStateEnum)fact != this.value ? 0.0f : 1f);
            }
        }
 public static bool Evaluate(BaseContext c)
 {
     if (c is NPCHumanContext)
     {
         return(c.GetFact(NPCPlayerApex.Facts.IsRoamReady) > 0);
     }
     return(c.GetFact(BaseNpc.Facts.IsRoamReady) > 0);
 }
 public override float GetScore(BaseContext c)
 {
     if (c.GetFact(BaseNpc.Facts.FoodRange) != (byte)this.@value)
     {
         return(0f);
     }
     return(1f);
 }
示例#4
0
 public override float GetScore(BaseContext c)
 {
     if (c.GetFact(NPCPlayerApex.Facts.EnemyEngagementRange) != (byte)this.@value)
     {
         return(0f);
     }
     return(1f);
 }
示例#5
0
 public override float GetScore(BaseContext c)
 {
     if (c.GetFact(this.fact) != this.@value)
     {
         return(0f);
     }
     return(1f);
 }
示例#6
0
 public override float GetScore(BaseContext c)
 {
     if (c.GetFact(NPCPlayerApex.Facts.BodyState) != (byte)this.@value)
     {
         return(0f);
     }
     return(1f);
 }
 public static void NavigateToEnemy(BaseContext c)
 {
     if (c.GetFact(BaseNpc.Facts.HasEnemy) > 0 && c.AIAgent.IsNavRunning())
     {
         NavigateToOperator.MakeUnstuck(c);
         c.AIAgent.Destination = c.EnemyPosition;
         c.AIAgent.SetTargetPathStatus(0.05f);
     }
 }
示例#8
0
        public override void DoExecute(BaseContext c)
        {
            if (c.GetFact(BaseNpc.Facts.CanNotMove) == (byte)1)
            {
                c.AIAgent.StopMoving();
                c.SetFact(BaseNpc.Facts.PathToTargetStatus, (byte)2);
            }
            else
            {
                if (!c.AIAgent.IsNavRunning() || c.AIAgent.GetNavAgent.get_pathPending())
                {
                    return;
                }
                switch (this.Operator)
                {
                case NavigateToOperator.OperatorType.EnemyLoc:
                    NavigateToOperator.NavigateToEnemy(c);
                    break;

                case NavigateToOperator.OperatorType.RandomLoc:
                    NavigateToOperator.NavigateToRandomLoc(c);
                    break;

                case NavigateToOperator.OperatorType.Spawn:
                    NavigateToOperator.NavigateToSpawn(c);
                    break;

                case NavigateToOperator.OperatorType.FoodLoc:
                    NavigateToOperator.NavigateToFood(c);
                    break;

                case NavigateToOperator.OperatorType.FleeEnemy:
                    NavigateToOperator.FleeEnemy(c);
                    break;

                case NavigateToOperator.OperatorType.FleeHurtDir:
                    NavigateToOperator.FleeHurtDir(c);
                    break;

                case NavigateToOperator.OperatorType.TopologyPreference:
                    NavigateToOperator.NavigateToTopologyPreference(c);
                    break;
                }
            }
        }
        public override float GetScore(BaseContext c)
        {
            object obj;

            if (this.@value)
            {
                obj = 1;
            }
            else
            {
                obj = null;
            }
            byte num = (byte)obj;

            if (c.GetFact(this.fact) != num)
            {
                return(0f);
            }
            return(1f);
        }
示例#10
0
        public static void AttackEnemy(BaseContext c, AttackOperator.AttackType type)
        {
            if (c.GetFact(BaseNpc.Facts.IsAttackReady) == 0)
            {
                return;
            }
            BaseCombatEntity enemyNpc = null;

            if (c.EnemyNpc != null)
            {
                enemyNpc = c.EnemyNpc;
            }
            if (c.EnemyPlayer != null)
            {
                enemyNpc = c.EnemyPlayer;
            }
            if (enemyNpc == null)
            {
                return;
            }
            c.AIAgent.StartAttack(type, enemyNpc);
            c.SetFact(BaseNpc.Facts.IsAttackReady, 0);
        }
        public static void AttackEnemy(BaseContext c, AttackOperator.AttackType type)
        {
            if (c.GetFact(BaseNpc.Facts.IsAttackReady) == (byte)0)
            {
                return;
            }
            BaseCombatEntity target = (BaseCombatEntity)null;

            if (Object.op_Inequality((Object)c.EnemyNpc, (Object)null))
            {
                target = (BaseCombatEntity)c.EnemyNpc;
            }
            if (Object.op_Inequality((Object)c.EnemyPlayer, (Object)null))
            {
                target = (BaseCombatEntity)c.EnemyPlayer;
            }
            if (Object.op_Equality((Object)target, (Object)null))
            {
                return;
            }
            c.AIAgent.StartAttack(type, target);
            c.SetFact(BaseNpc.Facts.IsAttackReady, (byte)0);
        }
 public override float GetScore(BaseContext c)
 {
     return((NPCPlayerApex.EnemyEngagementRangeEnum)c.GetFact(NPCPlayerApex.Facts.EnemyEngagementRange) != this.value ? 0.0f : 1f);
 }
示例#13
0
 public override float GetScore(BaseContext c)
 {
     return((NPCPlayerApex.SpeedEnum)c.GetFact(NPCPlayerApex.Facts.Speed) != this.value ? 0.0f : 1f);
 }
 public static void NavigateToFood(BaseContext c)
 {
     if (c.AIAgent.FoodTarget != null && !c.AIAgent.FoodTarget.IsDestroyed && c.AIAgent.FoodTarget.transform != null && c.GetFact(BaseNpc.Facts.FoodRange) < 2 && c.AIAgent.IsNavRunning())
     {
         NavigateToOperator.MakeUnstuck(c);
         c.AIAgent.Destination = c.AIAgent.FoodTarget.ServerPosition;
         c.AIAgent.SetTargetPathStatus(0.05f);
     }
 }
        public override void DoExecute(BaseContext c)
        {
            NPCHumanContext c1 = c as NPCHumanContext;

            if (c.GetFact(NPCPlayerApex.Facts.CanNotMove) == (byte)1 || c1 != null && c1.Human.NeverMove)
            {
                c.AIAgent.StopMoving();
                c1?.Human.SetFact(NPCPlayerApex.Facts.PathToTargetStatus, (byte)2, true, true);
            }
            else
            {
                c.AIAgent.SetFact(NPCPlayerApex.Facts.IsRetreatingToCover, (byte)0, true, true);
                c.AIAgent.SetFact(NPCPlayerApex.Facts.SidesteppedOutOfCover, (byte)0, true, true);
                if ((double)Time.get_time() - (double)c1.LastNavigationTime < 1.0)
                {
                    return;
                }
                c1.LastNavigationTime = Time.get_time();
                if (c1.Human.NavAgent.get_pathPending())
                {
                    return;
                }
                switch (this.Operator)
                {
                case HumanNavigateToOperator.OperatorType.EnemyLoc:
                    HumanNavigateToOperator.NavigateToEnemy(c1);
                    break;

                case HumanNavigateToOperator.OperatorType.RandomLoc:
                    HumanNavigateToOperator.NavigateToRandomLoc(c1);
                    break;

                case HumanNavigateToOperator.OperatorType.SpawnLoc:
                    HumanNavigateToOperator.NavigateToSpawnLoc(c1);
                    break;

                case HumanNavigateToOperator.OperatorType.FleeEnemy:
                    HumanNavigateToOperator.FleeEnemy(c1);
                    break;

                case HumanNavigateToOperator.OperatorType.FleeHurtDir:
                    HumanNavigateToOperator.FleeHurtDir(c1);
                    break;

                case HumanNavigateToOperator.OperatorType.RetreatCover:
                    HumanNavigateToOperator.NavigateToCover(c1, HumanNavigateToOperator.TakeCoverIntention.Retreat);
                    break;

                case HumanNavigateToOperator.OperatorType.FlankCover:
                    HumanNavigateToOperator.NavigateToCover(c1, HumanNavigateToOperator.TakeCoverIntention.Flank);
                    break;

                case HumanNavigateToOperator.OperatorType.AdvanceCover:
                    HumanNavigateToOperator.NavigateToCover(c1, HumanNavigateToOperator.TakeCoverIntention.Advance);
                    break;

                case HumanNavigateToOperator.OperatorType.FleeExplosive:
                    HumanNavigateToOperator.FleeExplosive(c1);
                    break;

                case HumanNavigateToOperator.OperatorType.Sidestep:
                    HumanNavigateToOperator.Sidestep(c1);
                    break;

                case HumanNavigateToOperator.OperatorType.ClosestCover:
                    HumanNavigateToOperator.NavigateToCover(c1, HumanNavigateToOperator.TakeCoverIntention.Closest);
                    break;

                case HumanNavigateToOperator.OperatorType.PatrolLoc:
                    HumanNavigateToOperator.NavigateToPatrolLoc(c1);
                    break;

                case HumanNavigateToOperator.OperatorType.MountableChair:
                    HumanNavigateToOperator.NavigateToMountableLoc(c1, this.Operator);
                    break;

                case HumanNavigateToOperator.OperatorType.WaypointLoc:
                    HumanNavigateToOperator.NavigateToWaypointLoc(c1);
                    break;

                case HumanNavigateToOperator.OperatorType.LastEnemyLoc:
                    HumanNavigateToOperator.NavigateToLastEnemy(c1);
                    break;

                case HumanNavigateToOperator.OperatorType.HideoutLoc:
                    HumanNavigateToOperator.NavigateToHideout(c1);
                    break;
                }
            }
        }
示例#16
0
 public override float GetScore(BaseContext c)
 {
     return((NPCPlayerApex.BodyState)c.GetFact(NPCPlayerApex.Facts.BodyState) != this.value ? 0.0f : 1f);
 }
        public override void DoExecute(BaseContext c)
        {
            NPCHumanContext nPCHumanContext = c as NPCHumanContext;

            if (c.GetFact(NPCPlayerApex.Facts.CanNotMove) == 1 || nPCHumanContext != null && nPCHumanContext.Human.NeverMove)
            {
                c.AIAgent.StopMoving();
                if (nPCHumanContext != null)
                {
                    nPCHumanContext.Human.SetFact(NPCPlayerApex.Facts.PathToTargetStatus, 2, true, true);
                }
                return;
            }
            c.AIAgent.SetFact(NPCPlayerApex.Facts.IsRetreatingToCover, 0, true, true);
            c.AIAgent.SetFact(NPCPlayerApex.Facts.SidesteppedOutOfCover, 0, true, true);
            if (UnityEngine.Time.time - nPCHumanContext.LastNavigationTime < 1f)
            {
                return;
            }
            nPCHumanContext.LastNavigationTime = UnityEngine.Time.time;
            if (nPCHumanContext.Human.NavAgent.pathPending)
            {
                return;
            }
            switch (this.Operator)
            {
            case HumanNavigateToOperator.OperatorType.EnemyLoc:
            {
                HumanNavigateToOperator.NavigateToEnemy(nPCHumanContext);
                return;
            }

            case HumanNavigateToOperator.OperatorType.RandomLoc:
            {
                HumanNavigateToOperator.NavigateToRandomLoc(nPCHumanContext);
                return;
            }

            case HumanNavigateToOperator.OperatorType.SpawnLoc:
            {
                HumanNavigateToOperator.NavigateToSpawnLoc(nPCHumanContext);
                return;
            }

            case HumanNavigateToOperator.OperatorType.FleeEnemy:
            {
                HumanNavigateToOperator.FleeEnemy(nPCHumanContext);
                return;
            }

            case HumanNavigateToOperator.OperatorType.FleeHurtDir:
            {
                HumanNavigateToOperator.FleeHurtDir(nPCHumanContext);
                return;
            }

            case HumanNavigateToOperator.OperatorType.RetreatCover:
            {
                HumanNavigateToOperator.NavigateToCover(nPCHumanContext, HumanNavigateToOperator.TakeCoverIntention.Retreat);
                return;
            }

            case HumanNavigateToOperator.OperatorType.FlankCover:
            {
                HumanNavigateToOperator.NavigateToCover(nPCHumanContext, HumanNavigateToOperator.TakeCoverIntention.Flank);
                return;
            }

            case HumanNavigateToOperator.OperatorType.AdvanceCover:
            {
                HumanNavigateToOperator.NavigateToCover(nPCHumanContext, HumanNavigateToOperator.TakeCoverIntention.Advance);
                return;
            }

            case HumanNavigateToOperator.OperatorType.FleeExplosive:
            {
                HumanNavigateToOperator.FleeExplosive(nPCHumanContext);
                return;
            }

            case HumanNavigateToOperator.OperatorType.Sidestep:
            {
                HumanNavigateToOperator.Sidestep(nPCHumanContext);
                return;
            }

            case HumanNavigateToOperator.OperatorType.ClosestCover:
            {
                HumanNavigateToOperator.NavigateToCover(nPCHumanContext, HumanNavigateToOperator.TakeCoverIntention.Closest);
                return;
            }

            case HumanNavigateToOperator.OperatorType.PatrolLoc:
            {
                HumanNavigateToOperator.NavigateToPatrolLoc(nPCHumanContext);
                return;
            }

            case HumanNavigateToOperator.OperatorType.MountableChair:
            {
                HumanNavigateToOperator.NavigateToMountableLoc(nPCHumanContext, this.Operator);
                return;
            }

            case HumanNavigateToOperator.OperatorType.WaypointLoc:
            {
                HumanNavigateToOperator.NavigateToWaypointLoc(nPCHumanContext);
                return;
            }

            case HumanNavigateToOperator.OperatorType.LastEnemyLoc:
            {
                HumanNavigateToOperator.NavigateToLastEnemy(nPCHumanContext);
                return;
            }

            case HumanNavigateToOperator.OperatorType.HideoutLoc:
            {
                HumanNavigateToOperator.NavigateToHideout(nPCHumanContext);
                return;
            }

            default:
            {
                return;
            }
            }
        }
示例#18
0
 public static void NavigateToFood(BaseContext c)
 {
     if (!Object.op_Inequality((Object)c.AIAgent.FoodTarget, (Object)null) || c.AIAgent.FoodTarget.IsDestroyed || (!Object.op_Inequality((Object)((Component)c.AIAgent.FoodTarget).get_transform(), (Object)null) || c.GetFact(BaseNpc.Facts.FoodRange) >= (byte)2) || !c.AIAgent.IsNavRunning())
     {
         return;
     }
     NavigateToOperator.MakeUnstuck(c);
     c.AIAgent.Destination = c.AIAgent.FoodTarget.ServerPosition;
     c.AIAgent.SetTargetPathStatus(0.05f);
 }
 public override float GetScore(BaseContext c)
 {
     return((NPCPlayerApex.ToolTypeEnum)c.GetFact(NPCPlayerApex.Facts.CurrentToolType) != this.value ? 0.0f : 1f);
 }
示例#20
0
        public override float GetScore(BaseContext c)
        {
            byte num = this.value ? (byte)1 : (byte)0;

            return((int)c.GetFact(this.fact) != (int)num ? 0.0f : 1f);
        }
 public override float GetScore(BaseContext c)
 {
     return((int)c.GetFact(this.fact) != (int)this.value ? 0.0f : 1f);
 }
 public override float GetScore(BaseContext c)
 {
     return((BaseNpc.FoodRangeEnum)c.GetFact(BaseNpc.Facts.FoodRange) != this.value ? 0.0f : 1f);
 }
示例#23
0
        public override float GetScore(BaseContext c)
        {
            if (this.requireRanged && c.GetFact(NPCPlayerApex.Facts.CurrentWeaponType) == 1)
            {
                if (this.Equality <= HasHumanFactAmmo.EqualityEnum.Equal)
                {
                    return(0f);
                }
                return(1f);
            }
            byte fact = c.GetFact(NPCPlayerApex.Facts.CurrentAmmoState);

            switch (this.Equality)
            {
            case HasHumanFactAmmo.EqualityEnum.Greater:
            {
                if (fact >= (byte)this.@value)
                {
                    return(0f);
                }
                return(1f);
            }

            case HasHumanFactAmmo.EqualityEnum.Gequal:
            {
                if (fact > (byte)this.@value)
                {
                    return(0f);
                }
                return(1f);
            }

            case HasHumanFactAmmo.EqualityEnum.Lequal:
            {
                if (fact < (byte)this.@value)
                {
                    return(0f);
                }
                return(1f);
            }

            case HasHumanFactAmmo.EqualityEnum.Lesser:
            {
                if (fact <= (byte)this.@value)
                {
                    return(0f);
                }
                return(1f);
            }

            default:
            {
                if (fact == (byte)this.@value)
                {
                    break;
                }
                else
                {
                    return(0f);
                }
            }
            }
            return(1f);
        }