Пример #1
0
	public MoveActionSerializeData(MoveActionData data)
	{
		FishType = data.FishType;
		TraceID = data.TraceID;
		Delay = data.Delay;
		Offset = new Point{x = data.Offset.x, y = data.Offset.y};
	}
 public ActionData Move(int number)
 {
     MoveActionData actionData = new MoveActionData();
     actionData.action = CardType.move;
     actionData.moveStart = gameEntity.transform.position;
     actionData.movePosition = 0;
     actionData.moveSpeed = 18.0f / number;
     switch (rotation)
     {
         //up
         case 0:
             if (positionY + number < controller.BoardHeight)
                 positionY += number;
             else
                 positionY = controller.BoardHeight - 1;
             break;
         //right
         case 1:
             if (positionX + number < controller.BoardWidth)
                 positionX += number;
             else
                 positionX = controller.BoardWidth - 1;
             break;
         //down
         case 2:
             if (-controller.BoardHeight <= positionY - number)
                 positionY -= number;
             else
                 positionY = -controller.BoardHeight;
             break;
         //left
         case 3:
             if (-controller.BoardWidth <= positionX - number)
                 positionX -= number;
             else
                 positionX = -controller.BoardWidth;
             break;
     }
     actionData.moveEnd = controller.GetLocationFromBoardTile(positionX, positionY);
     return actionData;
 }
Пример #3
0
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    // State-dependent behaviour

    public void SetState(BattleState newState)
    {
        if (this.state != BattleState.None)
        {
            Debug.Log("Ending state " + this.state);
        }

        if (this.state == BattleState.AiControl)
        {
            this.uiRefs.advanceAiButton.interactable = false;
        }
        else if (this.state == BattleState.MoveAction)
        {
            if (this.moveActionData.ghostMechTiles != null)
            {
                foreach (BattleTile tile in this.moveActionData.ghostMechTiles)
                {
                    tile.mapTile.RemoveLayer(MapTile.Layer.GhostSprite);
                }
            }
            this.moveActionData.ghostMechTiles = null;

            if (this.moveActionData.losLinesGO)
            {
                Destroy(this.moveActionData.losLinesGO);
            }

            if (this.moveActionData.moved == false)
            {
                this.pathNetwork.SetNodeEnabled(this.moveActionData.fromTile, false);
            }

            this.ResetActionPointsPreview();
        }

        this.state = newState;

        Debug.Log("Beginning state " + this.state);

        if (this.state == BattleState.EndOfAction)
        {
            if (this.currentTeam.isPlayer)
            {
                this.SetState(BattleState.SelectingAction);
            }
            else
            {
                this.SetState(BattleState.AiControl);
            }
        }
        else if (this.state == BattleState.AiControl)
        {
            this.hoveredTile  = null;
            this.selectedTile = null;

            this.mapDisplay.DisableSelectedTiles();
            this.mapDisplay.DisableHoveredTile();

            this.SetMenusUsable(false);
            this.uiRefs.advanceAiButton.interactable = true;
            // TODO: ugh, this is AWFUL
            this.AdjustTileInfoTabButtonGraphics();
            this.UpdateRightPanel();
        }
        else if (this.state == BattleState.SelectingAction)
        {
            this.HexTileHovered();

            this.SetMenusUsable(true);
        }
        else if (this.state == BattleState.MoveAction)
        {
            this.moveActionData                = new MoveActionData();
            this.moveActionData.fromTile       = this.selectedTile;
            this.moveActionData.pathingResult  = null;
            this.moveActionData.ghostMechTiles = new List <BattleTile>();
            this.moveActionData.moved          = false;

            this.pathNetwork.SetNodeEnabled(this.moveActionData.fromTile, true);

            this.SetMenusUsable(false);
        }
        else if (this.state == BattleState.SetTargetAction)
        {
            this.SetMenusUsable(false);
        }
    }