void ChangeSceneForNew() { BinaryFormatter bf = new BinaryFormatter(); FileStream file = File.Open(deviceFileLocation, FileMode.Open); PlayerSlotData data = (PlayerSlotData)bf.Deserialize(file); file.Close(); data.slotType = notEmptySlot; data.maxMap = GameStructure.maxMap; data.mapResults = new MapResultData[GameStructure.maxMap]; data.onLevel = GameStructure.startLevel; for (int i = 0; i < data.mapResults.Length; i++) { data.mapResults[i] = new MapResultData(); } data.speed = SharedData.basicSpeed; FileStream fileForSave = File.Create(deviceFileLocation); bf.Serialize(fileForSave, data); fileForSave.Close(); for (int i = 0; i < GameStructure.maxMap; i++) { gmdata.Add(new MapResultData()); } CurrentGameDatas.savedSpeed = SharedData.basicSpeed; CurrentGameDatas.speed = SharedData.basicSpeed; CurrentGameDatas.CopyTheDatas(gmdata, deviceFileLocation); SceneLoader.LoadGuideAndSetMode(); }
public void LoadSceneAndSaveSpeed() { if (CurrentGameDatas.savedSpeed != CurrentGameDatas.speed) { CurrentGameDatas.SaveSpeed(); } SceneManager.LoadScene(GameStructure.GetLevelName()); }
void ChangeSceneLoad() { CurrentGameDatas.savedSpeed = savedSpeed; CurrentGameDatas.speed = savedSpeed; CurrentGameDatas.ItemCount = summKeys + summGems + summRelic; CurrentGameDatas.CopyTheDatas(gmdata, deviceFileLocation); CurrentGameDatas.onLevel = onLevel; SceneLoader.LoadGuideAndSetMode(); }
public void GoMyMap() { if (mapNumber != CurrentGameDatas.GetActualLevelLastMapNumber()) { SceneLoader.LoadMapTimeScaleUsed(mapNumber); } else if (CurrentGameDatas.ItemCount >= CurrentGameDatas.GetActualLevelLastMapNumber() - 1) { SceneLoader.LoadMapTimeScaleUsed(mapNumber); } }
public override void ChangeLevel() { if (PreparLevel.SwitchLevelFromHigher) { return; } PreparLevel.SwitchLevelFromLower = true; CurrentGameDatas.onLevel++; CurrentGameDatas.SaveLevel(); SceneManager.LoadScene(GameStructure.GetLevelName()); }
void OpenGate(int i) { if (Gate.transform.childCount - 1 < i) { return; } if ((i + CurrentGameDatas.GetActualLevelFirstMapNumber() == ActualMapData.mapNumber - 1) && (ActualMapData.HawNewItem)) { Gate.transform.GetChild(i).GetComponent <OpenGate>().OpenGateNew(); } else { Gate.transform.GetChild(i).GetComponent <OpenGate>().OpenGateInstantly(); } }
void Start() { Time.timeScale = SharedData.basicSpeed; if (levelUpButton != null && CurrentGameDatas.GetActualLevelLastMapNumber() <= CurrentGameDatas.ItemCount && CurrentGameDatas.onLevel != GameStructure.maxLevel) { levelUpButton.interactable = true; } int mapsNumber = CurrentGameDatas.GetActualLevelMapCount(); int firstLevelNumber = CurrentGameDatas.GetActualLevelFirstMapNumber(); int j = 0; for (int i = firstLevelNumber; i < firstLevelNumber + mapsNumber; i++) { gmdatas.Add(new MapResultData(CurrentGameDatas.mapDatas[i].Score, CurrentGameDatas.mapDatas[i].Scarab, CurrentGameDatas.mapDatas[i].Item, CurrentGameDatas.mapDatas[i].ItemType)); if (CurrentGameDatas.mapDatas[i].Item == SharedData.HaveItemNumber) { if (CurrentGameDatas.mapDatas[i].ItemType == SharedData.KeyType) { KeySpam(j); } else if (CurrentGameDatas.mapDatas[i].ItemType == SharedData.GemType) { GemSpam(j); } else { RelicSpam(j); } OpenGate(j); } j++; } ScoreMake(); EndCheck(); }