Exemple #1
0
    void EndTurn()
    {
        sideTurn++;
        if (sideTurn > sidesAmount - 1)
        {
            sideTurn = 0;
        }

        turnCount++;

        for (int k = 0; k < amtCombatants; k++)
        {
            if (activeCombatants[k] != null)
            {
                FillHand(activeCombatants[k]);
                combatantScripts[k].ResetAp(sideTurn); //Fill combatant AP to max AP if it is the beginning of their turn.
            }
        }

        //Change Turn Text
        if (sideTurn == 0)
        {
            turnText0.text = "Turn";
            turnText1.text = "";
        }
        else
        {
            turnText0.text = "";
            turnText1.text = "Turn";
        }

        //Deselect Cards and Combatants
        if (selectedCard != null)
        {
            selectedCard.Reset();
            selectedCard = null;
        }

        if (selectedCombatant != null)
        {
            selectedCombatant.Select(false);
            selectedCombatant = null;
        }

        //Tell AI it's their turn.
        if (AI_Enabled)
        {
            if (sideTurn == enemyScript.GetSide())
            {
                enemyScript.IsTurn(true);
            }
        }
    }
Exemple #2
0
    void Click(Vector3 mposition)
    {
        RaycastHit hit;
        Ray        ray = camera.ScreenPointToRay(mposition);

        if (Physics.Raycast(ray, out hit))
        {
            Transform objectHit = hit.transform;
            if (objectHit.tag == "Card")
            {
                updateMousePos = true;
                if (selectedCard != null)
                {
                    selectedCard.Select(false);
                }
                selectedCard = objectHit.gameObject.GetComponent <CardBehavior>();
                selectedCard.Select(true);
                oldCardPosition = selectedCard.transform.localPosition;
            }

            else if (objectHit.tag == "Button")
            {
                selectedButton = objectHit.gameObject.GetComponent <ButtonBehavior>();
                selectedButton.Select(true);
            }


            else if (objectHit.tag == "Combatant")
            {
                if (selectedCombatant != null)
                {
                    selectedCombatant.Select(false);
                }
                selectedCombatant = objectHit.gameObject.GetComponent <CombatantBehavior>();
                selectedCombatant.Select(true);

                if (playAreaCard != null)
                {
                    PlayCard();
                }
            }

            else if (objectHit.tag == "PlayArea")
            {
                if (playAreaCard != null)
                {
                    playAreaCard.Reset();
                    playAreaCard = null;
                }
            }

            else
            {
                if (selectedCard != null)
                {
                    selectedCard.Select(false);
                    selectedCard = null;
                }

                if (selectedCombatant != null)
                {
                    selectedCombatant.Select(false);
                    selectedCombatant = null;
                }
            }
        }
    }