Game Development Reference
In-Depth Information
case BattleState.Player_Move:
if (GUI.Button(new Rect(10, 10, 100, 50), "Run Away"))
{
GameState.playerReturningHome = true;
NavigationManager.NavigateTo("World");
}
if (selectedWeapon == null)
{
GUI.Box(new Rect((Screen.width / 2) -
50,10,100,50),"Select Weapon");
}
else if (selectedTarget == null)
{
GUI.Box(new Rect((Screen.width / 2) - 50, 10, 100, 50),
"Select Target");
canSelectEnemy = true;
}
else
{
if (GUI.Button(new Rect((Screen.width / 2) - 50, 10, 100,
50), "Attack " + selectedTargetName))
{
canSelectEnemy = false;
battleStateManager.SetBool("PlayerReady", true);
MessagingManager.Instance.BroadcastUIEvent(true);
}
}
break;
Now the battle can ensue. The player selects a weapon and a target, and they have a nice
(well, a nice GUI) button to tap to say they are happy with their choice. So, let the battle
commence.
We also inform anyone listening to the GUI events that the GUI is now locked, and the
player cannot do anything until it is their turn again.
Now, when you run the project, the flow of the battle will be as follows:
1. The battle begins.
2. The introduction is played, informing the player about the impending doom.
Search WWH ::




Custom Search