当前位置: 首页>>代码示例>>C#>>正文


C# Creature.GetType方法代码示例

本文整理汇总了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();
        }
开发者ID:CadeLaRen,项目名称:TeraEmulator,代码行数:13,代码来源:StatsService.cs

示例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);
        }
开发者ID:Bozolika,项目名称:Eternal-Moon,代码行数:46,代码来源:FeedbackService.cs

示例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);
        }
开发者ID:Bozolika,项目名称:Eternal-Moon,代码行数:61,代码来源:FeedbackService.cs

示例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);
        }
开发者ID:prestanneth,项目名称:TeraEmulator_1725,代码行数:18,代码来源:StatsService.cs


注:本文中的Data.Structures.Creature.Creature.GetType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。