Exemplo n.º 1
0
    IEnumerator DoRound()
    {
        yield return(new WaitForSeconds(battlePrepTime));

        if (TeamA.activeDancers.Count > 0 && TeamB.activeDancers.Count > 0)
        {
            //Debug.LogWarning("DoRound called, it needs to select a dancer from each team to dance off and put in the FightEventData below");
            Character a = TeamA.activeDancers[Random.Range(0, TeamA.activeDancers.Count)];
            Character b = TeamB.activeDancers[Random.Range(0, TeamB.activeDancers.Count)];
            GameEvents.RequestFight(new FightEventData(a, b));
        }
        else
        {
            if (TeamA.activeDancers.Count != 0)
            {
                GameEvents.BattleFinished(TeamA);
                TeamA.EnableWinEffects();
            }
            else
            {
                GameEvents.BattleFinished(TeamB);
                TeamB.EnableWinEffects();
            }


            //log it battlelog also
            //Debug.Log("DoRound called, but we have a winner so Game Over");
        }
    }
    //Starting a fight,, and determing who is winner and loser in dance off
    IEnumerator DoRound()
    {
        yield return(new WaitForSeconds(battlePrepTime));

        //checking for no dancers on either team
        if (TeamA.activeDancers.Count > 0 && TeamB.activeDancers.Count > 0)
        {
            int i = Random.Range(0, TeamA.activeDancers.Count);
            int j = Random.Range(0, TeamB.activeDancers.Count);

            Character characterA = TeamA.activeDancers[i];
            Character characterB = TeamB.activeDancers[j];
            GameEvents.RequestFight(new FightEventData(characterA, characterB));
        }
        else
        {
            DanceTeam winner;

            winner = TeamA.activeDancers.Count <= 0 ? TeamB : TeamA;


            GameEvents.BattleFinished(winner);
            winner.EnableWinEffects();

            BattleLog.Log(new DefaultLogMessage("the winning team is: " + winner.troupeNameText, winner.teamColor));

            //log it battlelog also
            //Debug.Log("DoRound called, but we have a winner so Game Over");
        }
    }
Exemplo n.º 3
0
    IEnumerator DoRound()
    {
        yield return(new WaitForSeconds(battlePrepTime));

        //checking for no dancers on either team
        if (TeamA.activeDancers.Count > 0 && TeamB.activeDancers.Count > 0)
        {
            Debug.LogWarning("DoRound called, it needs to select a dancer from each team to dance off and put in the FightEventData below");


            //selecting a random character from each team to battle from active dance list
            RandTeamA = TeamA.activeDancers[Random.Range(0, TeamA.activeDancers.Count)];
            RandTeamB = TeamB.activeDancers[Random.Range(0, TeamB.activeDancers.Count)];

            GameEvents.RequestFight(new FightEventData(RandTeamA, RandTeamB));
        }
        else
        {
            //team A won the round do win effect
            if (TeamA.activeDancers.Count > TeamB.activeDancers.Count)
            {
                GameEvents.BattleFinished(TeamA);
                TeamA.EnableWinEffects();
            }
            //team b won the round do win effect
            else
            {
                GameEvents.BattleFinished(TeamB);
                TeamB.EnableWinEffects();
            }

            //log it battlelog also
            Debug.Log("DoRound called, but we have a winner so Game Over");
        }
    }
Exemplo n.º 4
0
    IEnumerator DoRound()
    {
        yield return(new WaitForSeconds(battlePrepTime));

        //checking for no dancers on either team
        if (TeamA.activeDancers.Count > 0 && TeamB.activeDancers.Count > 0)
        {
            Debug.LogWarning("DoRound called, it needs to select a dancer from each team to dance off and put in the FightEventData below");

            // pick a dancer from Team A and a dancer from Team B
            teamA = TeamA.activeDancers[Random.Range(0, TeamA.activeDancers.Count)];
            teamB = TeamB.activeDancers[Random.Range(0, TeamB.activeDancers.Count)];
            GameEvents.RequestFight(new FightEventData(teamA, teamB));
        }
        else
        {
            // Work out who the winning team is

            // If team a's dancers are less than or equal to 0...
            if (TeamA.activeDancers.Count <= 0)
            {
                // ...Finish the game and make team b win.
                GameEvents.BattleFinished(TeamA);
                TeamB.EnableWinEffects();
            }
            else if (TeamB.activeDancers.Count >= 0) // else if team b's dancers are less than or equal to 0...
            {
                // ...Finish the game and make team a win.
                GameEvents.BattleFinished(TeamB);
                TeamA.EnableWinEffects();
            }
            //GameEvents.BattleFinished(Winner);
            //Winner.EnableWinEffects();

            //log it battlelog also
            Debug.Log("DoRound called, but we have a winner so Game Over");

            SceneManager.LoadScene(0);
        }
    }
Exemplo n.º 5
0
    IEnumerator DoRound()
    {
        //Tell fight manager to attack? Or just listen for outcomes?
        yield return(new WaitForSeconds(battlePrepTime));

        if (TeamA.activeDancers.Count > 0 && TeamB.activeDancers.Count > 0)
        {
            Character a = TeamA.activeDancers[Random.Range(0, TeamA.activeDancers.Count)];
            Character b = TeamB.activeDancers[Random.Range(0, TeamB.activeDancers.Count)];
            GameEvents.RequestFight(new FightEventData(a, b));
        }
        else
        {
            var winner = TeamA.activeDancers.Count > 0 ? TeamA : TeamB;
            GameEvents.BattleFinished(winner);

            winner.EnableWinEffects();

            //log it battlelog also
            Debug.Log("Game Over");
        }
    }
Exemplo n.º 6
0
    IEnumerator DoRound()
    {
        yield return(new WaitForSeconds(battlePrepTime));

        //this code is the most important one in this script since it is incharge of dictating a team victorious when the battle is over.
        //It basically takes both teams and checks the count of them, the team with the more dancers at the end comes out as the winner.
        if (TeamA.activeDancers.Count > 0 && TeamB.activeDancers.Count > 0)
        {
            // Debug.LogWarning("DoRound called, it needs to select a dancer from each team to dance off and put in the FightEventData below");
            Character a = TeamA.activeDancers[Random.Range(0, TeamA.activeDancers.Count)];
            Character b = TeamB.activeDancers[Random.Range(0, TeamB.activeDancers.Count)];

            GameEvents.RequestFight(new FightEventData(a, b));
        }
        else
        {
            DanceTeam winner;

            //winner = TeamA.activeDancers.Count <=0 ? TeamB : TeamA; / You can use this to make if/else statements shorter
            if (TeamA.activeDancers.Count > TeamB.activeDancers.Count)
            {
                winner = TeamA;
            }
            else
            {
                winner = TeamB;
            }

            GameEvents.BattleFinished(winner);
            winner.EnableWinEffects();
            //this code is incharge of displaying the win effects when a dance round is over, also incharge of playing the win effects.



            //log it battlelog also
            //Debug.Log("DoRound called, but we have a winner so Game Over");
        }
    }