void Update() { double number = double.Parse(serial.GetData()); if (number > 10000) { animator.Play("hit"); } if (number <= 10000) { animator.Play("walk"); } Debug.Log(serial.GetData()); }
void Update() { string str = serial.GetData(); if (str != null) { r = int.Parse(str); Debug.Log(r); } //Debug.Log (serial.GetData ()); }
void Update() { string str = serial.GetData(); // if(str != null){ // // float r = float.Parse (str); // // if(r >= 50.0f && r <= 100.0f){ // Decision = 1; // } // else if(r < 10.0f){ // Decision = -1; // } // else{ // Decision = 0; // } // } Debug.Log(str); }
void Update() { if (!bgm.isPlaying && isStart) { Score.score = (int)(score / noteMax); Application.LoadLevel("Result"); } foreach (Note note in GameObject.FindObjectsOfType <Note> ()) { if (note.pos > 0) { float y = noteTarget.position.y + 1 * ((bps * note.time - bgm.time) * speed); note.transform.position = new Vector3 ((-note.pos + note.pos * 0.25f) * NoteMoveX(5.5f, noteTarget.position.y, y) + note.pos, y, note.transform.position.z); note.transform.localScale = new Vector3(1.3f, 1.3f, 1) * NoteMoveX(noteTarget.position.y, 5.5f, y); } else { float y = noteTarget.position.y + 1 * ((bps * note.time - bgm.time) * speed); note.transform.position = new Vector3 ((-note.pos + note.pos * 0.25f) * NoteMoveX(5.5f, noteTarget.position.y, y) + note.pos, y, note.transform.position.z); note.transform.localScale = new Vector3(1.3f, 1.3f, 1) * NoteMoveX(noteTarget.position.y, 5.5f, y); } if (note.transform.position.y <= -2) { Debug.Log("Bad"); note.gameObject.SetActive(false); } } string getData = serial.GetData(); int[] val; Debug.Log(getData); if (getData != null) { string[] str = getData.Split(','); val = new int[] { int.Parse(str [0]), int.Parse(str [1]), int.Parse(str [2]), int.Parse(str [3]), int.Parse(str [4]), int.Parse(str [5]) }; } else { val = new int[] { 0, 0, 0, 0, 0, 0 }; } if (Input.GetKeyDown(KeyCode.Q) || (1 <= val[0] && val[0] <= serialheight)) { JudgeNote(new Vector3(-5, 0, 0)); } if (Input.GetKeyDown(KeyCode.W) || (1 <= val[1] && val[1] <= serialheight)) { JudgeNote(new Vector3(-3, 0, 0)); } if (Input.GetKeyDown(KeyCode.E) || (1 <= val[2] && val[2] <= serialheight)) { JudgeNote(new Vector3(-1, 0, 0)); } if (Input.GetKeyDown(KeyCode.R) || (1 <= val[3] && val[3] <= serialheight)) { JudgeNote(new Vector3(1, 0, 0)); } if (Input.GetKeyDown(KeyCode.T) || (1 <= val[4] && val[4] <= serialheight)) { JudgeNote(new Vector3(3, 0, 0)); } if (Input.GetKeyDown(KeyCode.Y) || (1 <= val[5] && val[5] <= serialheight)) { JudgeNote(new Vector3(5, 0, 0)); } }