Skip to content

Instantly share code, notes, and snippets.

@teach310
Created July 1, 2016 03:39
Show Gist options
  • Save teach310/dfff56f797526d11592a12cc746af9b3 to your computer and use it in GitHub Desktop.
Save teach310/dfff56f797526d11592a12cc746af9b3 to your computer and use it in GitHub Desktop.
int currentState = 0; // 0:Angry 1:Smile
void Update () {
// state : Angry
if (currentState == 0) {
Debug.Log ("Angry!");
//Smileになる条件
if (Input.GetKeyDown (KeyCode.S)) {
currentState = 1;
}
}
// state : Smile
if (currentState == 1) {
Debug.Log ("Smile!");
//Angryになる条件
if (Input.GetKeyDown (KeyCode.A)) {
currentState = 0;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment