Adding Position

This commit is contained in:
Davcris911 2021-11-12 11:55:21 -05:00
parent fbb8e46f22
commit 43f48e9d5c
8 changed files with 76 additions and 8 deletions

View File

@ -38,7 +38,7 @@ RenderSettings:
m_ReflectionIntensity: 1
m_CustomReflection: {fileID: 0}
m_Sun: {fileID: 705507994}
m_IndirectSpecularColor: {r: 0.18028378, g: 0.22571412, b: 0.30692285, a: 1}
m_IndirectSpecularColor: {r: 0.18028334, g: 0.2257134, b: 0.30692226, a: 1}
m_UseRadianceAmbientProbe: 0
--- !u!157 &3
LightmapSettings:
@ -10572,6 +10572,11 @@ PrefabInstance:
m_Modification:
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 2077104797511503972, guid: cdbac44d9cb15a04684f19dd29e2f2db,
type: 3}
propertyPath: nomDuJoueur
value:
objectReference: {fileID: 0}
- target: {fileID: 3224832257380790144, guid: cdbac44d9cb15a04684f19dd29e2f2db,
type: 3}
propertyPath: m_LocalPosition.x

View File

@ -37,13 +37,15 @@ public class Executable : MonoBehaviour
{
timer.Stop();
}
if (!noMovementChange)
{
PlayerPrefs.SetInt(Constant.PPK_MOVEMENT_CHOICE, (int)nextMouv);
}
if (IsQuickTeleport)
{
SceneManager.LoadScene(NextScene);
LoadScene();
}
else
{
@ -70,14 +72,20 @@ public class Executable : MonoBehaviour
yield return new WaitForSeconds(1.5f);
DataSaver.SaveTime();
if (count <= 0)
if (count <= 0)
{
SceneManager.LoadScene(NextScene);
LoadScene();
}
}
}
private void LoadScene()
{
PlayerPrefs.SetString(Constant.PPK_SCENE_NAME, NextScene);
SceneManager.LoadScene(NextScene);
}
private void OnTriggerEnter(Collider other)
{
Debug.Log("Demon detected the colision");

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 4f1d4bc46e609714da5be82a80838718
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -9,6 +9,7 @@ namespace Assets.Scripts
class Constant
{
// Files
public const string FILE_PATH = ""; // DO NOT PUSH THIS, OR I KILL YOU... TWICE
public const string FILE_TIME = "TimeFile.txt";
// Game Tag
@ -19,5 +20,6 @@ namespace Assets.Scripts
public const string PPK_PLAYER_NAME = "PlayerName";
public const string PPK_TIMER_TIME = "Time";
public const string PPK_MOVEMENT_CHOICE = "mouvement";
public const string PPK_SCENE_NAME = "scene";
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 22e6602b147a64c4994b68f0cf5c45f6
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -12,22 +12,31 @@ namespace Assets.Scripts.Utilities
{
public static void SaveTime()
{
//Nom du mouvement - Nom du joueur - Stage - Temps d'exécution
string playerName = PlayerPrefs.GetString(Constant.PPK_PLAYER_NAME);
string movementName = ((MovementGen.ChoiceOfMovement)PlayerPrefs.GetInt(Constant.PPK_MOVEMENT_CHOICE)).ToString();
string time = PlayerPrefs.GetString(Constant.PPK_TIMER_TIME);
string stage = ""; // TODO
string stage = PlayerPrefs.GetString(Constant.PPK_SCENE_NAME);
string toSave = movementName + " - " + playerName + " - " + stage + " - "+ time;
writeToFile(toSave);
}
public static void SavePosition()
{
//TODO
}
private static async void writeToFile(string toSave)
{
using StreamWriter file = new(Constant.FILE_TIME);
using StreamWriter file = new(Constant.FILE_PATH + Constant.FILE_TIME);
await file.WriteLineAsync(toSave);
}
// TODO writeToFile(toSave, fileName) pour les positions
private static async void writeToFile(List<float, float> toSave, string fileName)
{
using StreamWriter file = new(Constant.FILE_PATH + fileName);
await file.WriteLineAsync(toSave);
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: a130981115fac9f4bbf97cd9559e28f9
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Assets.Scripts.Utilities
{
class Position
{
private float x;
private float y;
}
}