void Update() { if (canMove) { if (Input.GetKey(KeyCode.W)) { transform.Translate(Vector3.up * Time.deltaTime * 5); } if (Input.GetKey(KeyCode.S)) { transform.Translate(Vector3.down * Time.deltaTime * 5); } if (Input.GetKey(KeyCode.A)) { transform.Translate(Vector3.left * Time.deltaTime * 5); } if (Input.GetKey(KeyCode.D)) { transform.Translate(Vector3.right * Time.deltaTime * 5); } if (Input.GetKeyDown(KeyCode.Space)) { SaveIsEasy.PrefabInstantiate(cube, transform.position, Quaternion.identity); } } else { transform.Rotate(Vector3.forward * Time.deltaTime * speed); } }
/* We also save on application pause in iOS, as OnAppicationQuit isn't always called */ //#if UNITY_IPHONE && !UNITY_EDITOR public void OnApplicationPause(bool b) { Debug.Log("~~~~~~~~~~~ OnApplicationPause() "); // 로딩 된 후라면 if (_isStarted == true) { SaveIsEasy.SaveAll(); } }
void Update() { if (Random.Range(1, 70) == 1) { GameObject newObject = SaveIsEasy.PrefabInstantiate(Prefab); newObject.transform.position = transform.position + new Vector3(Random.Range(-10, 10), 0, 0); } time += Time.deltaTime; }
void OnGUI() { if (GUI.Button(new Rect(10, 10, 150, 20), "Save Game")) { SaveIsEasy.SaveAll(); } if (GUI.Button(new Rect(10, 50, 150, 20), "Load Game")) { SaveIsEasy.LoadAll(true); } }
void OnGUI() { if (GUI.Button(new Rect(10, 10, 150, 20), "Save Game")) { SaveIsEasy.SaveAll(); } if (GUI.Button(new Rect(10, 50, 150, 20), "Load Game")) { SaveIsEasy.LoadAll(true); } GUI.Label(new Rect(10, 300, 200, 20), "Time: " + (int)time); }
public void OnApplicationQuit() { SaveIsEasy.SaveAll(); }