public void Action(GameTime time, KeyboardBuffer keyboard, MouseBuffer mouse) { if (keyboard.IsKeyDown (Key.W)) Position.Y -= 1; if (keyboard.IsKeyDown (Key.S)) Position.Y += 1; if (keyboard.IsKeyDown (Key.A)) Position.X -= 1; if (keyboard.IsKeyDown (Key.D)) Position.X += 1; }
/// <summary> /// Initializes a new instance of the <see cref="nginz.FPSCamera"/> class. /// </summary> /// <param name="fieldOfView">Field of view.</param> /// <param name="resolution">Resolution.</param> /// <param name="mouse">Mouse.</param> /// <param name="keyboard">Keyboard.</param> public FPSCamera(float fieldOfView, Resolution resolution, MouseBuffer mouse, KeyboardBuffer keyboard) { // Create the base camera Camera = new Camera(fieldOfView, resolution, 0.01f, 256f); // Set the mouse and the keyboard Mouse = mouse; Keyboard = keyboard; // Initialize the mouse sensitivity MouseXSensitivity = .1f; MouseYSensitivity = .1f; // Initialize the actor speed Speed = 5f; }
/// <summary> /// Initializes a new instance of the <see cref="nginz.FPSCamera"/> class. /// </summary> /// <param name="fieldOfView">Field of view.</param> /// <param name="resolution">Resolution.</param> /// <param name="mouse">Mouse.</param> /// <param name="keyboard">Keyboard.</param> public FPSCamera(float fieldOfView, Resolution resolution, MouseBuffer mouse, KeyboardBuffer keyboard) { // Create the base camera Camera = new Camera (fieldOfView, resolution, 0.01f, 256f); // Set the mouse and the keyboard Mouse = mouse; Keyboard = keyboard; // Initialize the mouse sensitivity MouseXSensitivity = .1f; MouseYSensitivity = .1f; // Initialize the actor speed Speed = 5f; }
/// <summary> /// Initializes a new instance of the <see cref="nginz.Game"/> class. /// </summary> /// <param name="conf">Conf.</param> public Game(GameConfiguration conf) { // Set the configuration Configuration = conf; // Initialize the keyboard buffer Keyboard = new KeyboardBuffer(); // Initialize the actions ContextActions = new ConcurrentQueue <Action> (); UIActions = new ConcurrentQueue <Action> (); // Initialize scripting enviroment IsRunningInScriptedEnvironment = false; // Set UI controller UI = UIController.Instance; }
/// <summary> /// Initializes a new instance of the <see cref="nginz.Game"/> class. /// </summary> /// <param name="conf">Conf.</param> public Game(GameConfiguration conf) { // Set the configuration Configuration = conf; // Initialize the keyboard buffer Keyboard = new KeyboardBuffer (); // Initialize the actions ContextActions = new ConcurrentQueue<Action> (); UIActions = new ConcurrentQueue<Action> (); // Initialize scripting enviroment IsRunningInScriptedEnvironment = false; // Set UI controller UI = UIController.Instance; }