Exemplo n.º 1
0
    //Function called in the search State
    private void searchState()
    {
        //Print out the current State
        Debug.Log(fsm.sCurrentState.eName.ToString());
        //Battle party sorted by speed to produce attack order
        a.ulParticipants = sortBySpeed(canvasScript.ulBattleReadyParty);
        //Loop through the list
        for (int i = 0; i < a.ulParticipants.Count; i++)
        {//Set the BattleOrderTextBox text to a newline with the current units name
            ifBattleOrderText.text += "\n" + a.ulParticipants[i].sName;
        }
        //Foreach unit in the list
        foreach (Unit i in a.ulParticipants)
        {     //If the current unit is of type Player
            if (i.sType == "Player")
            { //Add the unit to this party
                ulPlayerParty.Add(i);
            }
            //If the current unit is of type Enemy
            if (i.sType == "Enemy")
            {//Add the unit to this party
                ulEnemyParty.Add(i);
            }
        }

        //Set the player1Name text to the given index of the playerParty list
        canvasScript.tPlayer1Name.text = ulPlayerParty[0].sName;
        //Set the player2Name text to the given index of the playerParty list
        canvasScript.tPlayer2Name.text = ulPlayerParty[1].sName;
        //Set the player3Name text to the given index of the playerParty list
        canvasScript.tPlayer3Name.text = ulPlayerParty[2].sName;

        //Set the enemy1Name text to the given index of the enemyParty list
        canvasScript.tEnemy1Name.text = ulEnemyParty[0].sName;
        //Set the enemy2Name text to the given index of the enemyParty list
        canvasScript.tEnemy2Name.text = ulEnemyParty[1].sName;
        //Set the enemy3Name text to the given index of the enemyParty list
        canvasScript.tEnemy3Name.text = ulEnemyParty[2].sName;
        //Set images to loaded in party
        canvasScript.LoadedGameImages(a.ulParticipants);

        //Call Function to print out the stats of all objects in battle
        manager.StatsOfObjects(a.ulParticipants);
        //Set the StatsField text variable to the data in the statsText variable
        ifStatsField.text = manager.statsText;

        //Load Battle Scene Canvas
        cBattleCanvas.enabled = true;

        //Call the FirstAttack function to get the battle started
        FirstAttack(a.ulParticipants);
    }