Пример #1
0
        public static void TickStatic(IHTNAgent npc, int maxVisible = 3)
        {
            npc.AiDomain.NpcContext.EnemyPlayersInLineOfSight.Clear();
            int num = 0;
            List <NpcPlayerInfo> enemyPlayersInRange = npc.AiDomain.NpcContext.EnemyPlayersInRange;

            for (int index = 0; index < enemyPlayersInRange.Count; ++index)
            {
                NpcPlayerInfo info = enemyPlayersInRange[index];
                if (Object.op_Equality((Object)info.Player, (Object)null) || Object.op_Equality((Object)((Component)info.Player).get_transform(), (Object)null) || (info.Player.IsDestroyed || info.Player.IsDead()) || info.Player.IsWounded())
                {
                    enemyPlayersInRange.RemoveAt(index);
                    --index;
                }
                else if (EnemyPlayersLineOfSightSensor.TickLineOfSightTest(npc, ref info))
                {
                    ++num;
                    if (num >= maxVisible)
                    {
                        break;
                    }
                }
            }
        }
        public static void TickStatic(IHTNAgent npc, int maxVisible = 3)
        {
            npc.AiDomain.NpcContext.EnemyPlayersInLineOfSight.Clear();
            int num = 0;
            List <NpcPlayerInfo> enemyPlayersInRange = npc.AiDomain.NpcContext.EnemyPlayersInRange;

            for (int i = 0; i < enemyPlayersInRange.Count; i++)
            {
                NpcPlayerInfo item = enemyPlayersInRange[i];
                if (item.Player == null || item.Player.transform == null || item.Player.IsDestroyed || item.Player.IsDead() || item.Player.IsWounded())
                {
                    enemyPlayersInRange.RemoveAt(i);
                    i--;
                }
                else if (EnemyPlayersLineOfSightSensor.TickLineOfSightTest(npc, ref item))
                {
                    num++;
                    if (num >= maxVisible)
                    {
                        return;
                    }
                }
            }
        }
Пример #3
0
 public void Tick(IHTNAgent npc, float deltaTime, float time)
 {
     EnemyPlayersLineOfSightSensor.TickStatic(npc, this.MaxVisible > 0 ? this.MaxVisible : 3);
 }