void OnGUI() { using (HGUISizeLocker guiLock = new HGUISizeLocker()) { if (SGlobal.state == State.Stop) { Rect rect = new Rect(0, 0, 80, 40); SGlobal.PositionCenter(ref rect); if (GUI.Button(rect, btnPlay)) { Reset(); SGlobal.state = State.Playing; } } //else if (SGlobal.state == State.Play) { GUIStyle style = new GUIStyle(); style.fontSize = 30; style.normal.textColor = Color.green; Rect rect = new Rect(0, 0, 160, 30); SGlobal.PositionRight(ref rect); GUI.Label(rect, "Score:" + SGlobal.score.ToString(), style); Rect rect2 = new Rect(0, 0, 200, 30); GUI.Label(rect2, "MaxScore:" + SGlobal.maxscore.ToString(), style); } } }
void OnGUI() { using (HGUISizeLocker guiLock = new HGUISizeLocker()) { if (SGlobal.state == State.Play) { Rect rect = new Rect(0, 0, 80, 40); SGlobal.PositionBottom(ref rect); if (GUI.RepeatButton(rect, btnLeft)) { rigidbody.AddForce(Vector3.left * steep * Time.deltaTime * 60); } Rect rect2 = new Rect(0, 0, 80, 40); SGlobal.PositionRight(ref rect2); SGlobal.PositionBottom(ref rect2); if (GUI.RepeatButton(rect2, btnRight)) { rigidbody.AddForce(Vector3.left * -steep * Time.deltaTime * 60); } } } }