Пример #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());
     }
 }
Пример #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);
            }
        }
Пример #3
0
 public static void SetState(GameState state)
 {
     gameState = state;
     WorldGraphics.DrawState(state);
 }
Пример #4
0
 public static void Initialize(int width, int height, UnitType[] unitTypes)
 {
     WorldGraphics.InitTiles(width, height);
     ClientController.unitTypes = unitTypes;
 }
Пример #5
0
 private void Awake()
 {
     instance = this;
 }
Пример #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));
        }
Пример #7
0
 public UnitSelectedState(UnitData unit)
 {
     this.unit = unit;
     gfx       = WorldGraphics.GetTileGraphics(unit.tile).Unit;
 }