Esempio n. 1
0
    public void SetSelectedShipAction(int actionID)
    {
        if (selectedObject != null && canUpdateCmds)
        {
            ShipController shipController = selectedObject.GetComponent <ShipController>();

            if (shipController != null && shipController.shipOwner == playerID)
            {
                ShipCommand shipCommand = GetShipCommand(shipController);

                List <ShipAction> shipActions = new List <ShipAction>(GlobalShipActions.ShipActions());

                if (shipActions.Count > actionID && 0 <= actionID)
                {
                    List <ShipActionAvailablityEnum> actionAvailability = GameRunner.GetShipActionAvailability(shipController, shipCommand);

                    if (actionAvailability[actionID] == ShipActionAvailablityEnum.ENABLED)
                    {
                        shipCommand.shipAction = shipActions[actionID];
                        shipController.UpdateActionVisual();
                    }
                }
            }
        }

        UpdateCommandUI();
        UpdateInfoUI();
    }
Esempio n. 2
0
    public void UpdateCommandUI()
    {
        if (selectedObject != null)
        {
            ShipController shipController = selectedObject.GetComponent <ShipController>();

            if (shipController != null && shipController.shipOwner == playerID)
            {
                ShipCommand shipCommand = GetShipCommand(shipController);

                uiController.UpdateCommandUI(shipCommand.shipMove.name, GameRunner.GetShipActionAvailability(shipController, shipCommand));
            }
        }
    }