public GameStatus(Ui_game_control canvas) { last_score = canvas.score; //Pobranie tablicy z gry for (int i = 0; i < score_tab_lenght; i++) { score_tab[i] = canvas.score_tab[i]; } //Dodanie wyniku for (int j = 0; j < score_tab_lenght; j++) { if (last_score > score_tab[j]) { for (int k = score_tab_lenght - 1; k > j; k--) { score_tab[k] = score_tab[k - 1]; } score_tab[j] = last_score; j = score_tab_lenght; } else if (last_score == score_tab[j]) { j = score_tab_lenght; } } }
//-------------------------------------------------------------------------------------------------------------------------------- public static void SaveStatus(Ui_game_control canvas) { string path = Application.persistentDataPath + "/Score.vsf"; BinaryFormatter formatter = new BinaryFormatter(); FileStream stream = new FileStream(path, FileMode.Create); GameStatus data = new GameStatus(canvas); formatter.Serialize(stream, data); stream.Close(); }
//---------------------------------------------------------------- void StartGame() { player_object = GameObject.Find("Player"); player = player_object.GetComponent <Player_control>(); Ui = canvas.GetComponent <Ui_game_control>(); map = map_prefab.GetComponent <Column_creator>(); column = column_prefab.GetComponent <Add_force>(); dir_light = directional_light.GetComponent <Light>(); time_introduction = 8; time_freeTime = -1; //Uniknięcie zrównania czasu po rozpocząciu gry event_num = 0; event_columnUp = 2; column_beforeEvent = 0; player.GetComponent <Player_control>().speed_max = 74; //Po rozgrzewce 80 ResetGameSetings(); play = true; time_beforeStart = (int)Time.time; }