Exemple #1
0
 public GameEngine()
     : base()
 {
     this.graphics = new GraphicsDeviceManager(this);
     this.Content.RootDirectory = "Content";
     this.IsMouseVisible        = true;
     this.graphics.PreferredBackBufferHeight = 15 * SpriteSize;
     this.graphics.PreferredBackBufferWidth  = 25 * SpriteSize;
     this.beingToPlay  = null;
     this.poolOfAction = new ActionsPool();
     BlackBoard.Pool   = this.poolOfAction;
     BlackBoard.Game   = this;
 }
Exemple #2
0
        public void HandleInput(LivingBeing lb, ActionsPool poolOfAction)
        {
            this.previousKeyboardState = this.currentKeyboardState;
            this.currentKeyboardState  = Keyboard.GetState();
            var pressedKeys = this.currentKeyboardState.GetPressedKeys();

            if (pressedKeys.Except(this.previousKeyboardState.GetPressedKeys()).Any())
            {
                if (poolOfAction.ContainsAnActionFor(lb, pressedKeys))
                {
                    var action = poolOfAction.GetAction(lb, pressedKeys).Activity;
                    action(lb);
                }
            }
        }