本文整理汇总了C#中wServer.realm.Entity.GetNearestEntities方法的典型用法代码示例。如果您正苦于以下问题:C# Entity.GetNearestEntities方法的具体用法?C# Entity.GetNearestEntities怎么用?C# Entity.GetNearestEntities使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wServer.realm.Entity
的用法示例。
在下文中一共展示了Entity.GetNearestEntities方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
示例2: TickCore
protected override void TickCore(Entity host, RealmTime time, ref object state)
{
if (targetState == null)
targetState = FindState(host.Manager.Behaviors.Definitions[(ushort) children].Item1, targetStateName);
foreach (Entity i in host.GetNearestEntities(range, children))
if (!i.CurrentState.Is(targetState))
i.SwitchTo(targetState);
}
示例3: 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;
}
}
示例4: 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
});
}
}
示例5: 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(0xEEEE73),
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(0xEEEE73)
}, null);
en.ApplyConditionEffect(new ConditionEffect
{
Effect = ConditionEffectIndex.Bleeding,
DurationMS = 10000
});
}
cool = 1000;
}
else
cool -= time.thisTickTimes;
state = cool;
}
示例6: 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;
}
示例7: 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;
}