mirror of
https://github.com/ConjureETS/MTI860_VR_Multi_Controller.git
synced 2026-03-25 13:01:15 +00:00
Refactor
This commit is contained in:
parent
f23ed304ba
commit
04d85e080b
@ -1,12 +1,11 @@
|
|||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
|
||||||
using Assets.Scripts;
|
|
||||||
using Assets.Scripts.Utilities;
|
using Assets.Scripts.Utilities;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.UI;
|
|
||||||
using static MovementGen;
|
|
||||||
using UnityEngine.SceneManagement;
|
using UnityEngine.SceneManagement;
|
||||||
|
using static Assets.Scripts.MovementGen;
|
||||||
|
|
||||||
|
namespace Assets.Scripts.HammerScript
|
||||||
|
{
|
||||||
public class Executable : MonoBehaviour
|
public class Executable : MonoBehaviour
|
||||||
{
|
{
|
||||||
public Timer timer;
|
public Timer timer;
|
||||||
@ -56,7 +55,7 @@ public class Executable : MonoBehaviour
|
|||||||
}
|
}
|
||||||
|
|
||||||
private int count = 0;
|
private int count = 0;
|
||||||
IEnumerator TimerExecute()
|
private IEnumerator TimerExecute()
|
||||||
{
|
{
|
||||||
count = 6;
|
count = 6;
|
||||||
while (true)
|
while (true)
|
||||||
@ -91,3 +90,4 @@ public class Executable : MonoBehaviour
|
|||||||
Debug.Log("Demon detected the colision");
|
Debug.Log("Demon detected the colision");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|||||||
@ -1,8 +1,8 @@
|
|||||||
using System.Collections;
|
using Assets.Scripts.Utilities;
|
||||||
using System.Collections.Generic;
|
|
||||||
using Assets.Scripts;
|
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace Assets.Scripts.HammerScript
|
||||||
|
{
|
||||||
public class HammerTrigger : MonoBehaviour
|
public class HammerTrigger : MonoBehaviour
|
||||||
{
|
{
|
||||||
// Start is called before the first frame update
|
// Start is called before the first frame update
|
||||||
@ -27,3 +27,4 @@ public class HammerTrigger : MonoBehaviour
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|||||||
@ -1,10 +1,11 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Assets.Scripts;
|
|
||||||
using Assets.Scripts.Movements;
|
using Assets.Scripts.Movements;
|
||||||
|
using Assets.Scripts.Utilities;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace Assets.Scripts
|
||||||
|
{
|
||||||
public class MovementGen : MonoBehaviour
|
public class MovementGen : MonoBehaviour
|
||||||
{
|
{
|
||||||
private Dictionary<ChoiceOfMovement, MonoBehaviour> components;
|
private Dictionary<ChoiceOfMovement, MonoBehaviour> components;
|
||||||
@ -65,3 +66,4 @@ public class MovementGen : MonoBehaviour
|
|||||||
omni = 4
|
omni = 4
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|||||||
@ -1,9 +1,8 @@
|
|||||||
using System;
|
|
||||||
using System.Collections;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using Random = System.Random;
|
using Random = System.Random;
|
||||||
|
|
||||||
|
namespace Assets.Scripts
|
||||||
|
{
|
||||||
public class RandomDemonSpawn : MonoBehaviour
|
public class RandomDemonSpawn : MonoBehaviour
|
||||||
{
|
{
|
||||||
public GameObject[] listeCommeTuVeux;
|
public GameObject[] listeCommeTuVeux;
|
||||||
@ -24,3 +23,4 @@ public class RandomDemonSpawn : MonoBehaviour
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|||||||
@ -1,12 +1,6 @@
|
|||||||
using System;
|
namespace Assets.Scripts.Utilities
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace Assets.Scripts
|
|
||||||
{
|
{
|
||||||
class Constant
|
public class Constant
|
||||||
{
|
{
|
||||||
public const string SEPARATOR = "-";
|
public const string SEPARATOR = "-";
|
||||||
|
|
||||||
|
|||||||
@ -1,14 +1,10 @@
|
|||||||
using System;
|
using System.Collections.Generic;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
namespace Assets.Scripts.Utilities
|
namespace Assets.Scripts.Utilities
|
||||||
{
|
{
|
||||||
class DataSaver
|
public class DataSaver
|
||||||
{
|
{
|
||||||
public static void SaveTime()
|
public static void SaveTime()
|
||||||
{
|
{
|
||||||
@ -17,7 +13,7 @@ namespace Assets.Scripts.Utilities
|
|||||||
string time = PlayerPrefs.GetString(Constant.PPK_TIMER_TIME);
|
string time = PlayerPrefs.GetString(Constant.PPK_TIMER_TIME);
|
||||||
string stage = PlayerPrefs.GetString(Constant.PPK_SCENE_NAME);
|
string stage = PlayerPrefs.GetString(Constant.PPK_SCENE_NAME);
|
||||||
string toSave = movementName + Constant.SEPARATOR + playerName + Constant.SEPARATOR + stage + Constant.SEPARATOR + time;
|
string toSave = movementName + Constant.SEPARATOR + playerName + Constant.SEPARATOR + stage + Constant.SEPARATOR + time;
|
||||||
writeToFile(toSave);
|
WriteToFile(toSave);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void SavePosition(List<Position> positions)
|
public static void SavePosition(List<Position> positions)
|
||||||
@ -25,17 +21,17 @@ namespace Assets.Scripts.Utilities
|
|||||||
string playerName = PlayerPrefs.GetString(Constant.PPK_PLAYER_NAME);
|
string playerName = PlayerPrefs.GetString(Constant.PPK_PLAYER_NAME);
|
||||||
string movementName = ((MovementGen.ChoiceOfMovement)PlayerPrefs.GetInt(Constant.PPK_MOVEMENT_CHOICE)).ToString();
|
string movementName = ((MovementGen.ChoiceOfMovement)PlayerPrefs.GetInt(Constant.PPK_MOVEMENT_CHOICE)).ToString();
|
||||||
string stage = PlayerPrefs.GetString(Constant.PPK_SCENE_NAME);
|
string stage = PlayerPrefs.GetString(Constant.PPK_SCENE_NAME);
|
||||||
string fileName = movementName + Constant.SEPARATOR + playerName + Constant.SEPARATOR + stage;
|
string fileName = "position" + Constant.SEPARATOR + movementName + Constant.SEPARATOR + playerName + Constant.SEPARATOR + stage;
|
||||||
writeToFile(positions, fileName);
|
WriteToFile(positions, fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static async void writeToFile(string toSave)
|
private static async void WriteToFile(string toSave)
|
||||||
{
|
{
|
||||||
using StreamWriter file = File.AppendText(Constant.FILE_PATH + Constant.FILE_TIME + Constant.FILE_EXTENSION);
|
using StreamWriter file = File.AppendText(Constant.FILE_PATH + Constant.FILE_TIME + Constant.FILE_EXTENSION);
|
||||||
await file.WriteLineAsync(toSave);
|
await file.WriteLineAsync(toSave);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static async void writeToFile(List<Position> positions, string fileName)
|
private static async void WriteToFile(List<Position> positions, string fileName)
|
||||||
{
|
{
|
||||||
using StreamWriter file = File.AppendText(Constant.FILE_PATH + fileName + Constant.FILE_EXTENSION);
|
using StreamWriter file = File.AppendText(Constant.FILE_PATH + fileName + Constant.FILE_EXTENSION);
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
namespace Assets.Scripts.Utilities
|
namespace Assets.Scripts.Utilities
|
||||||
{
|
{
|
||||||
class Position
|
public class Position
|
||||||
{
|
{
|
||||||
private float x { get; set; }
|
private float x { get; set; }
|
||||||
private float y { get; set; }
|
private float y { get; set; }
|
||||||
|
|||||||
@ -1,8 +1,9 @@
|
|||||||
using Assets.Scripts.Utilities;
|
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace Assets.Scripts.Utilities
|
||||||
|
{
|
||||||
public class PositionManager : MonoBehaviour
|
public class PositionManager : MonoBehaviour
|
||||||
{
|
{
|
||||||
public GameObject player;
|
public GameObject player;
|
||||||
@ -38,3 +39,4 @@ public class PositionManager : MonoBehaviour
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|||||||
@ -1,9 +1,8 @@
|
|||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
|
||||||
using Assets.Scripts;
|
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.UI;
|
|
||||||
|
|
||||||
|
namespace Assets.Scripts.Utilities
|
||||||
|
{
|
||||||
public class Timer : MonoBehaviour
|
public class Timer : MonoBehaviour
|
||||||
{
|
{
|
||||||
private float time { get; set; }
|
private float time { get; set; }
|
||||||
@ -51,3 +50,4 @@ public class Timer : MonoBehaviour
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user