当前位置: 首页>>代码示例>>C#>>正文


C# Entity.GetNearestEntities方法代码示例

本文整理汇总了C#中Entity.GetNearestEntities方法的典型用法代码示例。如果您正苦于以下问题:C# Entity.GetNearestEntities方法的具体用法?C# Entity.GetNearestEntities怎么用?C# Entity.GetNearestEntities使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Entity的用法示例。


在下文中一共展示了Entity.GetNearestEntities方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: OnStateEntry

 protected override void OnStateEntry(Entity host, RealmTime time, ref object state)
 {
     Entity[] ens = host.GetNearestEntities(dist).ToArray();
     foreach (Entity e in ens)
         if (e.ObjectType == host.Manager.GameData.IdToObjectType[children])
             host.Owner.LeaveWorld(e);
 }
开发者ID:SirAnuse,项目名称:fabiano-swagger-of-doom,代码行数:7,代码来源:RemoveEntity.cs

示例2: TickCore

        protected override void TickCore(Entity host, RealmTime time, ref object state)
        {
            //sinceCopy_ += time.thisTickCounts;
            //if (sinceCopy_ < 1.0)
            //{
            //    return;
            //}
            //sinceCopy_ = 0.0;

            if (targetId_ == ushort.MaxValue)
            {
                targetId_ = host.Manager.GameData.IdToObjectType[this.targetName_];
            }

            Entity[] target = (host.GetNearestEntities(range_, targetId_).ToArray());
            if (target.FirstOrDefault() == null)
            {
                targetId_ = ushort.MaxValue;
                return;
            }

            for (var i = 0; i < target.Count(); i++)
            {
                if ((host as Enemy).DamageCounter.Total == (target[i] as Enemy).DamageCounter.Total)
                {
                    return;
                }
                (target[i] as Enemy).SetDamageCounter((host as Enemy).DamageCounter, (target[i] as Enemy));
            }
            return;
        }
开发者ID:Club559,项目名称:Travs-Domain-Server,代码行数:31,代码来源:CopyDamageRecord.cs

示例3: TickCore

 protected override void TickCore(Entity host, RealmTime time, ref object state)
 {
     if (targetState == null)
         targetState = FindState(host.Manager.Behaviors.Definitions[(ushort)target].Item1, targetStateName);
     foreach (Entity i in host.GetNearestEntities(range, target))
         if (!i.CurrentState.Is(targetState))
             i.SwitchTo(targetState);
 }
开发者ID:OryxAwakening,项目名称:Fabiano_Swagger_of_Doom,代码行数:8,代码来源:TransformAndOrderOnDeath.cs

示例4: TickCore

 protected override void TickCore(Entity host, RealmTime time, ref object state)
 {
     if (targetState == null)
         this.targetState = FindState(BehaviorDb.Definitions[this.children].Item1, targetStateName);
     foreach (var i in host.GetNearestEntities(range, children))
         if (!i.CurrentState.Is(targetState))
             i.SwitchTo(targetState);
 }
开发者ID:patrick323,项目名称:rotmg_svr,代码行数:8,代码来源:Order.cs

示例5: OnStateEntry

 protected override void OnStateEntry(Entity host, RealmTime time, ref object state)
 {
     if (host is Enemy)
     {
         foreach (Entity i in host.GetNearestEntities(radius, children))
             if(i is Enemy)
                 if ((i as Enemy).LootState != (host as Enemy).LootState)
                     (i as Enemy).LootState = (host as Enemy).LootState;
     }
 }
开发者ID:SirAnuse,项目名称:fabiano-swagger-of-doom,代码行数:10,代码来源:CopyLootState.cs

示例6: OnStateEntry

 protected override void OnStateEntry(Entity host, RealmTime time, ref object state)
 {
     foreach (var i in host.GetNearestEntities(25, null).OfType<Player>())
     {
         i.Client.SendPacket(new PlaySoundPacket
         {
             OwnerId = host.Id,
             SoundId = soundId
         });
     }
 }
开发者ID:SirAnuse,项目名称:fabiano-swagger-of-doom,代码行数:11,代码来源:PlaySound.cs

示例7: TickCore

        protected override void TickCore(Entity host, RealmTime time, ref object state)
        {
            int cool = (int)state;
            if (cool <= 0)
            {
                var entities = host.GetNearestEntities(6);

                Enemy en = null;
                foreach (Entity e in entities)
                    if (e is Enemy)
                    {
                        en = e as Enemy;
                        break;
                    }

                if (en != null & en.ObjectDesc.Enemy)
                {
                    en.Owner.BroadcastPacket(new ShowEffectPacket
                    {
                        EffectType = EffectType.AreaBlast,
                        Color = new ARGB(0x48D747),
                        TargetId = en.Id,
                        PosA = new Position { X = 1, }
                    }, null);
                    en.Owner.BroadcastPacket(new ShowEffectPacket
                    {
                        EffectType = EffectType.Trail,
                        TargetId = host.Id,
                        PosA = new Position { X = en.X, Y = en.Y },
                        Color = new ARGB(0x48D747)
                    }, null);
                    en.ApplyConditionEffect(new ConditionEffect
                    {
                        Effect = ConditionEffectIndex.Slowed,
                        DurationMS = 10000
                    });

                }
                cool = 300;
            }
            else
                cool -= time.thisTickTimes;

            state = cool;
        }
开发者ID:SirAnuse,项目名称:fabiano-swagger-of-doom,代码行数:45,代码来源:GreenDrakeAttack.cs

示例8: TickCore

        protected override void TickCore(Entity host, RealmTime time, ref object state)
        {
            int cool = (int)state;
            if (cool <= 0)
            {
                var entities = host.GetNearestEntities(6);

                Enemy en = null;
                foreach (Entity e in entities)
                    if (e is Enemy)
                    {
                        en = e as Enemy;
                        break;
                    }

                if (en != null & en.ObjectDesc.Enemy)
                {
                    en.Owner.BroadcastPacket(new ShowEffectPacket
                    {
                        EffectType = EffectType.AreaBlast,
                        Color = new ARGB(0x3E3A78),
                        TargetId = en.Id,
                        PosA = new Position { X = 1, }
                    }, null);
                    en.Owner.BroadcastPacket(new ShowEffectPacket
                    {
                        EffectType = EffectType.Trail,
                        TargetId = host.Id,
                        PosA = new Position { X = en.X, Y = en.Y },
                        Color = new ARGB(0x3E3A78)
                    }, null);
                    en.Damage(host.GetPlayerOwner(), time, 35, false, new ConditionEffect[] { });
                }
                cool = 300;
            }
            else
                cool -= time.thisTickTimes;

            state = cool;
        }
开发者ID:SirAnuse,项目名称:fabiano-swagger-of-doom,代码行数:40,代码来源:PurpleDrakeAttack.cs

示例9: TickCore

 protected override void TickCore(Entity host, RealmTime time, ref object state)
 {
     Result = host.GetNearestEntities(dist, target).Count() > amount;
 }
开发者ID:Club559,项目名称:Travs-Domain-Server,代码行数:4,代码来源:EntityCount.cs

示例10: TickCore

        protected override void TickCore(Entity host, RealmTime time, ref object state)
        {
            if (state == null) return;
            int cool = (int) state;

            if (cool <= 0)
            {

                PetLevel level = null;
                if (host is Pet)
                {
                    Pet p = host as Pet;
                    level = p.GetPetLevelFromAbility(Ability.Electric, true);
                }
                else return;

                if (level == null) return;

                double dist = getDist(host as Pet, level);

                Enemy[] targets = host.GetNearestEntities(dist).OfType<Enemy>().ToArray();
                foreach (Enemy e in targets)
                {
                    if (e.HasConditionEffect(ConditionEffectIndex.Invulnerable) || e.HasConditionEffect(ConditionEffectIndex.Invincible) || e.HasConditionEffect(ConditionEffectIndex.Stasis)) continue;
                    if (Random.Next(0, 100) > level.Level) break;

                    if (e.ObjectDesc == null | !e.ObjectDesc.Enemy) continue;

                    if (e.HasConditionEffect(ConditionEffectIndex.Invincible)) continue;

                    e.ApplyConditionEffect(new ConditionEffect
                    {
                        DurationMS = level.Level * 40,
                        Effect = ConditionEffectIndex.Paralyzed
                    });

                    e.Owner.BroadcastPacket(new ShowEffectPacket
                    {
                        EffectType = EffectType.ElectricFlashing,
                        PosA = new Position { X = level.Level * 40},
                        TargetId = e.Id
                    }, null);

                    host.Owner.BroadcastPacket(new ShowEffectPacket
                    {
                        PosA = new Position { X = host.X, Y = host.Y },
                        EffectType = EffectType.ElectricBolts,
                        TargetId = host.Id,
                    }, null);

                    e.Damage(null, time, level.Level, true, new ConditionEffect
                    {
                        DurationMS = level.Level * 40,
                        Effect = ConditionEffectIndex.Paralyzed
                    });
                }

                cool = getCooldown(host as Pet, level) / host.Manager.TPS;
            }
            else
                cool -= time.thisTickTimes;

            state = cool;
        }
开发者ID:SirAnuse,项目名称:fabiano-swagger-of-doom,代码行数:64,代码来源:PetElectric.cs

示例11: TickCore

        protected override void TickCore(Entity host, RealmTime time, ref object state)
        {
            int cool = (int)state;

            if (cool <= 0)
            {
                var entities = host.GetNearestEntities(28, 0x0d5e)
                    .Concat(host.GetNearestEntities(28, 0x0d60))
                    .ToArray();
                if (entities.Length != 5)
                    return;

                var packets = new List<Packet>();
                if (!entities.Any(_ => _.ObjectType == 0x0d5e))
                {
                    var players = new HashSet<Entity>();
                    foreach (var i in entities.SelectMany(_ => (_ as Enemy).DamageCounter.GetPlayerData()))
                        if (i.Item1.Quest == host)
                            players.Add(i.Item1);
                    foreach (var i in players)
                        packets.Add(new NotificationPacket
                        {
                            ObjectId = i.Id,
                            Color = new ARGB(0xFF00FF00),
                            Text = "{\"key\":\"blank\",\"tokens\":{\"data\":\"Quest Complete!\"}}"
                        });

                    if (host.Owner is GameWorld)
                        (host.Owner as GameWorld).EnemyKilled(host as Enemy,
                            (entities.Last() as Enemy).DamageCounter.Parent.LastHitter);
                    new Decay(0).Tick(host, time);
                    foreach (var i in entities)
                        new Suicide().Tick(i, time);
                }
                else
                {
                    var hasCorpse = entities.Any(_ => _.ObjectType == 0x0d60);
                    for (var i = 0; i < entities.Length; i++)
                        for (var j = i + 1; j < entities.Length; j++)
                        {
                            packets.Add(new ShowEffectPacket
                            {
                                TargetId = entities[i].Id,
                                EffectType = EffectType.Stream,
                                Color = new ARGB(hasCorpse ? 0xFFFFFF : 0xffff0000),
                                PosA = new Position
                                {
                                    X = entities[j].X,
                                    Y = entities[j].Y
                                },
                                PosB = new Position
                                {
                                    X = entities[i].X,
                                    Y = entities[i].Y
                                }
                            });
                        }
                }
                host.Owner.BroadcastPackets(packets, null);
                cool = this.cool.Next(Random);
            }
            else
                cool -= time.thisTickTimes;

            state = cool;
        }
开发者ID:SirAnuse,项目名称:fabiano-swagger-of-doom,代码行数:66,代码来源:PentaractStar.cs

示例12: TickCore

        protected override void TickCore(Entity host, RealmTime time, ref object state)
        {
            var cool = (int)state;

            if (cool <= 0)
            {
                if (host.HasConditionEffect(ConditionEffects.Sick)) return;

                if(host.GetNearestEntity(radius, null) != null)
                {
                    var pkts = new List<Packet>();
                    foreach (var player in host.GetNearestEntities(radius, null).Select(p => (p as Player)).Where(player => player.Stats[0] + player.Boost[0] != player.HP))
                    {
                        player.EntityHealHp(player, host, amount, pkts);
                        pkts.Add(new ShowEffectPacket
                        {
                            EffectType = EffectType.Trail,
                            TargetId = host.Id,
                            PosA = new Position {X = player.X, Y = player.Y},
                            Color = new ARGB(0xffffffff)
                        });
                    }
                    host.Owner.BroadcastPackets(pkts, null);
                }
                cool = coolDown.Next(Random);
            }
            else
                cool -= time.thisTickTimes;

            state = cool;
        }
开发者ID:Club559,项目名称:Travs-Domain-Server,代码行数:31,代码来源:NexusHealHp.cs


注:本文中的Entity.GetNearestEntities方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。