Ejemplo n.º 1
0
        public override void DoExecute(BaseContext c)
        {
            if (BaseEntity.Query.Server == null)
            {
                return;
            }
            int inSphere = BaseEntity.Query.Server.GetInSphere(c.Position, c.AIAgent.GetStats.VisionRange, this.Results, new Func <BaseEntity, bool>(ScanForEntities.AiCaresAbout));

            if (inSphere == 0)
            {
                return;
            }
            for (int index = 0; index < inSphere; ++index)
            {
                BaseEntity result = this.Results[index];
                if (!Object.op_Equality((Object)result, (Object)null) && !Object.op_Equality((Object)result, (Object)c.Entity) && (result.isServer && ScanForEntities.WithinVisionCone(c.AIAgent, result)))
                {
                    BasePlayer basePlayer = result as BasePlayer;
                    if (Object.op_Inequality((Object)basePlayer, (Object)null) && !result.IsNpc)
                    {
                        if (!ConVar.AI.ignoreplayers)
                        {
                            Vector3 attackPosition = c.AIAgent.AttackPosition;
                            if ((basePlayer.IsVisible(attackPosition, basePlayer.CenterPoint(), float.PositiveInfinity) || basePlayer.IsVisible(attackPosition, basePlayer.eyes.position, float.PositiveInfinity) ? 1 : (basePlayer.IsVisible(attackPosition, ((Component)basePlayer).get_transform().get_position(), float.PositiveInfinity) ? 1 : 0)) == 0)
                            {
                                continue;
                            }
                        }
                        else
                        {
                            continue;
                        }
                    }
                    c.Memory.Update(result, 0.0f);
                }
            }
            c.Memory.Forget((float)this.forgetTime);
        }
        public override void DoExecute(BaseContext c)
        {
            if (BaseEntity.Query.Server == null)
            {
                return;
            }
            int inSphere = BaseEntity.Query.Server.GetInSphere(c.Position, c.AIAgent.GetStats.VisionRange, this.Results, new Func <BaseEntity, bool>(ScanForEntities.AiCaresAbout));

            if (inSphere == 0)
            {
                return;
            }
            for (int i = 0; i < inSphere; i++)
            {
                BaseEntity results = this.Results[i];
                if (!(results == null) && !(results == c.Entity) && results.isServer && ScanForEntities.WithinVisionCone(c.AIAgent, results))
                {
                    BasePlayer basePlayer = results as BasePlayer;
                    if (basePlayer != null && !results.IsNpc)
                    {
                        if (!ConVar.AI.ignoreplayers)
                        {
                            Vector3 attackPosition = c.AIAgent.AttackPosition;
                            if ((basePlayer.IsVisible(attackPosition, basePlayer.CenterPoint(), Single.PositiveInfinity) || basePlayer.IsVisible(attackPosition, basePlayer.eyes.position, Single.PositiveInfinity) ? false : !basePlayer.IsVisible(attackPosition, basePlayer.transform.position, Single.PositiveInfinity)))
                            {
                                goto Label0;
                            }
                        }
                        else
                        {
                            goto Label0;
                        }
                    }
                    c.Memory.Update(results, 0f);
                }
Label0:
            }
            c.Memory.Forget((float)this.forgetTime);
        }