Esempio n. 1
0
        /// <summary>
        /// Loads the resources. Must be called before first use of any other class method.
        /// </summary>
        protected override void LoadContent()
        {
            _consoleManager.LoadContent(Content);
            _mode.LoadContent(Content);

            _spriteBatch = new SpriteBatch(GraphicsDevice);
        }
Esempio n. 2
0
        /// <summary>
        /// Changes game mode to the specified one.
        /// </summary>
        /// <param name="command">The Mode command.</param>
        private void ChangeGameMode(Command command)
        {
            var modeNameArgument = command.GetArgument <string>(0);

            var modeNameParseResult = Enum.TryParse(modeNameArgument, true, out GameModeType modeType);

            if (!modeNameParseResult)
            {
                _consoleManager.WriteLine($"$rInvalid mode type ($R{modeNameArgument}$r)");
                return;
            }

            _commandsManager.RemoveCommandHandlers(CommandGroup.GameMode);
            _mode = _modeFactory.Create(modeType);
            _mode.LoadContent(Content);
        }