Beispiel #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;
                    }
                }
            }
        }
    }
Beispiel #2
0
    void ShowAbilityAOE()
    {
        switch (SELECTED_ABILITY)
        {
        case ("Solar Flare"):

            SolarFlare.HighlightAOE(gameBoard, currentUnit, this);

            break;

        case ("Acid Rain"):

            AcidRain.HighlightAOE(gameBoard, currentUnit, this);

            break;
        }
    }
Beispiel #3
0
    void Start()
    {
        solarFlare = GameObject.Find("Sun").GetComponent <SolarFlare> ();

        randIndex = Random.Range(0, 2);
        posOrNeg  = new int[] { -1, 1 };

        //Debug.Log (gameObject.name + " " + transform.localPosition);

        distance = Vector3.Distance(new Vector3(0, 0, 0), transform.localPosition);

        //Debug.Log (gameObject.name + " " + Parent.transform.localPosition + " " + Parent.transform.position);

        xPos = Random.Range(-distance, distance);
        yPos = (Mathf.Sqrt((Mathf.Pow(distance, 2) - Mathf.Pow((xPos), 2))) * posOrNeg[randIndex]);

        //Debug.Log (gameObject.name + " " + xPos +  " " + yPos);

        transform.localPosition = new Vector3(xPos, yPos, transform.position.z);
    }
Beispiel #4
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;
        }
    }
Beispiel #5
0
 void Start()
 {
     // Get Sourcces and Components
     AudSource  = GetComponent <AudioSource> ();
     solarFlare = GameObject.Find("Sun").GetComponent <SolarFlare> ();
 }