本文整理汇总了C#中wServer.realm.Entity类的典型用法代码示例。如果您正苦于以下问题:C# Entity类的具体用法?C# Entity怎么用?C# Entity使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Entity类属于wServer.realm命名空间,在下文中一共展示了Entity类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: TickCore
protected override void TickCore(Entity host, RealmTime time, ref object state)
{
int index;
if (state == null) index = -1;
else index = (int) state;
if (index < 0) //select
{
index = 0;
for (int i = 0; i < children.Length; i++)
{
children[i].Tick(host, time);
if (children[i].Status == CycleStatus.InProgress)
{
index = i;
break;
}
}
}
else //run a cycle
{
children[index].Tick(host, time);
if (children[index].Status == CycleStatus.Completed ||
children[index].Status == CycleStatus.NotStarted)
index = -1;
}
state = index;
}
开发者ID:Club559,项目名称:Travs-Domain-Server,代码行数:29,代码来源:Prioritize.cs
示例2: TickCore
protected override void TickCore(Entity host, RealmTime time, ref object state)
{
Pet pet;
if (!isValidPet(host, out pet)) return;
if (Pet == null) Pet = pet;
TickCore(pet, time, ref state);
}
开发者ID:OryxAwakening,项目名称:Fabiano_Swagger_of_Doom,代码行数:7,代码来源:PetBehavior.cs
示例3: 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:OryxAwakening,项目名称:Fabiano_Swagger_of_Doom,代码行数:7,代码来源:RemoveEntity.cs
示例4: TickCore
protected override void TickCore(Entity host, RealmTime time, ref object state)
{
ProtectState s;
if (state == null) s = ProtectState.DontKnowWhere;
else s = (ProtectState) state;
Status = CycleStatus.NotStarted;
if (host.HasConditionEffect(ConditionEffectIndex.Paralyzed)) return;
Entity entity = host.GetNearestEntity(acquireRange, protectee);
Vector2 vect;
switch (s)
{
case ProtectState.DontKnowWhere:
if (entity != null)
{
s = ProtectState.Protecting;
goto case ProtectState.Protecting;
}
break;
case ProtectState.Protecting:
if (entity == null)
{
s = ProtectState.DontKnowWhere;
break;
}
vect = new Vector2(entity.X - host.X, entity.Y - host.Y);
if (vect.Length > reprotectRange)
{
Status = CycleStatus.InProgress;
vect.Normalize();
float dist = host.GetSpeed(speed)*(time.thisTickTimes/1000f);
host.ValidateAndMove(host.X + vect.X*dist, host.Y + vect.Y*dist);
host.UpdateCount++;
}
else
{
Status = CycleStatus.Completed;
s = ProtectState.Protected;
}
break;
case ProtectState.Protected:
if (entity == null)
{
s = ProtectState.DontKnowWhere;
break;
}
Status = CycleStatus.Completed;
vect = new Vector2(entity.X - host.X, entity.Y - host.Y);
if (vect.Length > protectionRange)
{
s = ProtectState.Protecting;
goto case ProtectState.Protecting;
}
break;
}
state = s;
}
开发者ID:SirAnuse,项目名称:fabiano-swagger-of-doom,代码行数:60,代码来源:Protect.cs
示例5: TickCore
protected override void TickCore(Entity host, RealmTime time, ref object state)
{
condition.Tick(host, time);
if (condition.Result)
foreach (var i in behaviors)
i.Tick(host, time);
}
开发者ID:Club559,项目名称:Travs-Domain-Server,代码行数:7,代码来源:If.cs
示例6: TickCore
protected override void TickCore(Entity host, RealmTime time, ref object state)
{
var storage = (BuzzStorage) state;
Status = CycleStatus.NotStarted;
if (host.HasConditionEffect(ConditionEffects.Paralyzed)) return;
if (storage.RemainingTime > 0)
{
storage.RemainingTime -= time.thisTickTimes;
Status = CycleStatus.NotStarted;
}
else
{
Status = CycleStatus.InProgress;
if (storage.RemainingDistance <= 0)
{
do
{
storage.Direction = new Vector2(Random.Next(-1, 2), Random.Next(-1, 2));
} while (storage.Direction.X == 0 && storage.Direction.Y == 0);
storage.Direction.Normalize();
storage.RemainingDistance = this.dist;
Status = CycleStatus.Completed;
}
float dist = host.GetSpeed(speed)*(time.thisTickTimes/1000f);
host.ValidateAndMove(host.X + storage.Direction.X*dist, host.Y + storage.Direction.Y*dist);
host.UpdateCount++;
storage.RemainingDistance -= dist;
}
state = storage;
}
开发者ID:Club559,项目名称:Travs-Domain-Server,代码行数:35,代码来源:Buzz.cs
示例7: TickCore
protected override void TickCore(Entity host, RealmTime time, ref object state)
{
int cooldown;
if (state == null) cooldown = 1000;
else cooldown = (int)state;
Status = CycleStatus.NotStarted;
if (host.HasConditionEffect(ConditionEffectIndex.Paralyzed)) return;
Player player = (Player)host.GetNearestEntity(distance, null);
if (player != null)
{
Vector2 vect;
vect = new Vector2(player.X - host.X, player.Y - host.Y);
vect.Normalize();
float dist = host.GetSpeed(speed) * (time.thisTickTimes / 1000f);
host.ValidateAndMove(host.X + (-vect.X) * dist, host.Y + (-vect.Y) * dist);
host.UpdateCount++;
if (cooldown <= 0)
{
Status = CycleStatus.Completed;
cooldown = 1000;
}
else
{
Status = CycleStatus.InProgress;
cooldown -= time.thisTickTimes;
}
}
state = cooldown;
}
开发者ID:OryxAwakening,项目名称:Fabiano_Swagger_of_Doom,代码行数:34,代码来源:StayBack.cs
示例8: TickCore
protected override void TickCore(Entity host, RealmTime time, ref object state)
{
WanderStorage storage;
if (state == null) storage = new WanderStorage();
else storage = (WanderStorage) state;
Status = CycleStatus.NotStarted;
if (host.HasConditionEffect(ConditionEffects.Paralyzed)) return;
Status = CycleStatus.InProgress;
if (storage.RemainingDistance <= 0)
{
storage.Direction = new Vector2(Random.Next(-1, 2), Random.Next(-1, 2));
storage.Direction.Normalize();
storage.RemainingDistance = period.Next(Random)/1000f;
Status = CycleStatus.Completed;
}
float dist = host.GetSpeed(speed)*(time.thisTickTimes/1000f);
host.ValidateAndMove(host.X + storage.Direction.X*dist, host.Y + storage.Direction.Y*dist);
host.UpdateCount++;
storage.RemainingDistance -= dist;
state = storage;
}
开发者ID:Club559,项目名称:Travs-Domain-Server,代码行数:26,代码来源:Wander.cs
示例9: OnStateEntry
protected override void OnStateEntry(Entity host, RealmTime time, ref object state)
{
if (host.GetNearestEntity(100, 0x5e4b) != null) return;
Entity opener = Entity.Resolve(host.Manager, "Realm Portal Opener");
host.Owner.EnterWorld(opener);
opener.Move(host.X, host.Y);
}
开发者ID:OryxAwakening,项目名称:Fabiano_Swagger_of_Doom,代码行数:7,代码来源:RealmPortalDrop.cs
示例10: OnStateEntry
protected override void OnStateEntry(Entity host, RealmTime time, ref object state)
{
if ((host as Enemy).AltTextureIndex != index)
{
(host as Enemy).AltTextureIndex = index;
host.UpdateCount++;
}
}
开发者ID:Club559,项目名称:Travs-Domain-Server,代码行数:8,代码来源:SetAltTexture.cs
示例11: OnStateEntry
protected override void OnStateEntry(Entity host, RealmTime time, ref object state)
{
host.ApplyConditionEffect(new ConditionEffect
{
Effect = effect,
DurationMS = -1
});
}
开发者ID:OryxAwakening,项目名称:Fabiano_Swagger_of_Doom,代码行数:8,代码来源:ConditionalEffect.cs
示例12: TickCore
protected override void TickCore(Entity host, RealmTime time, ref object state)
{
Entity entity = Entity.Resolve(host.Manager, target);
entity.Move(host.X, host.Y);
host.Owner.EnterWorld(entity);
host.Owner.LeaveWorld(host);
}
开发者ID:OryxAwakening,项目名称:Fabiano_Swagger_of_Doom,代码行数:8,代码来源:Transform.cs
示例13: TickCore
protected override bool TickCore(Entity host, RealmTime time, ref object state)
{
if (host.GetNearestEntity(dist, target) == null && host.GetNearestEntity(dist, target2) == null)
{
return true;
}
return false;
}
开发者ID:SirAnuse,项目名称:fabiano-swagger-of-doom,代码行数:8,代码来源:EntityNotExistsTransition2.cs
示例14: 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);
}
开发者ID:SirAnuse,项目名称:fabiano-swagger-of-doom,代码行数:8,代码来源:Order.cs
示例15: isValidPet
private bool isValidPet(Entity host, out Pet p)
{
p = null;
if (!(host is Pet)) return false;
var pet = (Pet)host;
if (PlayerOwnerRequired && pet.PlayerOwner == null) return false;
p = pet;
return true;
}
开发者ID:OryxAwakening,项目名称:Fabiano_Swagger_of_Doom,代码行数:9,代码来源:PetBehavior.cs
示例16: 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:OryxAwakening,项目名称:Fabiano_Swagger_of_Doom,代码行数:10,代码来源:CopyLootState.cs
示例17: OnStateEntry
protected override void OnStateEntry(Entity host, RealmTime time, ref object state)
{
host.Owner.BroadcastPacket(new ShowEffectPacket
{
EffectType = EffectType.Flashing,
PosA = new Position {X = flashPeriod, Y = flashRepeats},
TargetId = host.Id,
Color = new ARGB(color)
}, null);
}
开发者ID:Club559,项目名称:Travs-Domain-Server,代码行数:10,代码来源:Flash.cs
示例18: GetSpeed
public static float GetSpeed(Entity entity, float stat)
{
var ret = 4 + 5.6f*(stat/75f);
if (entity.HasConditionEffect(ConditionEffects.Speedy))
ret *= 1.5f;
if (entity.HasConditionEffect(ConditionEffects.Slowed))
ret = 4;
if (entity.HasConditionEffect(ConditionEffects.Paralyzed))
ret = 0;
return ret;
}
开发者ID:RoxyLalonde,项目名称:Phoenix-Realms,代码行数:11,代码来源:StatsManager.cs
示例19: Move
public void Move(Entity entity, double x, double y)
{
int hash = HashPosition(entity.X, entity.Y);
ConcurrentDictionary<int, Entity> bucket = store.GetOrAdd(hash, _ => new ConcurrentDictionary<int, Entity>());
Entity dummy;
bucket.TryRemove(entity.Id, out dummy);
hash = HashPosition(x, y);
bucket = store.GetOrAdd(hash, _ => new ConcurrentDictionary<int, Entity>());
bucket[entity.Id] = entity;
}
开发者ID:Club559,项目名称:Travs-Domain-Server,代码行数:11,代码来源:SpatialStorage.cs
示例20: TickCore
protected override void TickCore(Entity host, RealmTime time, ref object state)
{
int cool = (int)state;
if (cool <= 0)
host.Owner.LeaveWorld(host);
else
cool -= time.thisTickTimes;
state = cool;
}
开发者ID:OryxAwakening,项目名称:Fabiano_Swagger_of_Doom,代码行数:11,代码来源:Decay.cs
注:本文中的wServer.realm.Entity类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论