public virtual void HandleChangeMode(Player player, FightMode fightMode, FightStance fightStance) { lock (lockThis) { player.CurrentFightMode = fightMode; player.CurrentFightStance = fightStance; } }
/// <summary> /// Process when a player changes fightMode or fightStance. /// </summary> /// <param name="player">The player changing the mode.</param> /// <param name="world">A reference to the gameworld.</param> private void ProcessChangeMode(Player player, GameWorld world) { byte rawFightMode = netmsg.GetByte(); //Agressive, normal, defensive byte rawFightStance = netmsg.GetByte(); //Follow, run away, stand still bool isFightModeValid = Enum.IsDefined(typeof(FightMode), rawFightMode); bool isFightStanceValid = Enum.IsDefined(typeof(FightStance), rawFightStance); //Make sure modes are valid if (!isFightModeValid || !isFightStanceValid) { return; } FightMode fightMode = (FightMode)rawFightMode; FightStance fightStance = (FightStance)rawFightStance; #if DEBUG Log.WriteDebug("In ProcessChangeMode()"); Log.WriteDebug("fightMode: " + fightMode); Log.WriteDebug("fightStance: " + fightStance); #endif world.HandleChangeMode(player, fightMode, fightStance); }