本文整理匯總了C#中wServer.realm.Entity.GetNearestEntitiesByGroup方法的典型用法代碼示例。如果您正苦於以下問題:C# Entity.GetNearestEntitiesByGroup方法的具體用法?C# Entity.GetNearestEntitiesByGroup怎麽用?C# Entity.GetNearestEntitiesByGroup使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類wServer.realm.Entity
的用法示例。
在下文中一共展示了Entity.GetNearestEntitiesByGroup方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: TickCore
protected override void TickCore(Entity host, RealmTime time, ref object state)
{
var cool = (int) state;
if (cool <= 0)
{
if (host.HasConditionEffect(ConditionEffects.Stunned)) return;
foreach (Enemy entity in host.GetNearestEntitiesByGroup(range, group).OfType<Enemy>())
{
int newHp = entity.ObjectDesc.MaxHP;
if (newHp != entity.HP)
{
int n = newHp - entity.HP;
entity.HP = newHp;
entity.UpdateCount++;
entity.Owner.BroadcastPacket(new ShowEffectPacket
{
EffectType = EffectType.Potion,
TargetId = entity.Id,
Color = new ARGB(0xffffffff)
}, null);
entity.Owner.BroadcastPacket(new ShowEffectPacket
{
EffectType = EffectType.Trail,
TargetId = host.Id,
PosA = new Position {X = entity.X, Y = entity.Y},
Color = new ARGB(0xffffffff)
}, null);
entity.Owner.BroadcastPacket(new NotificationPacket
{
ObjectId = entity.Id,
Text = "+" + n,
Color = new ARGB(0xff00ff00)
}, null);
}
}
cool = coolDown.Next(Random);
}
else
cool -= time.thisTickTimes;
state = cool;
}
示例2: TickCore
protected override void TickCore(Entity host, RealmTime time, ref object state)
{
int cool = (int)state;
if (cool <= 0)
{
if (group == "Self")
{
Enemy entity = host as Enemy;
int newHp = amount;
if (newHp != entity.HP)
{
int n = newHp;
entity.HP = entity.HP + newHp;
entity.UpdateCount++;
entity.Owner.BroadcastPacket(new ShowEffectPacket
{
EffectType = EffectType.Potion,
TargetId = entity.Id,
Color = new ARGB(0xffffffff)
}, null);
entity.Owner.BroadcastPacket(new NotificationPacket
{
ObjectId = entity.Id,
Text = "{\"key\":\"blank\",\"tokens\":{\"data\":\"+" + n + "\"}}",
Color = new ARGB(0xff00ff00)
}, null);
}
}
else
{
foreach (Enemy entity in host.GetNearestEntitiesByGroup(range, group).OfType<Enemy>())
{
int newHp = amount;
if (newHp != entity.HP)
{
int n = newHp;
entity.HP = entity.HP + newHp;
entity.UpdateCount++;
entity.Owner.BroadcastPacket(new ShowEffectPacket
{
EffectType = EffectType.Potion,
TargetId = entity.Id,
Color = new ARGB(0xffffffff)
}, null);
entity.Owner.BroadcastPacket(new ShowEffectPacket
{
EffectType = EffectType.Trail,
TargetId = host.Id,
PosA = new Position { X = entity.X, Y = entity.Y },
Color = new ARGB(0xffffffff)
}, null);
entity.Owner.BroadcastPacket(new NotificationPacket
{
ObjectId = entity.Id,
Text = "{\"key\":\"blank\",\"tokens\":{\"data\":\"+" + n + "\"}}",
Color = new ARGB(0xff00ff00)
}, null);
}
}
}
cool = coolDown.Next(Random);
}
else
cool -= time.thisTickTimes;
state = cool;
}