Fix Save Position

This commit is contained in:
Davcris911 2021-11-16 11:51:54 -05:00
parent e38c1e02b2
commit 5970ed0b56
9 changed files with 188 additions and 193 deletions

View File

@ -1,5 +1,101 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &866662310
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 866662311}
- component: {fileID: 866662314}
- component: {fileID: 866662313}
- component: {fileID: 866662312}
m_Layer: 0
m_Name: Plane
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &866662311
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 866662310}
m_LocalRotation: {x: 0, y: 1, z: 0, w: 0}
m_LocalPosition: {x: 0, y: -0.37, z: 0}
m_LocalScale: {x: 0.127872, y: 0.127872, z: 0.127872}
m_Children: []
m_Father: {fileID: 3224832258464791432}
m_RootOrder: 3
m_LocalEulerAnglesHint: {x: 0, y: 180, z: 0}
--- !u!33 &866662314
MeshFilter:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 866662310}
m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0}
--- !u!23 &866662313
MeshRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 866662310}
m_Enabled: 1
m_CastShadows: 1
m_ReceiveShadows: 1
m_DynamicOccludee: 1
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RayTracingMode: 2
m_RayTraceProcedural: 0
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 2100000, guid: aa1eec9c654548245a1d75ba943948bf, type: 2}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_ReceiveGI: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 1
m_SelectedEditorRenderState: 3
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
m_AdditionalVertexStreams: {fileID: 0}
--- !u!64 &866662312
MeshCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 866662310}
m_Material: {fileID: 0}
m_IsTrigger: 0
m_Enabled: 1
serializedVersion: 4
m_Convex: 0
m_CookingOptions: 30
m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0}
--- !u!54 &3224832258631850785
Rigidbody:
m_ObjectHideFlags: 0
@ -230,13 +326,13 @@ Transform:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3224832257380790172}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: -2.183372, y: 1.2589163, z: 7.74}
m_LocalRotation: {x: -0.34606773, y: 0.000000029802326, z: -0.000000014901163, w: 0.9382096}
m_LocalPosition: {x: -2.18, y: 6.13, z: 9.72}
m_LocalScale: {x: 0.1, y: 0.1, z: 0.1}
m_Children: []
m_Father: {fileID: 8406466218123916952}
m_RootOrder: 4
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_LocalEulerAnglesHint: {x: -40.494, y: 0, z: 0}
--- !u!23 &3224832257380790147
MeshRenderer:
m_ObjectHideFlags: 0
@ -509,6 +605,7 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
selectedMovement: 1
nomDuJoueur:
--- !u!114 &2391299249491222016
MonoBehaviour:
m_ObjectHideFlags: 0
@ -522,9 +619,9 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
body: {fileID: 2949611238048620088}
constSpeed: 2
constRotation: 150
constUpForce: 5
constSpeed: 1
constRotation: 10
constUpForce: 1
--- !u!114 &2775598781587958943
MonoBehaviour:
m_ObjectHideFlags: 0
@ -599,6 +696,7 @@ Transform:
- {fileID: 3228749051654165582}
- {fileID: 3224832257896867138}
- {fileID: 3224832257380790144}
- {fileID: 3560371174872971450}
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
@ -652,6 +750,51 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 371259076e90d4644bd42d907733d382, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!1 &6910216944072203754
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 3560371174872971450}
- component: {fileID: 3881387924960372470}
m_Layer: 0
m_Name: PositionManager
m_TagString: Djigby
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &3560371174872971450
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6910216944072203754}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 1.2181025, y: 1.6419162, z: -0.77703667}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 8406466218123916952}
m_RootOrder: 5
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &3881387924960372470
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6910216944072203754}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 350cae5776b138d4795c1003647b50b1, type: 3}
m_Name:
m_EditorClassIdentifier:
player: {fileID: 3224832258464819110}
dataSend: 0
--- !u!1001 &3224832256724492204
PrefabInstance:
m_ObjectHideFlags: 0

View File

@ -1881,12 +1881,6 @@ Transform:
type: 3}
m_PrefabInstance: {fileID: 371749250}
m_PrefabAsset: {fileID: 0}
--- !u!4 &372387525 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 3224832258464791432, guid: cdbac44d9cb15a04684f19dd29e2f2db,
type: 3}
m_PrefabInstance: {fileID: 3224832256689880466}
m_PrefabAsset: {fileID: 0}
--- !u!1 &382210521
GameObject:
m_ObjectHideFlags: 0
@ -4378,102 +4372,6 @@ Transform:
type: 3}
m_PrefabInstance: {fileID: 296603246}
m_PrefabAsset: {fileID: 0}
--- !u!1 &866662310
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 866662311}
- component: {fileID: 866662314}
- component: {fileID: 866662313}
- component: {fileID: 866662312}
m_Layer: 0
m_Name: Plane
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &866662311
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 866662310}
m_LocalRotation: {x: 0, y: 1, z: 0, w: 0}
m_LocalPosition: {x: 0, y: -0.37, z: 0}
m_LocalScale: {x: 0.127872, y: 0.127872, z: 0.127872}
m_Children: []
m_Father: {fileID: 372387525}
m_RootOrder: 3
m_LocalEulerAnglesHint: {x: 0, y: 180, z: 0}
--- !u!64 &866662312
MeshCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 866662310}
m_Material: {fileID: 0}
m_IsTrigger: 0
m_Enabled: 1
serializedVersion: 4
m_Convex: 0
m_CookingOptions: 30
m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0}
--- !u!23 &866662313
MeshRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 866662310}
m_Enabled: 1
m_CastShadows: 1
m_ReceiveShadows: 1
m_DynamicOccludee: 1
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RayTracingMode: 2
m_RayTraceProcedural: 0
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 2100000, guid: aa1eec9c654548245a1d75ba943948bf, type: 2}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_ReceiveGI: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 1
m_SelectedEditorRenderState: 3
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
m_AdditionalVertexStreams: {fileID: 0}
--- !u!33 &866662314
MeshFilter:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 866662310}
m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0}
--- !u!1001 &867679824
PrefabInstance:
m_ObjectHideFlags: 0
@ -12007,66 +11905,6 @@ PrefabInstance:
m_Modification:
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 2077104797511503972, guid: cdbac44d9cb15a04684f19dd29e2f2db,
type: 3}
propertyPath: nomDuJoueur
value:
objectReference: {fileID: 0}
- target: {fileID: 2391299249491222016, guid: cdbac44d9cb15a04684f19dd29e2f2db,
type: 3}
propertyPath: constSpeed
value: 1
objectReference: {fileID: 0}
- target: {fileID: 2391299249491222016, guid: cdbac44d9cb15a04684f19dd29e2f2db,
type: 3}
propertyPath: constUpForce
value: 1
objectReference: {fileID: 0}
- target: {fileID: 2391299249491222016, guid: cdbac44d9cb15a04684f19dd29e2f2db,
type: 3}
propertyPath: constRotation
value: 10
objectReference: {fileID: 0}
- target: {fileID: 3224832257380790144, guid: cdbac44d9cb15a04684f19dd29e2f2db,
type: 3}
propertyPath: m_LocalPosition.x
value: -2.18
objectReference: {fileID: 0}
- target: {fileID: 3224832257380790144, guid: cdbac44d9cb15a04684f19dd29e2f2db,
type: 3}
propertyPath: m_LocalPosition.y
value: 6.13
objectReference: {fileID: 0}
- target: {fileID: 3224832257380790144, guid: cdbac44d9cb15a04684f19dd29e2f2db,
type: 3}
propertyPath: m_LocalPosition.z
value: 9.72
objectReference: {fileID: 0}
- target: {fileID: 3224832257380790144, guid: cdbac44d9cb15a04684f19dd29e2f2db,
type: 3}
propertyPath: m_LocalRotation.w
value: 0.9382096
objectReference: {fileID: 0}
- target: {fileID: 3224832257380790144, guid: cdbac44d9cb15a04684f19dd29e2f2db,
type: 3}
propertyPath: m_LocalRotation.x
value: -0.34606773
objectReference: {fileID: 0}
- target: {fileID: 3224832257380790144, guid: cdbac44d9cb15a04684f19dd29e2f2db,
type: 3}
propertyPath: m_LocalRotation.y
value: 0.000000029802326
objectReference: {fileID: 0}
- target: {fileID: 3224832257380790144, guid: cdbac44d9cb15a04684f19dd29e2f2db,
type: 3}
propertyPath: m_LocalRotation.z
value: -0.000000014901163
objectReference: {fileID: 0}
- target: {fileID: 3224832257380790144, guid: cdbac44d9cb15a04684f19dd29e2f2db,
type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: -40.494
objectReference: {fileID: 0}
- target: {fileID: 4216049522789318228, guid: cdbac44d9cb15a04684f19dd29e2f2db,
type: 3}
propertyPath: m_Name

View File

@ -15,6 +15,7 @@ namespace Assets.Scripts.HammerScript
public ChoiceOfMovement nextMouv;
public MovementGen target;
public PositionManager positionManager;
public bool noMovementChange = true;
public bool changeMouvementForPractice = false;
@ -26,6 +27,8 @@ namespace Assets.Scripts.HammerScript
void Start()
{
positionManager = GameObject.FindGameObjectsWithTag("Djigby")[0].GetComponent<PositionManager>();
//Set the tag of this GameObject to Player
gameObject.tag = Constant.GT_TARGET;
if(noMovementChange)
@ -55,7 +58,6 @@ namespace Assets.Scripts.HammerScript
else if (changeMouvementForPractice)
{
StartCoroutine("Practice");
//LoadChangeMouvement();
}
else
{
@ -68,12 +70,14 @@ namespace Assets.Scripts.HammerScript
private int count = 0;
private IEnumerator TimerExecute()
{
count = 6;
count = 4;
positionManager.StopSavingPosition();
while (true)
{
count--;
if (text != null) {
if (count >= 0)
if (count > 0)
text.text = "" + count;
else
text.text = "Done";
@ -83,6 +87,7 @@ namespace Assets.Scripts.HammerScript
if (count <= 0)
{
DataSaver.SaveTime();
DataSaver.SavePosition(positionManager.SendData());
LoadScene();
}
}
@ -109,7 +114,7 @@ namespace Assets.Scripts.HammerScript
private void OnTriggerEnter(Collider other)
{
Debug.Log("Demon detected the colision");
//Debug.Log("Demon detected the colision");
}
}
}

View File

@ -19,7 +19,7 @@ namespace Assets.Scripts.HammerScript
private void OnTriggerEnter(Collider other)
{
Debug.Log("Hammer detected the colision");
//Debug.Log("Hammer detected the colision");
if (other.gameObject.tag == Constant.GT_TARGET)
{
Executable ex = other.gameObject.GetComponent("Executable") as Executable;

View File

@ -30,7 +30,7 @@ namespace Assets.Scripts
if (nomDuJoueur == string.Empty)
{
nomDuJoueur = DateTime.Now.ToString("MM-dd HH:mm");
nomDuJoueur = DateTime.Now.ToString("YYYY-MM-dd_HH-mm");
}
PlayerPrefs.SetString(Constant.PPK_PLAYER_NAME, nomDuJoueur);
}

View File

@ -1,4 +1,5 @@
using System.Collections.Generic;
using System;
using System.Collections.Generic;
using System.IO;
using UnityEngine;
@ -21,7 +22,8 @@ namespace Assets.Scripts.Utilities
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 = "position " + Constant.SEPARATOR + " " + movementName + " " + Constant.SEPARATOR + " " + playerName + " " + Constant.SEPARATOR + " " + stage;
string fileName = "position" + Constant.SEPARATOR + movementName + Constant.SEPARATOR + playerName + Constant.SEPARATOR + stage;
Debug.Log("Position name : "+ fileName);
WriteToFile(positions, fileName);
}
@ -33,7 +35,7 @@ namespace Assets.Scripts.Utilities
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 + Constant.FILE_INSIDE_PROJECT_PATH + fileName + Constant.FILE_EXTENSION);
foreach (Position pos in positions)
{

View File

@ -8,13 +8,14 @@ namespace Assets.Scripts.Utilities
{
public GameObject player;
private List<Position> data;
public bool notSended = true;
public bool dataSend = false;
// Start is called before the first frame update
void Start()
{
data = new List<Position>();
StartCoroutine("TackerExecute");
gameObject.tag = "Djigby";
}
// Update is called once per frame
@ -23,19 +24,24 @@ namespace Assets.Scripts.Utilities
}
IEnumerator TackerExecute()
{
while (notSended)
while (!dataSend)
{
data.Add(new Position(player.transform.position.x, player.transform.position.y));
data.Add(new Position(player.transform.position.x, player.transform.position.z));
yield return new WaitForSeconds(1.0f);
}
}
public void sendData()
public void StopSavingPosition()
{
notSended = false;
DataSaver.SavePosition(data);
dataSend = true;
}
public List<Position> SendData()
{
dataSend = true;
return data;
}
}

View File

@ -7,6 +7,7 @@ TagManager:
- TeleportationScriptsList
- Target
- Hammer
- Djigby
layers:
- Default
- TransparentFX

View File

@ -15,22 +15,22 @@ EditorUserSettings:
value: 22424703114646680e0b0227036c75191b1a011a20293f373f26083de6ae2136ebf32f
flags: 0
RecentlyUsedScenePath-3:
value: 22424703114646680e0b0227036c731500121465181b2e313d2c3e3cf0f23d3cedf578fce9332b25
flags: 0
RecentlyUsedScenePath-4:
value: 22424703114646680e0b0227036c7315001214651f1b2e313d2c3e3cf0f23d3cedf578fce9332b25
flags: 0
RecentlyUsedScenePath-5:
value: 22424703114646680e0b0227036c7b11001e1c1a20293f373f26083de6ae2136ebf32f
flags: 0
RecentlyUsedScenePath-6:
RecentlyUsedScenePath-4:
value: 22424703114646680e0b0227036c7315001214651f3c34312a210910edf22631e6e824a7f234362820
flags: 0
RecentlyUsedScenePath-5:
value: 22424703114646680e0b0227036c7315001214651f1b2e313d2c3e3cf0f23d3cedf578fce9332b25
flags: 0
RecentlyUsedScenePath-6:
value: 22424703114646680e0b0227036c731500121465181b2e313d2c3e3cf0f23d3cedf578fce9332b25
flags: 0
RecentlyUsedScenePath-7:
value: 22424703114646680e0b0227036c731500121465032a35242c2a1136cbee1931e6e33aeca92f31352d1b
value: 22424703114646680e0b0227036c73150012146501293c35633c133af6f9
flags: 0
RecentlyUsedScenePath-8:
value: 22424703114646680e0b0227036c73150012146501293c35633c133af6f9
value: 22424703114646680e0b0227036c731500121465032a35242c2a1136cbee1931e6e33aeca92f31352d1b
flags: 0
RecentlyUsedScenePath-9:
value: 22424703114646680e0b0227036c72111f193f2b212d68252320092a