Battle Stage
A Battle Stage is the set of sub-stages, called BattleStates, that dictate how the game is played. It is controlled by the Battle component. The BattleStates are listed in order of execution.
To learn how to create a Battle Stage, go to Create a new Battle Stage.
Battle State
A BattleState control the behavior of the GameActor and can set their own game rules. Each state has a counter that, when it reaches zero, moves to the next state in the list.
The most important functions of a BattleState are as follows:
OnStageStart(): Method that is invoked once the state starts. Example: Enemy characters can be created at the beginning of a phase.
Update(): Method that is once every frame. Example: Check if the victory or defeat conditions are met.
AllowFieldDrag(GameActor actor): Sets the condition in which a GameActor can be moved. Example: A BattleState can allow both characters and items to move, but it can allow only the movement of the items, or nothing at all.
CharacterAIUpdate(GameCharacter character): Every Game Character delegates its Update method to this BattleState. Example: A fighting state causes characters to move and attack enemies, while a standby state causes characters to remain static in their cell.
OnTimerFinish(): Method that is called once when the timer reaches zero. Example: The next state in the Battle Stage list is invoked.
To learn how to create a Battle State, go to Create a new Battle State.
Types of Battle States included in the package.
Preparation State: In this Battle State, from a ScriptableBattlePosition it will be possible to make enemy characters appear in certain positions on the board. The enemy created in a specific cell will be chosen randomly from a group of possible ones. Once created, the player will be able to buy, move and equip his own characters, until the time runs out, which will proceed to the next Battle State.
To learn how to create a new Preparation State, including how to create a new ScriptableBattlePosition, go to Create a new Preparation State.Fight State: This BattleState makes the characters of both teams battle each other. The dragging of characters will be disabled, but the dragging of items will not be disabled, so you will be able to equip a character during the battle. The battle will continue until the time runs out or a victory or defeat condition is met, and the next state will be executed.
To learn how to create a new Fight State, go to Create a new Fight State.Change Stage: This BattleState makes it possible to change Battle Stages. Normally it would be placed in the last position of the list of a Battle Stage, to continue the game with another one.
To learn how to create a new Change Stage State, go to Create a new Change Stage State.