public void UpdateWithIOEvent(IOEvent ioEvent) { if (ioEvent.Equals(space)) { Fire(); } }
public void UpdateWithIOEvent(IOEvent ioEvent) { if (pointedAtTarget && ioEvent.Equals(space)) { Fire(); } }
public void Register(IOEvent e, IOObserver observer) { if (!observerDictionary.ContainsKey(e)) { List<IOObserver> observerList = new List<IOObserver>(); observerDictionary.Add(e, observerList); } observerDictionary[e].Add(observer); }
public void Unregister(IOEvent e, IOObserver observer) { if (observerDictionary.ContainsKey(e)) { if (observerDictionary[e].Contains(observer)) { observerDictionary[e].Remove(observer); } } }
public GunnerController(Color color, Keys upKey, Keys downKey, Keys leftKey, Keys rightKey, Keys fireKey) { this.color = color; forward = new KeyDown(upKey); back = new KeyDown(downKey); left = new KeyDown(leftKey); right = new KeyDown(rightKey); fire = new KeyDown(fireKey); inputManager.Register(forward, this); inputManager.Register(back, this); inputManager.Register(left, this); inputManager.Register(right, this); inputManager.Register(fire, this); }
public Camera(Vector2 position, float zoom, float rotation, GraphicsDeviceManager graphics, InputManager ioManager) { this.graphics = graphics; this.position = position; this.zoom = zoom; this.rotation = rotation; up = new KeyDown(Keys.W); down = new KeyDown(Keys.S); left = new KeyDown(Keys.A); right = new KeyDown(Keys.D); ioManager.Register(up, this); ioManager.Register(down, this); ioManager.Register(left, this); ioManager.Register(right, this); }
public LocalPlayerController(ClientGame game) : base() { this.game = game; forward = new KeyDown(Keys.W); back = new KeyDown(Keys.S); left = new KeyDown(Keys.A); right = new KeyDown(Keys.D); fire = new LeftMouseDown(); space = new KeyDown(Keys.Space); this.game.InputManager.Register(forward, this); this.game.InputManager.Register(back, this); this.game.InputManager.Register(left, this); this.game.InputManager.Register(right, this); this.game.InputManager.Register(fire, this); this.game.InputManager.Register(space, this); }
public void UpdateWithIOEvent(IOEvent ioEvent) { if (ioEvent.Equals(forward)) { Acceleration = MaxAcceleration; } else if (ioEvent.Equals(back)) { Acceleration = -MaxAcceleration; } else if (ioEvent.Equals(left)) { turnRight = false; turnLeft = true; } else if (ioEvent.Equals(right)) { turnRight = true; turnLeft = false; } }
public void UpdateWithIOEvent(IOEvent ioEvent) { if (ioEvent.Equals(forward)) { this.SpeedUp = true; } else if (ioEvent.Equals(back)) { this.SlowDown = true; } else if (ioEvent.Equals(left)) { turnRight = false; turnLeft = true; } else if (ioEvent.Equals(right)) { turnRight = true; turnLeft = false; } }
public override void UpdateWithIOEvent(IOEvent ioEvent) { if(ioEvent.Equals(rightMousePress)) { Vector2 sceenPosition = IOState.MouseScreenPosition(); Vector2 worldPosition = this.Game.Camera.ScreenToWorldPosition(sceenPosition); positions.Add(worldPosition); } else if (ioEvent.Equals(ctrRelease)) { if (positions.Count != 0) { new SetCompanyPositions(this.LocalPlayer, coSelected.SelectedCompany, positions); } this.LocalPlayer.PopUIContext(); this.UpdateNextInStackIO(ioEvent); } else { this.UpdateNextInStackIO(ioEvent); } }
public void UpdateWithIOEvent(IOEvent ioEvent) { if (ioEvent.Equals(forward)) { movementControl = movementControl + 1; } else if (ioEvent.Equals(back)) { movementControl = movementControl - 1; } else if (ioEvent.Equals(left)) { angleControl = angleControl - 1; } else if (ioEvent.Equals(right)) { angleControl = angleControl + 1; } else if (ioEvent.Equals(fire) || ioEvent.Equals(space)) { isFire = true; } }
public abstract void UpdateWithIOEvent(IOEvent ioEvent);
protected void UpdateNextInStackIO(IOEvent ioEvent) { if (this.nextInStack != null) { this.nextInStack.UpdateWithIOEvent(ioEvent); } }
public void UpdateWithIOEvent(IOEvent ioEvent) { if (ioEvent.Equals(up)) { this.position = this.position + new Vector2(0, -10) / zoom; } else if (ioEvent.Equals(down)) { this.position = this.position + new Vector2(0, 10) / zoom; } else if (ioEvent.Equals(left)) { this.position = this.position + new Vector2(-10, 0) / zoom; } else if (ioEvent.Equals(right)) { this.position = this.position + new Vector2(10, 0) / zoom; } }
public void UpdateWithIOEvent(IOEvent ioEvent) { if (ioEvent.Equals(forward)) { aimPointMove = aimPointMove + new Vector2(0, -1); } else if (ioEvent.Equals(back)) { aimPointMove = aimPointMove + new Vector2(0, 1); } else if (ioEvent.Equals(left)) { aimPointMove = aimPointMove + new Vector2(-1, 0); } else if (ioEvent.Equals(right)) { aimPointMove = aimPointMove + new Vector2(1, 0); } else if (ioEvent.Equals(fire)) { NotifyObservers(new GunnerFire()); } }