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


C# IRoom.InformPlayersInRoom方法代码示例

本文整理汇总了C#中IRoom.InformPlayersInRoom方法的典型用法代码示例。如果您正苦于以下问题:C# IRoom.InformPlayersInRoom方法的具体用法?C# IRoom.InformPlayersInRoom怎么用?C# IRoom.InformPlayersInRoom使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IRoom的用法示例。


在下文中一共展示了IRoom.InformPlayersInRoom方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: SendRoundOutcomeMessage

        /// <summary>
        /// Informs all parties of the outcome of the combat round.
        /// </summary>
        /// <param name="player"></param>
        /// <param name="enemy"></param>
        /// <param name="room"></param>
        /// <param name="damage"></param>
        /// <param name="defense"></param>
        /// <param name="attack"></param>
        private static void SendRoundOutcomeMessage(IUser player, IUser enemy, IRoom room, double damage, double defense, double attack) {
			//TODO: Get the message based weapon type/special weapon (blunt, blade, axe, pole, etc.)
			//Get the weapon type and append it to the "Hit" or "Miss" type when getting the message 
			//ex: HitSword, HitClub, MissAxe, MissUnarmed could even get really specific HitRustyShortSword, MissLegendaryDaggerOfBlindness
			//Make a method to figure out the type by having a lookup table in the DB that points to a weapon type string
			IMessage message = new Message();
			message.InstigatorID = player.UserID.ToString();
			message.InstigatorType = player.Player.IsNPC == false ? ObjectType.Player : ObjectType.Npc;
			message.TargetID = enemy.UserID.ToString();
			message.TargetType = enemy.Player.IsNPC == false ? ObjectType.Player : ObjectType.Npc;

			if (damage < 0) {
                message.Self = ParseMessage(GetMessage("Combat", "Hit", MessageType.Self), player, enemy, damage, defense, attack);
                message.Target = ParseMessage(GetMessage("Combat", "Hit", MessageType.Target), player, enemy, damage, defense, attack);
                message.Room = ParseMessage(GetMessage("Combat", "Hit", MessageType.Room), player, enemy, damage, defense, attack);

				enemy.Player.ApplyEffectOnAttribute("Hitpoints", damage);

				INpc npc = enemy.Player as INpc;
				if (npc != null) {
					npc.IncreaseXPReward(player.UserID, (damage * -1.0));
				}
            }
            else {
				message.Self = ParseMessage(GetMessage("Combat", "Miss", MessageType.Self), player, enemy, damage, defense, attack);
                message.Target =  ParseMessage(GetMessage("Combat", "Miss", MessageType.Target), player, enemy, damage, defense, attack);
                message.Room = ParseMessage(GetMessage("Combat", "Miss", MessageType.Room), player, enemy, damage, defense, attack);
            }

			if (player.Player.IsNPC) {
				player.MessageHandler(message);
			}
			else {
				player.MessageHandler(message.Self);
			}

			if (enemy.Player.IsNPC) {
				enemy.MessageHandler(message);
			}
			else {
				enemy.MessageHandler(message.Target);
			}
			
			room.InformPlayersInRoom(message, new List<ObjectId>() { player.UserID, enemy.UserID });
		}
开发者ID:jandar78,项目名称:Novus,代码行数:54,代码来源:Combat.cs


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