private void Update() { if (Input.GetKeyDown(createKey)) { CreateShape(); } else if (Input.GetKeyDown(destroyKey)) { DestroyShape(); } else if (Input.GetKey(newGameKey)) { BeginNewGame(); } else if (Input.GetKeyDown(saveKey)) { storage.Save(this, saveVersion); } else if (Input.GetKeyDown(loadKey)) { storage.Load(this); } creationProgress += Time.deltaTime * CreationSpeed; while (creationProgress >= 1.0f) { creationProgress -= 1.0f; CreateShape(); } destructionprogress += Time.deltaTime * DestructionSpeed; while (destructionprogress >= 1f) { destructionprogress -= 1.0f; DestroyShape(); } }
private void Update() { if (Input.GetKeyDown(createKey)) { CreateShape(); } else if (Input.GetKeyDown(newGameKey)) { BeginNewGame(); StartCoroutine(LoadLevel(_loadedLevelIndex)); } else if (Input.GetKeyDown(saveKey)) { storage.Save(this, SAVE_VERSION); } else if (Input.GetKeyDown(loadKey)) { BeginNewGame(); storage.Load(this); } else if (Input.GetKeyDown(destroyKey)) { DestroyShape(); } else { for (int i = 1; i <= levelCount; i++) { if (Input.GetKeyDown(KeyCode.Alpha0 + i)) { BeginNewGame(); StartCoroutine(LoadLevel(i)); return; } } } }
void Update() { if (Input.GetKeyDown(createKey)) { GameLevel.Current.SpawnShapes(); } else if (Input.GetKeyDown(destroyKey)) { DestroyShape(); } else if (Input.GetKeyDown(newGameKey)) { BeginNewGame(); StartCoroutine(LoadLevel(loadedLevelBuildIndex)); } else if (Input.GetKeyDown(saveKey)) { storage.Save(this, saveVersion); } else if (Input.GetKeyDown(loadKey)) { BeginNewGame(); storage.Load(this); } else { for (int i = 1; i <= levelCount; i++) { if (Input.GetKeyDown(KeyCode.Alpha0 + i)) { BeginNewGame(); StartCoroutine(LoadLevel(i)); return; } } } }
// Update is called once per frame void Update() { if (Input.GetKeyDown(createKey)) { CreateShape(); } else if (Input.GetKeyDown(destroyKey)) { DestroyShape(); } else if (Input.GetKey(newGameKey)) { BeginNewGame(); StartCoroutine(LoadLevel(loadedLevelBuildIndex)); } else if (Input.GetKeyDown(saveKey)) { storage.Save(this, saveVersion); } else if (Input.GetKeyDown(loadKey)) { BeginNewGame(); storage.Load(this); } else { for (int i = 0; i <= levelCount; ++i) { if (Input.GetKeyDown(KeyCode.Alpha0 + i)) { BeginNewGame(); StartCoroutine(LoadLevel(i)); } } } }
void Update() { if (Input.GetKey(createKey)) { CreateShape(); } if (Input.GetKey(destroyKey)) { DestroyShape(); } if (Input.GetKey(newGameKey)) { BeginNewGame(); } if (Input.GetKeyDown(saveKey)) { storage.Save(this, saveVersion); } if (Input.GetKeyDown(loadKey)) { BeginNewGame(); storage.Load(this); } creationProgress += Time.deltaTime * CreationSlider.value * 100f; destructionProgress += Time.deltaTime * DestructionSlider.value * 100f; if (creationProgress >= 1f) { creationProgress -= 1f; CreateShape(); } if (destructionProgress >= 1f) { destructionProgress -= 1f; DestroyShape(); } }
private void Update() { //Creating new cubes on keyinput - c if (Input.GetKeyDown(createKey)) { CreateObjects(); } //starting a new game else if (Input.GetKeyDown(newGameKey)) { BeginNewGame(); } //saving the game else if (Input.GetKeyDown(saveKey)) { storage.Save(this); } //loading form saved file else if (Input.GetKeyDown(loadKey)) { BeginNewGame(); storage.Load(this); } }
private void Update() { if (Input.GetKey(createKey)) { CreateShape(); } else if (Input.GetKeyDown(destroyKey)) { DestroyShape(); } else if (Input.GetKeyDown(newGameKey)) { BeginNewGame(); } else if (Input.GetKeyDown(saveKey)) { storage.Save(this, saveVersion); } else if (Input.GetKeyDown(loadKey)) { BeginNewGame(); storage.Load(this); } }
protected void Save() { _storage.Save(_grid); PlayerPrefs.SetInt(PlayerPrefKeys.HasGameInProgress, _grid.IsEmpty ? 0 : 1); PlayerPrefs.Save(); }
public void HandleShipDestroy() { StopGame(); PersistentStorage.Save(this); }
private void FixedUpdate() { inGameUpdateLoop = true; for (int i = 0; i < shapes.Count; i++) { shapes[i].GameUpdate(); } inGameUpdateLoop = false; #region KeyControls //куча ифов для кнопок if (Input.GetKey(createKey)) { GameLevel.Current.SpawnShapes(); } else if (Input.GetKey(destroyKey)) { DestroyShape(); } else if (Input.GetKeyDown(newGameKey)) { BeginNewGame(); StartCoroutine(LoadLevel(loadedLevelBuildIndex)); } else if (Input.GetKeyDown(saveGameKey)) { storage.Save(this, saveVersion); } else if (Input.GetKeyDown(loadGameKey)) { BeginNewGame(); storage.Load(this); } else { for (int i = 1; i <= levelCount; i++) { if (Input.GetKeyDown(KeyCode.Alpha0 + i)) { BeginNewGame(); StartCoroutine(LoadLevel(i)); return; } } } #endregion //Управление скоростью создания шейпов creationProgress += Time.deltaTime * CreationSpeed; while (creationProgress >= 1f) { creationProgress -= 1f; GameLevel.Current.SpawnShapes(); } //управление скоростью разрушения шейпов destructionProgress += Time.deltaTime * DestructionSpeed; while (destructionProgress >= 1f) { destructionProgress -= 1f; DestroyShape(); } int limit = GameLevel.Current.PopulationLimit; if (limit > 0) { while (shapes.Count - dyingShapeCount > limit) { DestroyShape(); } } if (killList.Count > 0) { for (int i = 0; i < killList.Count; i++) { if (killList[i].IsValid) { KillImmediately(killList[i].Shape); } } killList.Clear(); } if (markAsDyingList.Count > 0) { for (int i = 0; i < markAsDyingList.Count; i++) { if (markAsDyingList[i].IsValid) { MarkAsDyingImmediately(markAsDyingList[i].Shape); } } markAsDyingList.Clear(); } }
private void SaveGame() { _storage.Save(this); }
public void Save() { storage.Save(this, SaveVersion); }