using Encompass;
using KavTest.Messages;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Input;

namespace KavTest.Engines
{
    [Sends(typeof(MoveCameraMessage))]
    public class InputEngine : Engine
    {
        public override void Update(double dt)
        {
            var keyboardState = Keyboard.GetState();

            if (keyboardState.IsKeyDown(Keys.W))
            {
                SendMessage(new MoveCameraMessage(new Vector3(0, 0, -5)));
            }

            if (keyboardState.IsKeyDown(Keys.A))
            {
                SendMessage(new MoveCameraMessage(new Vector3(-5, 0, 0)));
            }

            if (keyboardState.IsKeyDown(Keys.S))
            {
                SendMessage(new MoveCameraMessage(new Vector3(0, 0, 5)));
            }

            if (keyboardState.IsKeyDown(Keys.D))
            {
                SendMessage(new MoveCameraMessage(new Vector3(5, 0, 0)));
            }
        }
    }
}
