本文整理汇总了C#中wServer.realm.Entity.GetEntity方法的典型用法代码示例。如果您正苦于以下问题:C# Entity.GetEntity方法的具体用法?C# Entity.GetEntity怎么用?C# Entity.GetEntity使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wServer.realm.Entity
的用法示例。
在下文中一共展示了Entity.GetEntity方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TickCore
protected override void TickCore(Entity host, RealmTime time, ref object state)
{
if ((host as Pet)?.PlayerOwner == null) return;
var pet = (Pet)host;
FollowState s;
if (state == null) s = new FollowState();
else s = (FollowState)state;
Status = CycleStatus.NotStarted;
var player = host.GetEntity(pet.PlayerOwner.Id) as Player;
if (player == null)
{
var tile = host.Owner.Map[(int)host.X, (int)host.Y].Clone();
if (tile.Region != TileRegion.PetRegion)
{
if (!(host.Owner is PetYard))
{
host.Owner.LeaveWorld(host);
return;
}
if (tile.Region != TileRegion.Spawn)
{
host.Owner.LeaveWorld(host);
return;
}
}
}
switch (s.State)
{
case F.DontKnowWhere:
if (s.RemainingTime > 0)
s.RemainingTime -= time.thisTickTimes;
else
s.State = F.Acquired;
break;
case F.Acquired:
if (player == null)
{
s.State = F.DontKnowWhere;
s.RemainingTime = 0;
break;
}
if (s.RemainingTime > 0)
s.RemainingTime -= time.thisTickTimes;
var vect = new Vector2(player.X - host.X, player.Y - host.Y);
if (vect.Length > 20)
{
host.Move(player.X, player.Y);
host.UpdateCount++;
}
else if (vect.Length > 1)
{
var dist = host.GetSpeed(0.5f) * (time.thisTickTimes / 1000f);
if (vect.Length > 2)
dist = host.GetSpeed(0.5f + ((float)player.Stats[4] / 100)) * (time.thisTickTimes / 1000f);
else if (vect.Length > 3.5)
dist = host.GetSpeed(0.5f + (player.Stats[4] + (float)player.Boost[4] / 100)) * (time.thisTickTimes / 1000f);
else if (vect.Length > 5)
dist = host.GetSpeed(1.0f + (player.Stats[4] + (float)player.Boost[4] / 100)) * (time.thisTickTimes / 1000f);
else if (vect.Length > 6)
dist = host.GetSpeed(1.35f + (player.Stats[4] + (float)player.Boost[4] / 100)) * (time.thisTickTimes / 1000f);
else if (vect.Length > 7)
dist = host.GetSpeed(1.5f + (player.Stats[4] + (float)player.Boost[4] / 100)) * (time.thisTickTimes / 1000f);
else if (vect.Length > 10)
dist = host.GetSpeed(2f + (player.Stats[4] + (float)player.Boost[4] / 100)) * (time.thisTickTimes / 1000f);
Status = CycleStatus.InProgress;
vect.Normalize();
host.ValidateAndMove(host.X + vect.X * dist, host.Y + vect.Y * dist);
host.UpdateCount++;
}
break;
}
state = s;
}