Created
July 1, 2016 05:17
-
-
Save teach310/aa53fccc4531d424ea02eee5a2f94caa to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using System.Collections; | |
public class PlayerScript : MonoBehaviour { | |
int currentState = 0; // 0: Blue 1: Red | |
void Update () { | |
// state: Blue | |
if (currentState == 0) { | |
Debug.Log ("Blue"); | |
// 状態変更 | |
if (Input.GetKeyDown (KeyCode.R)) { | |
currentState = 1; | |
} | |
} | |
// state: Red | |
if (currentState == 1) { | |
Debug.Log ("Red"); | |
if(Input.GetKeyDown(KeyCode.B)){ | |
currentState = 0; | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment