diff --git a/Assets/Scenes/MainGame.unity b/Assets/Scenes/MainGame.unity index 6ab5fc4..10c21e5 100644 --- a/Assets/Scenes/MainGame.unity +++ b/Assets/Scenes/MainGame.unity @@ -6171,6 +6171,11 @@ PrefabInstance: propertyPath: NextScene value: StraghtCorridor objectReference: {fileID: 0} + - target: {fileID: 3445185087018901932, guid: 1d0368ccaf6b0f6418f73a0180971465, + type: 3} + propertyPath: IsQuickTeleport + value: 1 + objectReference: {fileID: 0} - target: {fileID: 3445185087018901932, guid: 1d0368ccaf6b0f6418f73a0180971465, type: 3} propertyPath: noMovementChange @@ -10346,6 +10351,11 @@ PrefabInstance: propertyPath: NextScene value: StraghtCorridor objectReference: {fileID: 0} + - target: {fileID: 3445185087018901932, guid: 1d0368ccaf6b0f6418f73a0180971465, + type: 3} + propertyPath: IsQuickTeleport + value: 1 + objectReference: {fileID: 0} - target: {fileID: 3445185087018901932, guid: 1d0368ccaf6b0f6418f73a0180971465, type: 3} propertyPath: noMovementChange @@ -10756,6 +10766,11 @@ PrefabInstance: propertyPath: NextScene value: StraghtCorridor objectReference: {fileID: 0} + - target: {fileID: 3445185087018901932, guid: 1d0368ccaf6b0f6418f73a0180971465, + type: 3} + propertyPath: IsQuickTeleport + value: 1 + objectReference: {fileID: 0} - target: {fileID: 3445185087018901932, guid: 1d0368ccaf6b0f6418f73a0180971465, type: 3} propertyPath: noMovementChange diff --git a/Assets/Scripts/Utilities/Constant.cs b/Assets/Scripts/Utilities/Constant.cs index f9facb8..47564d0 100644 --- a/Assets/Scripts/Utilities/Constant.cs +++ b/Assets/Scripts/Utilities/Constant.cs @@ -8,9 +8,12 @@ namespace Assets.Scripts { class Constant { + public const string SEPARATOR = "-"; + // Files public const string FILE_PATH = ""; // DO NOT PUSH THIS, OR I KILL YOU... TWICE - public const string FILE_TIME = "TimeFile.txt"; + public const string FILE_TIME = "TimeFile"; + public const string FILE_EXTENSION = ".txt"; // Game Tag public const string GT_TARGET = "Target"; diff --git a/Assets/Scripts/Utilities/DataSaver.cs b/Assets/Scripts/Utilities/DataSaver.cs index 5b30356..e6d9afc 100644 --- a/Assets/Scripts/Utilities/DataSaver.cs +++ b/Assets/Scripts/Utilities/DataSaver.cs @@ -16,27 +16,33 @@ namespace Assets.Scripts.Utilities string movementName = ((MovementGen.ChoiceOfMovement)PlayerPrefs.GetInt(Constant.PPK_MOVEMENT_CHOICE)).ToString(); string time = PlayerPrefs.GetString(Constant.PPK_TIMER_TIME); string stage = PlayerPrefs.GetString(Constant.PPK_SCENE_NAME); - string toSave = movementName + " - " + playerName + " - " + stage + " - "+ time; + string toSave = movementName + Constant.SEPARATOR + playerName + Constant.SEPARATOR + stage + Constant.SEPARATOR + time; writeToFile(toSave); } - public static void SavePosition(List position) + public static void SavePosition(List positions) { - //TODO + string playerName = PlayerPrefs.GetString(Constant.PPK_PLAYER_NAME); + string movementName = ((MovementGen.ChoiceOfMovement)PlayerPrefs.GetInt(Constant.PPK_MOVEMENT_CHOICE)).ToString(); + string stage = PlayerPrefs.GetString(Constant.PPK_SCENE_NAME); + string fileName = movementName + Constant.SEPARATOR + playerName + Constant.SEPARATOR + stage; + writeToFile(positions, fileName); } private static async void writeToFile(string toSave) { - using StreamWriter file = new(Constant.FILE_PATH + Constant.FILE_TIME); - + using StreamWriter file = File.AppendText(Constant.FILE_PATH + Constant.FILE_TIME + Constant.FILE_EXTENSION); await file.WriteLineAsync(toSave); } - private static async void writeToFile(List toSave, string fileName) + private static async void writeToFile(List positions, string fileName) { - using StreamWriter file = new(Constant.FILE_PATH + fileName); + using StreamWriter file = File.AppendText(Constant.FILE_PATH + fileName + Constant.FILE_EXTENSION); - await file.WriteLineAsync(toSave); + foreach (Position pos in positions) + { + await file.WriteLineAsync(pos.ToString()); + } } } } diff --git a/Assets/Scripts/Utilities/Position.cs b/Assets/Scripts/Utilities/Position.cs index 083abe9..10d3b1d 100644 --- a/Assets/Scripts/Utilities/Position.cs +++ b/Assets/Scripts/Utilities/Position.cs @@ -1,19 +1,19 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Assets.Scripts.Utilities +namespace Assets.Scripts.Utilities { class Position { - private float x { get; set; }; - private float y { get; set; }; - public Position(x, y) + private float x { get; set; } + private float y { get; set; } + + public Position(float x, float y) { this.x = x; this.y = y; } + + public override string ToString() + { + return "[" + x.ToString() + "|" + y.ToString() + "]"; + } } }