// --------------------------------------------------------------------- end Level select scene --------------------------------------------------------------------- // --------------------------------------------------------------------- game scene --------------------------------------------------------------------- public void Checkpoint(int checkpointId, Bag bag) { // Load data CharacterData characterData = LoadCharacter(); // Get checkpoint info // stage string stage = SceneManager.GetActiveScene().name; // time TimeGUI timeGUI = GameObject.FindObjectOfType(typeof(TimeGUI)) as TimeGUI; float time = timeGUI.GetTime(); // key, jewellery List <ItemColor> keys = bag.GetAllKeys(); Dictionary <ItemColor, int> jewellarys = bag.GetAllJewellarys(); // Store to character data CheckPoint checkpoint = new CheckPoint(); checkpoint.stage = stage; checkpoint.checkPointId = checkpointId; checkpoint.time = time; checkpoint.keys = keys; checkpoint.jewellarys = jewellarys; characterData.checkpoint = checkpoint; // Save SaveCharacter(characterData); }
private int finalScore; // time score + jewellery score public void UpdateGUI() { // Time TimeGUI timeGUI = Resources.FindObjectsOfTypeAll <TimeGUI>()[0] as TimeGUI; double time = System.Math.Round(timeGUI.GetTime(), 2); int idealTime = timeGUI.GetIdealTime(); timeText.text = time + "s"; int timeScore = idealTime * 1000; // 1st time category timeScore -= (int)((time - idealTime) * 1000); // time: 0s, 60s, 90s, 120s // score: 120000, 60000, 30000, 0 // Jewellery Bag bag = Resources.FindObjectsOfTypeAll <Bag>()[0] as Bag; Dictionary <ItemColor, int> jewellerys = bag.GetAllJewellarys(); ItemColor[] colors = ItemColor.GetValues(typeof(ItemColor)) as ItemColor[]; DisableJewelleryIcon(jewellerys); int jewelleryScore = GetJewelleryScore(jewellerys); // 2nd time category // score: 5000, 10000, 15000 // Final score finalScore = timeScore + jewelleryScore; // Update data GetComponent <BinaryCharacterSaver>().StageClear(finalScore); // int scoreAppendDigit = GetScoreAppendDigit(finalScore, 6); // 000000 // string scoreAppend = GetScoreAppendString(scoreAppendDigit); // scoreText.text = scoreAppend + finalScore; // buttons.SetActive(true); }