Example #1
0
 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());
     }
 }
Example #2
0
        public static void Update()
        {
            inputState.Update();
            HandleMouse(0);
            HandleMouse(1);

            Coords newHoverTile = GetCoordsUnderMouse();

            if (WorldGraphics.ValidCoords(newHoverTile) && newHoverTile != hoverTile)
            {
                hoverTile = newHoverTile;
                inputState.HoverEnter(hoverTile);
            }
        }
Example #3
0
 public static void SetState(GameState state)
 {
     gameState = state;
     WorldGraphics.DrawState(state);
 }
Example #4
0
 public static void Initialize(int width, int height, UnitType[] unitTypes)
 {
     WorldGraphics.InitTiles(width, height);
     ClientController.unitTypes = unitTypes;
 }
Example #5
0
 private void Awake()
 {
     instance = this;
 }
Example #6
0
        /// <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));
        }
Example #7
0
 public UnitSelectedState(UnitData unit)
 {
     this.unit = unit;
     gfx       = WorldGraphics.GetTileGraphics(unit.tile).Unit;
 }