Added save & load scene + save & load player position functionalities

This commit is contained in:
alilas2 2022-06-02 14:25:22 +02:00
parent 8c16a13561
commit 6d7760c120
10 changed files with 330 additions and 36 deletions

View File

@ -67,6 +67,7 @@
<Compile Include="Assets\Scripts\DoorBehaviour.cs" />
<Compile Include="Assets\Scripts\Enemies&apos; Scprits\PatrollingEnemy.cs" />
<Compile Include="Assets\Scripts\ChangeScene.cs" />
<Compile Include="Assets\Scripts\SaveController.cs" />
<Compile Include="Assets\NPCDialogue.cs" />
<Compile Include="Assets\Scripts\Player.cs" />
<None Include="Assets\TextMesh Pro\Shaders\TMPro.cginc" />
@ -658,94 +659,94 @@
<HintPath>C:/Program Files/Unity/Hub/Editor/2020.3.32f1/Editor/Data/NetStandard/compat/2.0.0/shims/netfx/System.Xml.Serialization.dll</HintPath>
</Reference>
<Reference Include="Unity.2D.Animation.Editor">
<HintPath>C:/Users/alicj/Desktop/newest/Scriptum/Library/ScriptAssemblies/Unity.2D.Animation.Editor.dll</HintPath>
<HintPath>C:/Users/alicj/Desktop/AnotherSaveAttempt/Scriptum/Library/ScriptAssemblies/Unity.2D.Animation.Editor.dll</HintPath>
</Reference>
<Reference Include="Unity.InternalAPIEngineBridge.001">
<HintPath>C:/Users/alicj/Desktop/newest/Scriptum/Library/ScriptAssemblies/Unity.InternalAPIEngineBridge.001.dll</HintPath>
<HintPath>C:/Users/alicj/Desktop/AnotherSaveAttempt/Scriptum/Library/ScriptAssemblies/Unity.InternalAPIEngineBridge.001.dll</HintPath>
</Reference>
<Reference Include="Unity.VSCode.Editor">
<HintPath>C:/Users/alicj/Desktop/newest/Scriptum/Library/ScriptAssemblies/Unity.VSCode.Editor.dll</HintPath>
<HintPath>C:/Users/alicj/Desktop/AnotherSaveAttempt/Scriptum/Library/ScriptAssemblies/Unity.VSCode.Editor.dll</HintPath>
</Reference>
<Reference Include="Unity.2D.PixelPerfect">
<HintPath>C:/Users/alicj/Desktop/newest/Scriptum/Library/ScriptAssemblies/Unity.2D.PixelPerfect.dll</HintPath>
<HintPath>C:/Users/alicj/Desktop/AnotherSaveAttempt/Scriptum/Library/ScriptAssemblies/Unity.2D.PixelPerfect.dll</HintPath>
</Reference>
<Reference Include="Unity.2D.Tilemap.Editor">
<HintPath>C:/Users/alicj/Desktop/newest/Scriptum/Library/ScriptAssemblies/Unity.2D.Tilemap.Editor.dll</HintPath>
<HintPath>C:/Users/alicj/Desktop/AnotherSaveAttempt/Scriptum/Library/ScriptAssemblies/Unity.2D.Tilemap.Editor.dll</HintPath>
</Reference>
<Reference Include="PsdPlugin">
<HintPath>C:/Users/alicj/Desktop/newest/Scriptum/Library/ScriptAssemblies/PsdPlugin.dll</HintPath>
<HintPath>C:/Users/alicj/Desktop/AnotherSaveAttempt/Scriptum/Library/ScriptAssemblies/PsdPlugin.dll</HintPath>
</Reference>
<Reference Include="Unity.TextMeshPro.Editor">
<HintPath>C:/Users/alicj/Desktop/newest/Scriptum/Library/ScriptAssemblies/Unity.TextMeshPro.Editor.dll</HintPath>
<HintPath>C:/Users/alicj/Desktop/AnotherSaveAttempt/Scriptum/Library/ScriptAssemblies/Unity.TextMeshPro.Editor.dll</HintPath>
</Reference>
<Reference Include="Unity.VisualStudio.Editor">
<HintPath>C:/Users/alicj/Desktop/newest/Scriptum/Library/ScriptAssemblies/Unity.VisualStudio.Editor.dll</HintPath>
<HintPath>C:/Users/alicj/Desktop/AnotherSaveAttempt/Scriptum/Library/ScriptAssemblies/Unity.VisualStudio.Editor.dll</HintPath>
</Reference>
<Reference Include="Unity.Timeline">
<HintPath>C:/Users/alicj/Desktop/newest/Scriptum/Library/ScriptAssemblies/Unity.Timeline.dll</HintPath>
<HintPath>C:/Users/alicj/Desktop/AnotherSaveAttempt/Scriptum/Library/ScriptAssemblies/Unity.Timeline.dll</HintPath>
</Reference>
<Reference Include="Unity.TextMeshPro">
<HintPath>C:/Users/alicj/Desktop/newest/Scriptum/Library/ScriptAssemblies/Unity.TextMeshPro.dll</HintPath>
<HintPath>C:/Users/alicj/Desktop/AnotherSaveAttempt/Scriptum/Library/ScriptAssemblies/Unity.TextMeshPro.dll</HintPath>
</Reference>
<Reference Include="Unity.2D.IK.Editor">
<HintPath>C:/Users/alicj/Desktop/newest/Scriptum/Library/ScriptAssemblies/Unity.2D.IK.Editor.dll</HintPath>
<HintPath>C:/Users/alicj/Desktop/AnotherSaveAttempt/Scriptum/Library/ScriptAssemblies/Unity.2D.IK.Editor.dll</HintPath>
</Reference>
<Reference Include="Unity.2D.Sprite.Editor">
<HintPath>C:/Users/alicj/Desktop/newest/Scriptum/Library/ScriptAssemblies/Unity.2D.Sprite.Editor.dll</HintPath>
<HintPath>C:/Users/alicj/Desktop/AnotherSaveAttempt/Scriptum/Library/ScriptAssemblies/Unity.2D.Sprite.Editor.dll</HintPath>
</Reference>
<Reference Include="Unity.2D.Psdimporter.Editor">
<HintPath>C:/Users/alicj/Desktop/newest/Scriptum/Library/ScriptAssemblies/Unity.2D.Psdimporter.Editor.dll</HintPath>
<HintPath>C:/Users/alicj/Desktop/AnotherSaveAttempt/Scriptum/Library/ScriptAssemblies/Unity.2D.Psdimporter.Editor.dll</HintPath>
</Reference>
<Reference Include="Unity.2D.Path.Editor">
<HintPath>C:/Users/alicj/Desktop/newest/Scriptum/Library/ScriptAssemblies/Unity.2D.Path.Editor.dll</HintPath>
<HintPath>C:/Users/alicj/Desktop/AnotherSaveAttempt/Scriptum/Library/ScriptAssemblies/Unity.2D.Path.Editor.dll</HintPath>
</Reference>
<Reference Include="Unity.InternalAPIEditorBridge.001">
<HintPath>C:/Users/alicj/Desktop/newest/Scriptum/Library/ScriptAssemblies/Unity.InternalAPIEditorBridge.001.dll</HintPath>
<HintPath>C:/Users/alicj/Desktop/AnotherSaveAttempt/Scriptum/Library/ScriptAssemblies/Unity.InternalAPIEditorBridge.001.dll</HintPath>
</Reference>
<Reference Include="UnityEditor.UI">
<HintPath>C:/Users/alicj/Desktop/newest/Scriptum/Library/ScriptAssemblies/UnityEditor.UI.dll</HintPath>
<HintPath>C:/Users/alicj/Desktop/AnotherSaveAttempt/Scriptum/Library/ScriptAssemblies/UnityEditor.UI.dll</HintPath>
</Reference>
<Reference Include="Unity.PlasticSCM.Editor">
<HintPath>C:/Users/alicj/Desktop/newest/Scriptum/Library/ScriptAssemblies/Unity.PlasticSCM.Editor.dll</HintPath>
<HintPath>C:/Users/alicj/Desktop/AnotherSaveAttempt/Scriptum/Library/ScriptAssemblies/Unity.PlasticSCM.Editor.dll</HintPath>
</Reference>
<Reference Include="Unity.Rider.Editor">
<HintPath>C:/Users/alicj/Desktop/newest/Scriptum/Library/ScriptAssemblies/Unity.Rider.Editor.dll</HintPath>
<HintPath>C:/Users/alicj/Desktop/AnotherSaveAttempt/Scriptum/Library/ScriptAssemblies/Unity.Rider.Editor.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.UI">
<HintPath>C:/Users/alicj/Desktop/newest/Scriptum/Library/ScriptAssemblies/UnityEngine.UI.dll</HintPath>
<HintPath>C:/Users/alicj/Desktop/AnotherSaveAttempt/Scriptum/Library/ScriptAssemblies/UnityEngine.UI.dll</HintPath>
</Reference>
<Reference Include="Unity.Mathematics">
<HintPath>C:/Users/alicj/Desktop/newest/Scriptum/Library/ScriptAssemblies/Unity.Mathematics.dll</HintPath>
<HintPath>C:/Users/alicj/Desktop/AnotherSaveAttempt/Scriptum/Library/ScriptAssemblies/Unity.Mathematics.dll</HintPath>
</Reference>
<Reference Include="Unity.2D.IK.Runtime">
<HintPath>C:/Users/alicj/Desktop/newest/Scriptum/Library/ScriptAssemblies/Unity.2D.IK.Runtime.dll</HintPath>
<HintPath>C:/Users/alicj/Desktop/AnotherSaveAttempt/Scriptum/Library/ScriptAssemblies/Unity.2D.IK.Runtime.dll</HintPath>
</Reference>
<Reference Include="Unity.2D.Animation.Triangle.Runtime">
<HintPath>C:/Users/alicj/Desktop/newest/Scriptum/Library/ScriptAssemblies/Unity.2D.Animation.Triangle.Runtime.dll</HintPath>
<HintPath>C:/Users/alicj/Desktop/AnotherSaveAttempt/Scriptum/Library/ScriptAssemblies/Unity.2D.Animation.Triangle.Runtime.dll</HintPath>
</Reference>
<Reference Include="Unity.2D.Animation.Runtime">
<HintPath>C:/Users/alicj/Desktop/newest/Scriptum/Library/ScriptAssemblies/Unity.2D.Animation.Runtime.dll</HintPath>
<HintPath>C:/Users/alicj/Desktop/AnotherSaveAttempt/Scriptum/Library/ScriptAssemblies/Unity.2D.Animation.Runtime.dll</HintPath>
</Reference>
<Reference Include="Unity.2D.PixelPerfect.Editor">
<HintPath>C:/Users/alicj/Desktop/newest/Scriptum/Library/ScriptAssemblies/Unity.2D.PixelPerfect.Editor.dll</HintPath>
<HintPath>C:/Users/alicj/Desktop/AnotherSaveAttempt/Scriptum/Library/ScriptAssemblies/Unity.2D.PixelPerfect.Editor.dll</HintPath>
</Reference>
<Reference Include="Unity.Timeline.Editor">
<HintPath>C:/Users/alicj/Desktop/newest/Scriptum/Library/ScriptAssemblies/Unity.Timeline.Editor.dll</HintPath>
<HintPath>C:/Users/alicj/Desktop/AnotherSaveAttempt/Scriptum/Library/ScriptAssemblies/Unity.Timeline.Editor.dll</HintPath>
</Reference>
<Reference Include="Unity.Mathematics.Editor">
<HintPath>C:/Users/alicj/Desktop/newest/Scriptum/Library/ScriptAssemblies/Unity.Mathematics.Editor.dll</HintPath>
<HintPath>C:/Users/alicj/Desktop/AnotherSaveAttempt/Scriptum/Library/ScriptAssemblies/Unity.Mathematics.Editor.dll</HintPath>
</Reference>
<Reference Include="Unity.2D.Common.Runtime">
<HintPath>C:/Users/alicj/Desktop/newest/Scriptum/Library/ScriptAssemblies/Unity.2D.Common.Runtime.dll</HintPath>
<HintPath>C:/Users/alicj/Desktop/AnotherSaveAttempt/Scriptum/Library/ScriptAssemblies/Unity.2D.Common.Runtime.dll</HintPath>
</Reference>
<Reference Include="Unity.2D.SpriteShape.Editor">
<HintPath>C:/Users/alicj/Desktop/newest/Scriptum/Library/ScriptAssemblies/Unity.2D.SpriteShape.Editor.dll</HintPath>
<HintPath>C:/Users/alicj/Desktop/AnotherSaveAttempt/Scriptum/Library/ScriptAssemblies/Unity.2D.SpriteShape.Editor.dll</HintPath>
</Reference>
<Reference Include="Unity.2D.Common.Editor">
<HintPath>C:/Users/alicj/Desktop/newest/Scriptum/Library/ScriptAssemblies/Unity.2D.Common.Editor.dll</HintPath>
<HintPath>C:/Users/alicj/Desktop/AnotherSaveAttempt/Scriptum/Library/ScriptAssemblies/Unity.2D.Common.Editor.dll</HintPath>
</Reference>
<Reference Include="Unity.2D.SpriteShape.Runtime">
<HintPath>C:/Users/alicj/Desktop/newest/Scriptum/Library/ScriptAssemblies/Unity.2D.SpriteShape.Runtime.dll</HintPath>
<HintPath>C:/Users/alicj/Desktop/AnotherSaveAttempt/Scriptum/Library/ScriptAssemblies/Unity.2D.SpriteShape.Runtime.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>

View File

@ -365,6 +365,7 @@ GameObject:
- component: {fileID: 78203889}
- component: {fileID: 78203888}
- component: {fileID: 78203887}
- component: {fileID: 78203891}
m_Layer: 5
m_Name: yes
m_TagString: Untagged
@ -459,6 +460,30 @@ MonoBehaviour:
m_StringArgument:
m_BoolArgument: 0
m_CallState: 2
- m_Target: {fileID: 78203891}
m_TargetAssemblyTypeName: SaveController, Assembly-CSharp
m_MethodName: SaveScene
m_Mode: 1
m_Arguments:
m_ObjectArgument: {fileID: 0}
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
m_IntArgument: 0
m_FloatArgument: 0
m_StringArgument:
m_BoolArgument: 0
m_CallState: 2
- m_Target: {fileID: 167690946}
m_TargetAssemblyTypeName: PlayerPosition, Assembly-CSharp
m_MethodName: SavePosition
m_Mode: 1
m_Arguments:
m_ObjectArgument: {fileID: 0}
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
m_IntArgument: 0
m_FloatArgument: 0
m_StringArgument:
m_BoolArgument: 0
m_CallState: 2
--- !u!114 &78203889
MonoBehaviour:
m_ObjectHideFlags: 0
@ -501,6 +526,18 @@ CanvasRenderer:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 78203885}
m_CullTransparentMesh: 1
--- !u!114 &78203891
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 78203885}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: f8dbef2798cc8064f86e56d2bc02d2fa, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!1 &90994617
GameObject:
m_ObjectHideFlags: 0
@ -23230,6 +23267,7 @@ GameObject:
- component: {fileID: 167690943}
- component: {fileID: 167690944}
- component: {fileID: 167690945}
- component: {fileID: 167690946}
m_Layer: 0
m_Name: mainCh_standing
m_TagString: Player
@ -23409,6 +23447,21 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 48a2ec1fec857c946ae3ae8e69b29562, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!114 &167690946
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 167690937}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: b95333079796daa45b7ad78056d78014, type: 3}
m_Name:
m_EditorClassIdentifier:
x: 0
y: 0
z: 0
--- !u!1 &193431387
GameObject:
m_ObjectHideFlags: 0
@ -168235,6 +168288,7 @@ GameObject:
- component: {fileID: 2070805990}
- component: {fileID: 2070805989}
- component: {fileID: 2070805988}
- component: {fileID: 2070805991}
m_Layer: 5
m_Name: save
m_TagString: Untagged
@ -168304,7 +168358,31 @@ MonoBehaviour:
m_TargetGraphic: {fileID: 2070805989}
m_OnClick:
m_PersistentCalls:
m_Calls: []
m_Calls:
- m_Target: {fileID: 2070805991}
m_TargetAssemblyTypeName: SaveController, Assembly-CSharp
m_MethodName: SaveScene
m_Mode: 1
m_Arguments:
m_ObjectArgument: {fileID: 0}
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
m_IntArgument: 0
m_FloatArgument: 0
m_StringArgument:
m_BoolArgument: 0
m_CallState: 2
- m_Target: {fileID: 167690946}
m_TargetAssemblyTypeName: PlayerPosition, Assembly-CSharp
m_MethodName: SavePosition
m_Mode: 1
m_Arguments:
m_ObjectArgument: {fileID: 0}
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
m_IntArgument: 0
m_FloatArgument: 0
m_StringArgument:
m_BoolArgument: 0
m_CallState: 2
--- !u!114 &2070805989
MonoBehaviour:
m_ObjectHideFlags: 0
@ -168347,6 +168425,18 @@ CanvasRenderer:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2070805986}
m_CullTransparentMesh: 1
--- !u!114 &2070805991
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2070805986}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: f8dbef2798cc8064f86e56d2bc02d2fa, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!1 &2145520338
GameObject:
m_ObjectHideFlags: 0

View File

@ -530,6 +530,7 @@ GameObject:
- component: {fileID: 455923089}
- component: {fileID: 455923088}
- component: {fileID: 455923087}
- component: {fileID: 455923090}
m_Layer: 5
m_Name: ContinueButton
m_TagString: Untagged
@ -600,7 +601,19 @@ MonoBehaviour:
m_TargetGraphic: {fileID: 455923088}
m_OnClick:
m_PersistentCalls:
m_Calls: []
m_Calls:
- m_Target: {fileID: 455923090}
m_TargetAssemblyTypeName: SaveController, Assembly-CSharp
m_MethodName: LoadScene
m_Mode: 1
m_Arguments:
m_ObjectArgument: {fileID: 0}
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
m_IntArgument: 0
m_FloatArgument: 0
m_StringArgument:
m_BoolArgument: 0
m_CallState: 2
--- !u!114 &455923088
MonoBehaviour:
m_ObjectHideFlags: 0
@ -639,6 +652,18 @@ CanvasRenderer:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 455923085}
m_CullTransparentMesh: 1
--- !u!114 &455923090
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 455923085}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: f8dbef2798cc8064f86e56d2bc02d2fa, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!1 &502516633
GameObject:
m_ObjectHideFlags: 0

View File

@ -1123,6 +1123,7 @@ GameObject:
- component: {fileID: 167690938}
- component: {fileID: 167690943}
- component: {fileID: 167690944}
- component: {fileID: 167690946}
- component: {fileID: 167690945}
m_Layer: 0
m_Name: mainCh_standing
@ -1303,6 +1304,21 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 48a2ec1fec857c946ae3ae8e69b29562, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!114 &167690946
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 167690937}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: b95333079796daa45b7ad78056d78014, type: 3}
m_Name:
m_EditorClassIdentifier:
x: 0
y: 0
z: 0
--- !u!1 &174581753
GameObject:
m_ObjectHideFlags: 0
@ -26818,6 +26834,7 @@ GameObject:
- component: {fileID: 897697752}
- component: {fileID: 897697751}
- component: {fileID: 897697753}
- component: {fileID: 897697754}
m_Layer: 5
m_Name: save
m_TagString: Untagged
@ -26929,7 +26946,43 @@ MonoBehaviour:
m_TargetGraphic: {fileID: 897697751}
m_OnClick:
m_PersistentCalls:
m_Calls: []
m_Calls:
- m_Target: {fileID: 897697754}
m_TargetAssemblyTypeName: SaveController, Assembly-CSharp
m_MethodName: SaveScene
m_Mode: 1
m_Arguments:
m_ObjectArgument: {fileID: 0}
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
m_IntArgument: 0
m_FloatArgument: 0
m_StringArgument:
m_BoolArgument: 0
m_CallState: 2
- m_Target: {fileID: 167690946}
m_TargetAssemblyTypeName: PlayerPosition, Assembly-CSharp
m_MethodName: SavePosition
m_Mode: 1
m_Arguments:
m_ObjectArgument: {fileID: 0}
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
m_IntArgument: 0
m_FloatArgument: 0
m_StringArgument:
m_BoolArgument: 0
m_CallState: 2
--- !u!114 &897697754
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 897697749}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: f8dbef2798cc8064f86e56d2bc02d2fa, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!1 &913447032
GameObject:
m_ObjectHideFlags: 0
@ -121422,6 +121475,7 @@ GameObject:
- component: {fileID: 2146696730}
- component: {fileID: 2146696733}
- component: {fileID: 2146696732}
- component: {fileID: 2146696734}
m_Layer: 5
m_Name: yes
m_TagString: Untagged
@ -121558,6 +121612,42 @@ MonoBehaviour:
m_StringArgument:
m_BoolArgument: 0
m_CallState: 2
- m_Target: {fileID: 2146696734}
m_TargetAssemblyTypeName: SaveController, Assembly-CSharp
m_MethodName: SaveScene
m_Mode: 1
m_Arguments:
m_ObjectArgument: {fileID: 0}
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
m_IntArgument: 0
m_FloatArgument: 0
m_StringArgument:
m_BoolArgument: 0
m_CallState: 2
- m_Target: {fileID: 167690946}
m_TargetAssemblyTypeName: PlayerPosition, Assembly-CSharp
m_MethodName: SavePosition
m_Mode: 1
m_Arguments:
m_ObjectArgument: {fileID: 0}
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
m_IntArgument: 0
m_FloatArgument: 0
m_StringArgument:
m_BoolArgument: 0
m_CallState: 2
--- !u!114 &2146696734
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2146696728}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: f8dbef2798cc8064f86e56d2bc02d2fa, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!1001 &9081071845975046733
PrefabInstance:
m_ObjectHideFlags: 0

View File

@ -6,11 +6,15 @@ using System;
public class ChangeScene : MonoBehaviour
{
float x, y, z;
public void MoveToScene(int sceneID)
{
SceneManager.LoadScene(sceneID);
}
public void OnCollisionEnter2D(Collision2D collision)
{
if(collision.gameObject.tag == "SceneTransition")

View File

@ -0,0 +1,41 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PlayerPosition : MonoBehaviour
{
public float x, y, z;
public void SavePosition()
{
x = transform.position.x;
y = transform.position.y;
z = transform.position.z;
PlayerPrefs.SetFloat("x", x);
PlayerPrefs.SetFloat("y", y);
PlayerPrefs.SetFloat("z", z);
}
public void LoadPosition()
{
x = PlayerPrefs.GetFloat("x");
y = PlayerPrefs.GetFloat("y");
z = PlayerPrefs.GetFloat("z");
Vector3 LoadPosition = new Vector3(x, y, z);
transform.position = LoadPosition;
}
void Start()
{
if(PlayerPrefs.GetString("continued") == "yes")
{
LoadPosition();
string continued = "no";
PlayerPrefs.SetString("continued", continued);
}
}
}

View File

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

View File

@ -0,0 +1,21 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
public class SaveController : MonoBehaviour
{
public void SaveScene()
{
string activeScene = SceneManager.GetActiveScene().name;
PlayerPrefs.SetString("SceneSaved", activeScene);
}
public void LoadScene()
{
string sceneToGoTo = PlayerPrefs.GetString("SceneSaved");
SceneManager.LoadScene(sceneToGoTo);
string continued = "yes";
PlayerPrefs.SetString("continued", continued);
}
}

View File

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

View File

@ -27,10 +27,10 @@ EditorUserSettings:
value: 22424703114646680e0b0227036c72111f19352f223d667d6d1a1226ece42776f7e93ffdfe
flags: 0
RecentlyUsedScenePath-7:
value: 22424703114646680e0b0227036c6c111b07142f1f2b233e2867083debf42d
value: 22424703114646680e0b0227036c7c1100123d24383a273e2e2c5326ece92021
flags: 0
RecentlyUsedScenePath-8:
value: 22424703114646680e0b0227036c7c1100123d24383a273e2e2c5326ece92021
value: 22424703114646680e0b0227036c6c111b07142f1f2b233e2867083debf42d
flags: 0
RecentlyUsedScenePath-9:
value: 22424703114646680e0b0227036c72111f1958072926337e38271427fb