-
Notifications
You must be signed in to change notification settings - Fork 0
/
TurnBasedCombatStateMachine.cs
80 lines (68 loc) · 1.37 KB
/
TurnBasedCombatStateMachine.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
using UnityEngine;
using System.Collections;
public class TurnBasedCombatStateMachine : MonoBehaviour
{
public enum BattleStates
{
START,
PLAYERCHOICE,
ENEMYCHOICE,
LOSE,
WIN
}
private BattleStates currentState;
// Use this for initialization
void Start ()
{
currentState = BattleStates.START;
}
// Update is called once per frame
void Update ()
{
//DISPLAY CURRENT STATE
Debug.Log (currentState);
switch (currentState)
{
case (BattleStates.START):
//SETUP BATTLE FUNCTION
//create enemy
//choose who goes first based on agility
break;
case (BattleStates.PLAYERCHOICE): //player chooses the ability they want to use
break;
case (BattleStates.ENEMYCHOICE):
//coded AI goes here
break;
case (BattleStates.LOSE):
break;
case (BattleStates.WIN):
break;
}
}
void OnGUI()
{
if (GUILayout.Button("NEXT STATE"))
{
if(currentState==BattleStates.START)
{
currentState = BattleStates.PLAYERCHOICE;
}
else if(currentState==BattleStates.PLAYERCHOICE)
{
currentState = BattleStates.ENEMYCHOICE;
}
else if(currentState==BattleStates.ENEMYCHOICE)
{
currentState = BattleStates.LOSE;
}
else if(currentState==BattleStates.LOSE)
{
currentState = BattleStates.WIN;
}
else if(currentState==BattleStates.WIN)
{
currentState = BattleStates.START;
}
}
}
}