Example #1
0
    public void TurnResults()
    {
        if (results2.Equals("P2 was deafeated. "))
        {
            PickAnimation();
            turnDelay = true;
            StartCoroutine(WaitForAnimation());
            Destroy(fighterGO2);
            print(results + results2 + theWinner);
            BattleResults.NewTurnText(results + results2 + theWinner);
            PlayerStats.Choosing = false;
            PlayerStats.InBattle = false;
            Fighter2.SetAlive(false);
            PlayerStats.EXP += 5;
            if (PlayerStats.EXP >= PlayerStats.MaxEXP)
            {
                PlayerStats.LevelUp();
            }
            source.Stop();
            source.PlayOneShot(winJingle, 3f);
            PlayerStats.RestoreStats();
            PlayerPrefManager.PrefManager.Save();
            if (PlayerStats.InBossBattle)
            {
                PlayerStats.InBossBattle = false;
                PlayerStats.PlayerPos    = Vector3.zero;
                PlayerStats.CamPos       = Vector3.zero;
                Invoke("EndGame", 2);
            }
            else
            {
                DelayedOWReturn(endDelay);
            }
        }
        else if (results2.Equals("P1 was deafeated. "))
        {
            PickAnimation();
            turnDelay = true;
            StartCoroutine(WaitForAnimation());
            Destroy(fighterGO1);
            source.Stop();
            print(results + results2 + theWinner);
            BattleResults.NewTurnText(results + results2 + theWinner);
            actionWords1 = "";
            actionWords2 = "";
            results      = "";
            results2     = "";
            letter1      = 'x';
            letter2      = 'x';
            //p1Chose = false;
            //p2Chose = false;
            if (PlayerStats.IsAttacker)
            {
                PlayerStats.IsAttacker = false;
                Fighter2.IsAttacking(true);
            }
            else if (Fighter2.GetAttacker())
            {
                Fighter2.IsAttacking(false);
                PlayerStats.IsAttacker = true;
            }
            PlayerStats.Choosing = false;
            Fighter2.SetChoosing(false);
            PlayerStats.InBattle     = false;
            PlayerStats.Alive        = false;
            PlayerStats.InBossBattle = false;
            Destroy(fighterGO2);
            SceneManager.LoadSceneAsync(3, LoadSceneMode.Additive);
            ManagerClass.Manager.UnloadScene(2);
        }
        else if (results2.Equals("Battle Continues"))
        {
            PickAnimation();
            turnDelay = true;
            StartCoroutine(WaitForAnimation());
            print(results + results2);
            BattleResults.NewTurnText(results + results2);
            BattleCounter.IncreaseTurn();
            actionWords1 = "";
            actionWords2 = "";
            results      = "";
            results2     = "";
            letter1      = 'x';
            letter2      = 'x';
            //p1Chose = false;
            //p2Chose = false;

            if (PlayerStats.IsAttacker)
            {
                PlayerStats.IsAttacker = false;
                Fighter2.IsAttacking(true);
            }
            else if (Fighter2.GetAttacker())
            {
                Fighter2.IsAttacking(false);
                PlayerStats.IsAttacker = true;
            }

            PlayerStats.Choosing = false;
            Fighter2.SetChoosing(false);


            PlayerStats.SetNameBasedOnTurn();
            Fighter2.SetNameBasedOnTurn();
        }
        else
        {
            //Will reset the turn without changing it
            print("Results: " + results);
            actionWords1         = "";
            actionWords2         = "";
            results              = "";
            theWinner            = "";
            letter1              = 'x';
            letter2              = 'x';
            PlayerStats.Choosing = false;
            Fighter2.SetChoosing(false);
        }
    }
Example #2
0
    public void TurnResults()
    {
        if (results2.Equals("P2 was deafeated. "))
        {
            Fighter2.DestroyMe();
            print(results + results2 + theWinner);
            BattleResults.NewTurnText(results + results2 + theWinner);
            //alive = false;
            Fighter2.SetAlive(false);
        }
        else if (results2.Equals("P1 was deafeated. "))
        {
            Fighter1.DestroyMe();
            print(results + results2 + theWinner);
            BattleResults.NewTurnText(results + results2 + theWinner);
            //alive = false;
            Fighter1.SetAlive(false);
        }
        else if (results2.Equals("Battle Continues"))
        {
            print(results + results2);
            BattleResults.NewTurnText(results + results2);
            BattleCounter.IncreaseTurn();
            actionWords1 = "";
            actionWords2 = "";
            results      = "";
            results2     = "";
            letter1      = 'x';
            letter2      = 'x';
            //p1Chose = false;
            //p2Chose = false;

            if (Fighter1.GetAttacker())
            {
                Fighter1.IsAttacking(false);
                Fighter2.IsAttacking(true);
            }
            else if (Fighter2.GetAttacker())
            {
                Fighter2.IsAttacking(false);
                Fighter1.IsAttacking(true);
            }

            Fighter1.SetChoosing(false);
            Fighter2.SetChoosing(false);
            Fighter1.SetNameBasedOnTurn();
            Fighter2.SetNameBasedOnTurn();
        }
        else
        {
            //Will reset the turn without changing it
            print("Results: " + results);
            actionWords1 = "";
            actionWords2 = "";
            results      = "";
            theWinner    = "";
            letter1      = 'x';
            letter2      = 'x';
            Fighter1.SetChoosing(false);
            Fighter2.SetChoosing(false);
        }
    }