Esempio n. 1
0
    public void InitBattle(CombatantBoard player, CombatantBoard opponent)
    {
        playerBoard  = player;
        playerHealth = playerBoard.GetComponent <Health>();
        playerBoard.SetBoardTeamID(0);

        opponentBoard  = opponent;
        opponentHealth = opponentBoard.GetComponent <Health>();
        opponentBoard.SetBoardTeamID(1);
        opponentBoard.MirrorBoard();

        /// grant Initial Move tokens
        MoveCounter playerMoveCounter = playerBoard.GetComponentInChildren <MoveCounter>();

        if (playerMoveCounter != null)
        {
            playerMoveCounter.AddMoveToken(1);
        }
        MoveCounter opponentMoveCounter = opponentBoard.GetComponentInChildren <MoveCounter>();

        if (opponentMoveCounter != null)
        {
            opponentMoveCounter.AddMoveToken(1);
        }

        /// begin game with initial move
        if (warmupPanel == null)
        {
            warmupPanel = FindObjectOfType <WarmupPanel>();
        }
        warmupCoroutine = Warmup("INITIAL MOVE", initialWarmupTime);
        StartCoroutine(warmupCoroutine);
    }
Esempio n. 2
0
    private IEnumerator ResolveCells()
    {
        /// oppose each row at a time
        int rowCount = playerBoard.boardRowCount;

        for (int i = 0; i < rowCount; i++)
        {
            ResolveCellRow(i);
            yield return(new WaitForSeconds(cellResolveTime));
        }

        /// loop thru each slot
        //int cellCount = playerBoard.GetSlots().Count;
        //for(int i = 0; i < cellCount; i++)
        //{
        //	CellSlot playerSlot = playerBoard.GetSlots()[i];
        //	CellSlot opponentSlot = opponentBoard.GetSlots()[i];
        //	ResolveCellPair(playerSlot, opponentSlot);
        //	yield return new WaitForSeconds(cellResolveTime);
        //}

        if (BothCharactersAlive())
        {
            /// start next round
            warmupCoroutine = Warmup("READY", betweenRoundsWarmupTime);
            StartCoroutine(warmupCoroutine);

            /// end-of-round Abilities
            endOfRoundCoroutine = EndOfRound();
            StartCoroutine(endOfRoundCoroutine);

            /// grant Move tokens
            MoveCounter playerMoveCounter = playerBoard.GetComponentInChildren <MoveCounter>();
            if (playerMoveCounter != null)
            {
                playerMoveCounter.AddMoveToken(1);
            }
            MoveCounter opponentMoveCounter = opponentBoard.GetComponentInChildren <MoveCounter>();
            if (opponentMoveCounter != null)
            {
                opponentMoveCounter.AddMoveToken(1);
            }
        }
        else
        {
            StopAllCoroutines();
            bool bPlayerWon = (playerHealth.GetHP() >= 1) && (playerBoard.GetNumCells() > 0);
            battleUI.GameOver(bPlayerWon);
        }
    }