trying to fix spawn
This commit is contained in:
parent
15246a9af2
commit
68eaa85dcb
7 changed files with 412 additions and 1 deletions
45
Game/Assets/ResetPosition.cs
Normal file
45
Game/Assets/ResetPosition.cs
Normal file
|
@ -0,0 +1,45 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
|
||||
public class ResetPosition : MonoBehaviour
|
||||
{
|
||||
public Transform xrRig; // Reference to the XR Rig's Transform
|
||||
private Vector3 initialPosition; // Store the initial position
|
||||
private Quaternion initialRotation; // Store the initial rotation
|
||||
|
||||
// Store the scene names for which you want to reset the XR Rig position
|
||||
public string[] sceneNames;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
// Capture the initial position and rotation at the start of the scene
|
||||
initialPosition = xrRig.position;
|
||||
initialRotation = xrRig.rotation;
|
||||
|
||||
// Listen for scene changes and reset XR Rig's position on scene load
|
||||
SceneManager.sceneLoaded += OnSceneLoaded;
|
||||
}
|
||||
|
||||
private void OnSceneLoaded(Scene scene, LoadSceneMode mode)
|
||||
{
|
||||
// Check if the scene we are loading matches any of the target scenes
|
||||
foreach (string sceneName in sceneNames)
|
||||
{
|
||||
if (scene.name == sceneName)
|
||||
{
|
||||
// Reset XR Rig position and rotation to the original values
|
||||
xrRig.position = initialPosition;
|
||||
xrRig.rotation = initialRotation;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void OnDestroy()
|
||||
{
|
||||
// Remove the sceneLoaded listener when this object is destroyed
|
||||
SceneManager.sceneLoaded -= OnSceneLoaded;
|
||||
}
|
||||
}
|
11
Game/Assets/ResetPosition.cs.meta
Normal file
11
Game/Assets/ResetPosition.cs.meta
Normal file
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: c92da06a158942f46bbaa5a5a4f85d54
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -54086,6 +54086,7 @@ MonoBehaviour:
|
|||
m_Script: {fileID: 11500000, guid: e01448acf10665b469bdbd43de140feb, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
currentDay: 1
|
||||
storyPanelUI: {fileID: 620624014}
|
||||
storyText: {fileID: 1214791149}
|
||||
--- !u!43 &278678358
|
||||
|
@ -151899,6 +151900,134 @@ Mesh:
|
|||
offset: 0
|
||||
size: 0
|
||||
path:
|
||||
--- !u!1 &817278277
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 817278278}
|
||||
- component: {fileID: 817278283}
|
||||
- component: {fileID: 817278282}
|
||||
- component: {fileID: 817278281}
|
||||
- component: {fileID: 817278280}
|
||||
- component: {fileID: 817278279}
|
||||
m_Layer: 5
|
||||
m_Name: Panel
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &817278278
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 817278277}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1.1856, y: 1.1856, z: 1.1856}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children:
|
||||
- {fileID: 1251886990}
|
||||
m_Father: {fileID: 1776114652}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 1, y: 1}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 0, y: 0}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!114 &817278279
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 817278277}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 5bae7a3fb14a3854ca6668491a8257b9, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
dayPanel: {fileID: 817278280}
|
||||
dayText: {fileID: 1251886991}
|
||||
--- !u!225 &817278280
|
||||
CanvasGroup:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 817278277}
|
||||
m_Enabled: 1
|
||||
m_Alpha: 1
|
||||
m_Interactable: 1
|
||||
m_BlocksRaycasts: 1
|
||||
m_IgnoreParentGroups: 0
|
||||
--- !u!223 &817278281
|
||||
Canvas:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 817278277}
|
||||
m_Enabled: 1
|
||||
serializedVersion: 3
|
||||
m_RenderMode: 2
|
||||
m_Camera: {fileID: 0}
|
||||
m_PlaneDistance: 100
|
||||
m_PixelPerfect: 0
|
||||
m_ReceivesEvents: 1
|
||||
m_OverrideSorting: 0
|
||||
m_OverridePixelPerfect: 0
|
||||
m_SortingBucketNormalizedSize: 0
|
||||
m_VertexColorAlwaysGammaSpace: 0
|
||||
m_AdditionalShaderChannelsFlag: 25
|
||||
m_UpdateRectTransformForStandalone: 0
|
||||
m_SortingLayerID: 0
|
||||
m_SortingOrder: 0
|
||||
m_TargetDisplay: 0
|
||||
--- !u!114 &817278282
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 817278277}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Material: {fileID: 0}
|
||||
m_Color: {r: 0, g: 0, b: 0, a: 1}
|
||||
m_RaycastTarget: 1
|
||||
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_Maskable: 1
|
||||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_Sprite: {fileID: 10907, guid: 0000000000000000f000000000000000, type: 0}
|
||||
m_Type: 1
|
||||
m_PreserveAspect: 0
|
||||
m_FillCenter: 1
|
||||
m_FillMethod: 4
|
||||
m_FillAmount: 1
|
||||
m_FillClockwise: 1
|
||||
m_FillOrigin: 0
|
||||
m_UseSpriteMesh: 0
|
||||
m_PixelsPerUnitMultiplier: 1
|
||||
--- !u!222 &817278283
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 817278277}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!1001 &817355989
|
||||
PrefabInstance:
|
||||
m_ObjectHideFlags: 0
|
||||
|
@ -177078,6 +177207,9 @@ PrefabInstance:
|
|||
m_RemovedGameObjects: []
|
||||
m_AddedGameObjects: []
|
||||
m_AddedComponents:
|
||||
- targetCorrespondingSourceObject: {fileID: 7277165443329672351, guid: a4a4b6738cb4ba34bb94baa14bd938f0, type: 3}
|
||||
insertIndex: -1
|
||||
addedObject: {fileID: 1340274351}
|
||||
- targetCorrespondingSourceObject: {fileID: 7951603848978517227, guid: a4a4b6738cb4ba34bb94baa14bd938f0, type: 3}
|
||||
insertIndex: -1
|
||||
addedObject: {fileID: 1850242034}
|
||||
|
@ -244604,6 +244736,140 @@ Mesh:
|
|||
offset: 0
|
||||
size: 0
|
||||
path:
|
||||
--- !u!1 &1251886989
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 1251886990}
|
||||
- component: {fileID: 1251886992}
|
||||
- component: {fileID: 1251886991}
|
||||
m_Layer: 5
|
||||
m_Name: Text (TMP)
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &1251886990
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1251886989}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 817278278}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0.5, y: 0.5}
|
||||
m_AnchorMax: {x: 0.5, y: 0.5}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 200, y: 50}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!114 &1251886991
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1251886989}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Material: {fileID: 0}
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_RaycastTarget: 1
|
||||
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_Maskable: 1
|
||||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_text: New Text
|
||||
m_isRightToLeft: 0
|
||||
m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2}
|
||||
m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2}
|
||||
m_fontSharedMaterials: []
|
||||
m_fontMaterial: {fileID: 0}
|
||||
m_fontMaterials: []
|
||||
m_fontColor32:
|
||||
serializedVersion: 2
|
||||
rgba: 4294967295
|
||||
m_fontColor: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_enableVertexGradient: 0
|
||||
m_colorMode: 3
|
||||
m_fontColorGradient:
|
||||
topLeft: {r: 1, g: 1, b: 1, a: 1}
|
||||
topRight: {r: 1, g: 1, b: 1, a: 1}
|
||||
bottomLeft: {r: 1, g: 1, b: 1, a: 1}
|
||||
bottomRight: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_fontColorGradientPreset: {fileID: 0}
|
||||
m_spriteAsset: {fileID: 0}
|
||||
m_tintAllSprites: 0
|
||||
m_StyleSheet: {fileID: 0}
|
||||
m_TextStyleHashCode: -1183493901
|
||||
m_overrideHtmlColors: 0
|
||||
m_faceColor:
|
||||
serializedVersion: 2
|
||||
rgba: 4294967295
|
||||
m_fontSize: 36
|
||||
m_fontSizeBase: 36
|
||||
m_fontWeight: 400
|
||||
m_enableAutoSizing: 0
|
||||
m_fontSizeMin: 18
|
||||
m_fontSizeMax: 72
|
||||
m_fontStyle: 0
|
||||
m_HorizontalAlignment: 2
|
||||
m_VerticalAlignment: 256
|
||||
m_textAlignment: 65535
|
||||
m_characterSpacing: 0
|
||||
m_wordSpacing: 0
|
||||
m_lineSpacing: 0
|
||||
m_lineSpacingMax: 0
|
||||
m_paragraphSpacing: 0
|
||||
m_charWidthMaxAdj: 0
|
||||
m_enableWordWrapping: 1
|
||||
m_wordWrappingRatios: 0.4
|
||||
m_overflowMode: 0
|
||||
m_linkedTextComponent: {fileID: 0}
|
||||
parentLinkedComponent: {fileID: 0}
|
||||
m_enableKerning: 1
|
||||
m_enableExtraPadding: 0
|
||||
checkPaddingRequired: 0
|
||||
m_isRichText: 1
|
||||
m_parseCtrlCharacters: 1
|
||||
m_isOrthographic: 1
|
||||
m_isCullingEnabled: 0
|
||||
m_horizontalMapping: 0
|
||||
m_verticalMapping: 0
|
||||
m_uvLineOffset: 0
|
||||
m_geometrySortingOrder: 0
|
||||
m_IsTextObjectScaleStatic: 0
|
||||
m_VertexBufferAutoSizeReduction: 0
|
||||
m_useMaxVisibleDescender: 1
|
||||
m_pageToDisplay: 1
|
||||
m_margin: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_isUsingLegacyAnimationComponent: 0
|
||||
m_isVolumetricText: 0
|
||||
m_hasFontAssetChanged: 0
|
||||
m_baseMaterial: {fileID: 0}
|
||||
m_maskOffset: {x: 0, y: 0, z: 0, w: 0}
|
||||
--- !u!222 &1251886992
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1251886989}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!43 &1251925603
|
||||
Mesh:
|
||||
m_ObjectHideFlags: 0
|
||||
|
@ -259993,6 +260259,25 @@ Transform:
|
|||
m_CorrespondingSourceObject: {fileID: 7049103537148308913, guid: 8af01ba72f1f55d43b1d544fb14685af, type: 3}
|
||||
m_PrefabInstance: {fileID: 1340268472}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
--- !u!1 &1340274344 stripped
|
||||
GameObject:
|
||||
m_CorrespondingSourceObject: {fileID: 7277165443329672351, guid: a4a4b6738cb4ba34bb94baa14bd938f0, type: 3}
|
||||
m_PrefabInstance: {fileID: 960695709}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
--- !u!114 &1340274351
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1340274344}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: c92da06a158942f46bbaa5a5a4f85d54, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
houseSpawn: {fileID: 1843975923}
|
||||
townSpawn: {fileID: 0}
|
||||
--- !u!43 &1340303700
|
||||
Mesh:
|
||||
m_ObjectHideFlags: 0
|
||||
|
@ -344386,6 +344671,7 @@ RectTransform:
|
|||
- {fileID: 620624015}
|
||||
- {fileID: 1839460624}
|
||||
- {fileID: 197586935}
|
||||
- {fileID: 817278278}
|
||||
m_Father: {fileID: 0}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
|
@ -355957,7 +356243,7 @@ MonoBehaviour:
|
|||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_text: Am I sure I want to leave the house? I might not have completed everything...
|
||||
m_text: Should I leave the house? I might not have completed everything...
|
||||
m_isRightToLeft: 0
|
||||
m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2}
|
||||
m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2}
|
||||
|
@ -356459,6 +356745,37 @@ Mesh:
|
|||
offset: 0
|
||||
size: 0
|
||||
path:
|
||||
--- !u!1 &1843975922
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 1843975923}
|
||||
m_Layer: 0
|
||||
m_Name: 'House start point '
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &1843975923
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1843975922}
|
||||
serializedVersion: 2
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 71.971, y: 20.018, z: 1068.746}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!1001 &1844503663
|
||||
PrefabInstance:
|
||||
m_ObjectHideFlags: 0
|
||||
|
@ -412454,3 +412771,4 @@ SceneRoots:
|
|||
- {fileID: 2031915432}
|
||||
- {fileID: 1312419882}
|
||||
- {fileID: 1127428079}
|
||||
- {fileID: 1843975923}
|
||||
|
|
|
@ -179694,6 +179694,9 @@ PrefabInstance:
|
|||
m_RemovedGameObjects: []
|
||||
m_AddedGameObjects: []
|
||||
m_AddedComponents:
|
||||
- targetCorrespondingSourceObject: {fileID: 7277165443329672351, guid: a4a4b6738cb4ba34bb94baa14bd938f0, type: 3}
|
||||
insertIndex: -1
|
||||
addedObject: {fileID: 1988509987}
|
||||
- targetCorrespondingSourceObject: {fileID: 4731990467021857060, guid: a4a4b6738cb4ba34bb94baa14bd938f0, type: 3}
|
||||
insertIndex: -1
|
||||
addedObject: {fileID: 960695713}
|
||||
|
@ -180353,6 +180356,11 @@ MonoBehaviour:
|
|||
m_InputActionReference: {fileID: 0}
|
||||
m_ObjectReferenceObject: {fileID: 0}
|
||||
m_ManualValue: 0
|
||||
--- !u!1 &960695714 stripped
|
||||
GameObject:
|
||||
m_CorrespondingSourceObject: {fileID: 7277165443329672351, guid: a4a4b6738cb4ba34bb94baa14bd938f0, type: 3}
|
||||
m_PrefabInstance: {fileID: 960695709}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
--- !u!43 &961704033
|
||||
Mesh:
|
||||
m_ObjectHideFlags: 0
|
||||
|
@ -395373,6 +395381,20 @@ Transform:
|
|||
m_CorrespondingSourceObject: {fileID: 6045648537344725186, guid: a4a4b6738cb4ba34bb94baa14bd938f0, type: 3}
|
||||
m_PrefabInstance: {fileID: 960695709}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
--- !u!114 &1988509987
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 960695714}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: c92da06a158942f46bbaa5a5a4f85d54, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
houseSpawn: {fileID: 0}
|
||||
townSpawn: {fileID: 1305339138}
|
||||
--- !u!1001 &1989279913
|
||||
PrefabInstance:
|
||||
m_ObjectHideFlags: 0
|
||||
|
|
|
@ -17,6 +17,8 @@ public class GameManager : MonoBehaviour
|
|||
public static GameManager Instance;
|
||||
|
||||
public int currentDay = 1;
|
||||
|
||||
private string lastSceneName;
|
||||
|
||||
// Defines UI references
|
||||
[Header("UI References")]
|
||||
|
@ -152,4 +154,14 @@ public class GameManager : MonoBehaviour
|
|||
{
|
||||
currentDay++;
|
||||
}
|
||||
|
||||
public void SetLastScene(string sceneName)
|
||||
{
|
||||
lastSceneName = sceneName;
|
||||
}
|
||||
|
||||
public string GetLastScene()
|
||||
{
|
||||
return lastSceneName;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -82,6 +82,8 @@ public class GoToSchool : MonoBehaviour
|
|||
|
||||
// Display UI for 5 seconds
|
||||
yield return new WaitForSeconds(displayDuration);
|
||||
|
||||
GameManager.Instance.SetLastScene(SceneManager.GetActiveScene().name);
|
||||
|
||||
// Load the next scene
|
||||
SceneManager.LoadScene(nextSceneName);
|
||||
|
|
|
@ -50,6 +50,7 @@ public class LeaveHouseTrigger : MonoBehaviour
|
|||
public void ConfirmLeave()
|
||||
{
|
||||
GameManager.Instance.LogPlayerChoices();
|
||||
GameManager.Instance.SetLastScene(SceneManager.GetActiveScene().name);
|
||||
SceneManager.LoadScene(nextSceneName);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue