本文整理汇总了C#中Data.Structures.Creature.Creature.GetType方法的典型用法代码示例。如果您正苦于以下问题:C# Creature.GetType方法的具体用法?C# Creature.GetType怎么用?C# Creature.GetType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Data.Structures.Creature.Creature
的用法示例。
在下文中一共展示了Creature.GetType方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: InitStats
public CreatureBaseStats InitStats(Creature creature)
{
Player player = creature as Player;
if (player != null)
return GetBaseStats(player).Clone();
Npc npc = creature as Npc;
if (npc != null)
return NpcStats[npc.NpcTemplate.HuntingZoneId][npc.NpcTemplate.Id].Clone();
Log.Error("StatsService: Unknown type: {0}.", creature.GetType().Name);
return new CreatureBaseStats();
}
示例2: SendRemoveCreature
public void SendRemoveCreature(IConnection connection, Creature creature)
{
var player = creature as Player;
if (player != null)
{
new SpRemoveCharacter(player).Send(connection);
return;
}
var npc = creature as Npc;
if (npc != null)
{
new SpRemoveNpc(npc, npc.LifeStats.IsDead() ? 5 : 1).Send(connection);
return;
}
var gather = creature as Gather;
if (gather != null)
{
new SpRemoveGather(gather).Send(connection);
return;
}
var item = creature as Item;
if (item != null)
{
new SpRemoveItem(item).Send(connection);
return;
}
var projectile = creature as Projectile;
if (projectile != null)
{
new SpRemoveProjectile(projectile).Send(connection);
return;
}
var campfire = creature as Campfire;
if (campfire != null)
{
new SpRemoveCampfire(campfire).Send(connection);
return;
}
Log.Error("SendRemoveCreature: Unknown creature type: {0}", creature.GetType().Name);
}
示例3: SendCreatureInfo
public void SendCreatureInfo(IConnection connection, Creature creature)
{
var player = creature as Player;
if (player != null)
{
try
{
new SpCharacterInfo(player, RelationService.GetRelation(connection.Player, player)).Send(connection);
if (player.PlayerMount != 0 && Data.Data.Mounts.ContainsKey(player.PlayerMount))
new SpMountShow(player, Data.Data.Mounts[player.PlayerMount].MountId, player.PlayerMount).Send(connection);
}
catch (Exception e)
{
Log.Error("Exception " + e);
}
return;
}
var npc = creature as Npc;
if (npc != null)
{
new SpNpcInfo(npc).Send(connection);
if (npc.Ai != null && ((NpcAi)npc.Ai).MoveController.IsActive)
((NpcAi)npc.Ai).MoveController.Resend(connection);
return;
}
var gather = creature as Gather;
if (gather != null)
{
new SpGatherInfo(gather).Send(connection);
return;
}
var item = creature as Item;
if (item != null)
{
new SpDropInfo(item).Send(connection);
return;
}
var projectile = creature as Projectile;
if (projectile != null)
{
new SpProjectile(projectile).Send(connection);
return;
}
var campfire = creature as Campfire;
if (campfire != null)
{
new SpCampfire(campfire).Send(connection);
return;
}
Log.Error("SendCreatureInfo: Unknown creature type: {0}", creature.GetType().Name);
}
示例4: UpdateStats
public void UpdateStats(Creature creature)
{
Player player = creature as Player;
if (player != null)
{
UpdatePlayerStats(player);
return;
}
Npc npc = creature as Npc;
if (npc != null)
{
UpdateNpcStats(npc);
return;
}
Log.Error("StatsService: Unknown type: {0}.", creature.GetType().Name);
}