Example #1
0
        /// <summary>
        /// Creates a new player instance.
        /// </summary>
        /// <param name="game">The game.</param>
        /// <returns></returns>
        public static IPlayer CreatePlayer(IGame game)
        {
            IPlayer player = null;
            if (factoryDelegate == null)
            {
                ICommandManager commandManager = CommandManagerFactory.CreateManager();
                player = new DefaultPlayer(game, commandManager);
            }
            else
            {
                player = factoryDelegate(game);
            }

            // This is a fail-safe. The DefaultPlayer assigns the owner for us, but we
            // force ownership of the command manager on the player regardless. In the event
            // a different IPlayer implementation is used that forgets to do this, the engine is still usable.
            player.CommandManager.SetOwner(player);
            return player;
        }
Example #2
0
        /// <summary>
        /// Creates a new player instance.
        /// </summary>
        /// <param name="game">The game.</param>
        /// <returns></returns>
        public static IPlayer CreatePlayer(IGame game)
        {
            IPlayer player = null;

            if (factoryDelegate == null)
            {
                ICommandManager commandManager = CommandManagerFactory.CreateManager();
                player = new DefaultPlayer(game, commandManager);
            }
            else
            {
                player = factoryDelegate(game);
            }

            // This is a fail-safe. The DefaultPlayer assigns the owner for us, but we
            // force ownership of the command manager on the player regardless. In the event
            // a different IPlayer implementation is used that forgets to do this, the engine is still usable.
            player.CommandManager.SetOwner(player);
            return(player);
        }
Example #3
0
 public ShoutMessage(string message, DefaultPlayer sender)
     : base(message, sender)
 {
 }