Exemplo n.º 1
0
 void EvaluateTurn()
 {
     // if a side lost the battle then end it
     //if ((currentHpNPC <= 0 || currentHpPlayer <= 0) && Time.timeSinceLevelLoad - timeEnter >= timeExit)
     // This is infocard case 1
     if (currentHpNPC <= 0 || currentHpPlayer <= 0)
     {
         Debug.Log("A side has reached 0 HP. Game is over");
         nextPhase = new EndBattle(battleManager, playerStats, npcData, playerHand, npcHand);
         battleManager.nPCDisplay.SetReaction(npcData.endQuotes[Random.Range(0, npcData.endQuotes.Length)], npcData.enemyAngry);
         DisplayInfoCard(1);
     }
     // if challenge is won, even if target isn't reached yet then start a new round
     // this is infocard case 2
     else if (isChallengeWon)
     {
         Debug.Log("Challenge is won by opponent. Moving cards to graveyard and starting a new round.");
         battleManager.SwitchTurn();
         // empty table and pot before new round
         table.ClearTable(CardCollections.Graveyard);
         pot.EmptyPot();
         nextPhase = new NewRound(battleManager, playerStats, npcData, playerHand, npcHand);
         DisplayInfoCard(2);
     }
     // if the target is crossed then start a new round and move cards to pot
     // this is infocard case 3
     else if (battleManager.currentNumber > battleManager.targetNumber)
     {
         Debug.Log("Target number is crossed. Moving cards to Pot and starting a new round.");
         battleManager.SwitchTurn();
         table.ClearTable(CardCollections.Pot);
         nextPhase = new NewRound(battleManager, playerStats, npcData, playerHand, npcHand);
         DisplayInfoCard(3);
     }
     // if the target is reached then start a new round and move cards to graveyard
     // this is infocard case 4
     else if (battleManager.currentNumber == battleManager.targetNumber)
     {
         Debug.Log("Target number is reached. Moving cards to Graveyard and starting a new round.");
         battleManager.SwitchTurn();
         // empty table and pot before new round
         table.ClearTable(CardCollections.Graveyard);
         pot.EmptyPot();
         nextPhase = new NewRound(battleManager, playerStats, npcData, playerHand, npcHand);
         DisplayInfoCard(4);
     }
     // if neither of the above then continue the same round and switch turns
     // this is infocard case 5
     else
     {
         Debug.Log(battleManager.playerTurn + " player's turn has ended. Switching sides.");
         battleManager.SwitchTurn();
         nextPhase = new CardDeal(battleManager, playerStats, npcData, playerHand, npcHand);
         DisplayInfoCard(5);
     }
 }
Exemplo n.º 2
0
    private void EndDialog()
    {
        Animator.SetBool("IsOpen", false);
        _isStarted = false;
        // if event exists, invoke
        if (Type == "START")
        {
            StartBattle?.Invoke();
        }
        else if (Type == "END")
        {
            EndBattle?.Invoke();
        }
        else if (Type == "STARTCUTSCENE")
        {
            EndStartingCutscene?.Invoke();
        }
        else if (Type == "PLAYERSTARTCUTSCENE")
        {
            PlayerEndStartingCutscene?.Invoke();
        }
        else if (Type == "HEALTHPICKUP")
        {
            HealthPickup?.Invoke();
        }
        else if (Type == "ENDING")
        {
            FinalScene?.Invoke();
        }

        AudioSource source = FindObjectOfType <GameStateManager>().gameObject.GetComponent <AudioSource>();

        if (source)
        {
            source.mute = false;
        }
    }
Exemplo n.º 3
0
    public static void EndTurn()
    {
        TackticMove unit = turnTeam.Dequeue();

        unit.EndTurn();

        if (turnTeam.Count > 0)
        {
            StartTurn();
        }
        else
        {
            string team = TurnKey.Dequeue();
            TurnKey.Enqueue(team);
            //InitTearnTeamQueue();
            var tilemap = GameObject.FindGameObjectWithTag("TileMap").transform;
            foreach (Transform item in tilemap)
            {
                item.GetComponent <Tile>().tReset();
            }
            TeamTurnEnded = true;
        }
        EndBattle.CheckTeamsCount_static();
    }
Exemplo n.º 4
0
 private void Start()
 {
     instance = this;
 }