Example #1
0
    // Update is called once per frame
    void Update()
    {
        GameObject thisPlayer = players[currentPlayer];
        GameObject otherPlayer;

        try{
            otherPlayer = players[currentPlayer + 1];
        }
        catch {
            otherPlayer = players[0];
        }

        if (currentPhase == turnPhases.PreDraw)        //or == 0
        {
            //Debug.Log("Time for player " + currentPlayer.ToString() + " to start.");
            //for when creatures have OnTurnStart effects. currently none
            currentPhase += 1;
            thisPlayer.GetComponent <Resources>().addEssence(thisPlayer.GetComponent <Resources>().turnCount);
            foreach (GameObject creature in thisPlayer.GetComponent <Resources>().field)
            {
                creature.GetComponent <CreatureCard>().refresh();
                if (creature.GetComponent <CreatureCard>().effectType == CreatureCard.EffectTypes.OnTurnStart)
                {
                    creature.GetComponent <CreatureCard>().OnTurnStartSkill();
                }
            }
        }
        else if (currentPhase == turnPhases.Draw)
        {
            players[currentPlayer].GetComponent <Dealer>().drawCard();
            currentPhase += 1;
        }
        else if (currentPhase == turnPhases.Setup)
        {
            //Debug.Log("Time for player " + currentPlayer.ToString() + " to cast things.");
            if (Input.GetKeyDown(KeyCode.Space))
            {
                currentPhase += 1;
            }
        }
        else if (currentPhase == turnPhases.Attack)
        {
            //Debug.Log("Time for player " + currentPlayer.ToString() + " to attack things.");
            if (Input.GetKeyDown(KeyCode.Space))
            {
                currentPhase += 1;
            }
        }
        else if (currentPhase == turnPhases.PostAttack)
        {
            if (!GetComponent <GUIMaster>().canOpenNewBox())
            {
                GetComponent <GUIMaster>().forceCloseBox(this.gameObject);
            }
            currentPhase = 0;

            currentPlayer++;
            if (currentPlayer == players.Count)
            {
                currentPlayer = 0;
            }

            otherPlayer.GetComponent <Resources>().turnCount += 1;
        }
    }
Example #2
0
 public void incrementPhase()
 {
     currentPhase += 1;
 }