public override void DragEnd(int button) { if (button == 1) { Coords tile = InputController.GetCoordsUnderMouse(); if (WorldGraphics.ValidCoords(tile)) { CommunicationController.ExecuteCommand(ClientController.activePlayer, new CommandMove(tile)); } InputController.ChangeState(new DefaultState()); } }
public static void Update() { inputState.Update(); HandleMouse(0); HandleMouse(1); Coords newHoverTile = GetCoordsUnderMouse(); if (WorldGraphics.ValidCoords(newHoverTile) && newHoverTile != hoverTile) { hoverTile = newHoverTile; inputState.HoverEnter(hoverTile); } }
public static void SetState(GameState state) { gameState = state; WorldGraphics.DrawState(state); }
public static void Initialize(int width, int height, UnitType[] unitTypes) { WorldGraphics.InitTiles(width, height); ClientController.unitTypes = unitTypes; }
private void Awake() { instance = this; }
/// <summary> /// Returns the coords of the tile which is under the mouse pointer currently. /// </summary> /// <returns></returns> public static Coords GetCoordsUnderMouse() { Vector2 point = Camera.main.ScreenToWorldPoint(Input.mousePosition, Camera.MonoOrStereoscopicEye.Mono); return(WorldGraphics.GetTileAtPoint(point)); }
public UnitSelectedState(UnitData unit) { this.unit = unit; gfx = WorldGraphics.GetTileGraphics(unit.tile).Unit; }