示例#1
0
    void OnMouseDown()
    {
        if (EventSystem.current.IsPointerOverGameObject())
        {
            // we're over a UI element, return
            return;
        }

        if (IS_CLIENT)
        {
            // Ensure unit active, and belongs to client
            // This is a double check here, i need to clean this up
            // trying to squash a double turn bug.
            if (currentUnit == gameBoard.turnManager.ACTIVE_UNIT &&
                currentUnit.playerTeam == gameBoard.PLAYER_TEAM)
            {
                if (INDICATOR_MODE == "MOVE")
                {
                    highlightPlane.SetActive(false);
                    currentUnit.QueueAction("MOV|" + PATH_STRING + "|");
                    gameBoard.turnManager.TURN_INSTRUCTION += "MOV|" + PATH_STRING + "|";
                }
                else if (INDICATOR_MODE == "ATTACK")
                {
                    highlightPlane.SetActive(false);
                    currentUnit.QueueAction("ATK|" + roundedPosition.x + "|" + roundedPosition.z + "|");
                    gameBoard.turnManager.TURN_INSTRUCTION += "ATK|" + roundedPosition.x + "|" + roundedPosition.z + "|";
                    gameBoard.entityMenu.SetAttackMenu();
                }
                else if (INDICATOR_MODE == "ABILITY")
                {
                    Debug.Log("ABILITY TIME! " + SELECTED_ABILITY);

                    switch (SELECTED_ABILITY)
                    {
                    case ("Solar Flare"):

                        SolarFlare.CastAbility(gameBoard, currentUnit, this);

                        break;

                    case ("Acid Rain"):

                        AcidRain.CastAbility(gameBoard, currentUnit, this);

                        break;

                    case ("Ornithophobia"):

                        Ornithophobia.CastAbility(gameBoard, currentUnit, this);

                        break;
                    }
                }
            }
        }
    }
示例#2
0
    public void AbilityClicked(string abilityName)
    {
        switch (abilityName)
        {
        case "Solar Flare":
            SolarFlare.SetIndicators(gameBoard, SELECTED_GAME_OBJECT.GetComponent <UnitClass>());
            break;

        case "Acid Rain":
            AcidRain.SetIndicators(gameBoard, SELECTED_GAME_OBJECT.GetComponent <UnitClass>());
            break;

        case "Ornithophobia":
            Ornithophobia.SetIndicators(gameBoard, SELECTED_GAME_OBJECT.GetComponent <UnitClass>());
            break;

        default:
            Debug.Log("error: no such ability");
            break;
        }
    }