Ejemplo n.º 1
0
        public void Tick(IHTNAgent npc, float deltaTime, float time)
        {
            ScientistAStarContext npcContext = npc.AiDomain.NpcContext as ScientistAStarContext;

            if (npcContext == null)
            {
                return;
            }
            NpcPlayerInfo enemyPlayerTarget = npcContext.GetPrimaryEnemyPlayerTarget();

            if (!Object.op_Inequality((Object)enemyPlayerTarget.Player, (Object)null))
            {
                return;
            }
            AttackEntity firearm = npcContext.Domain.GetFirearm();

            if (PreferredFightingRangeReasoner.IsAtPreferredRange(npcContext, ref enemyPlayerTarget, firearm))
            {
                npcContext.SetFact(Rust.Ai.HTN.ScientistAStar.Facts.AtLocationPreferredFightingRange, 1, true, true, true);
            }
            else
            {
                npcContext.SetFact(Rust.Ai.HTN.ScientistAStar.Facts.AtLocationPreferredFightingRange, 0, true, true, true);
            }
        }
        public void Tick(IHTNAgent npc, float deltaTime, float time)
        {
            ScientistAStarContext npcContext = npc.AiDomain.NpcContext as ScientistAStarContext;

            if (npcContext == null)
            {
                return;
            }
            NpcPlayerInfo primaryEnemyPlayerTarget = npcContext.GetPrimaryEnemyPlayerTarget();

            if (primaryEnemyPlayerTarget.Player != null)
            {
                if (PreferredFightingRangeReasoner.IsAtPreferredRange(npcContext, ref primaryEnemyPlayerTarget, npcContext.Domain.GetFirearm()))
                {
                    npcContext.SetFact(Facts.AtLocationPreferredFightingRange, 1, true, true, true);
                    return;
                }
                npcContext.SetFact(Facts.AtLocationPreferredFightingRange, 0, true, true, true);
            }
        }