From 078e3568104a0fc42f32d653a677acfb1eee879a Mon Sep 17 00:00:00 2001 From: Programmer-DField Date: Fri, 26 Feb 2021 17:08:41 +0000 Subject: [PATCH] The respawwn system is now ppicking up the position of the player correctly. However, still not sending the player to the last known respawn point. --- game/Assets/Prefabs/Player.prefab | 20 +++++++ game/Assets/Scenes/Main.unity | 57 ++++++------------- game/Assets/Scripts/Checkpoint/SafeZone.cs | 4 +- .../Scripts/Death & Respawn/DeathZone.cs | 8 +-- .../Scripts/Death & Respawn/RespawnManager.cs | 2 +- 5 files changed, 44 insertions(+), 47 deletions(-) diff --git a/game/Assets/Prefabs/Player.prefab b/game/Assets/Prefabs/Player.prefab index 2a5c0e6..b85017a 100644 --- a/game/Assets/Prefabs/Player.prefab +++ b/game/Assets/Prefabs/Player.prefab @@ -96,6 +96,7 @@ GameObject: - component: {fileID: 13726836969441782} - component: {fileID: 13726837176080779} - component: {fileID: 3320306143821152633} + - component: {fileID: 1646361029} m_Layer: 0 m_Name: Player m_TagString: Player @@ -313,6 +314,25 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 005bf73dff204914c9e1bbd60c843451, type: 3} m_Name: m_EditorClassIdentifier: +--- !u!95 &1646361029 +Animator: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 13726836969441781} + m_Enabled: 1 + m_Avatar: {fileID: 0} + m_Controller: {fileID: 9100000, guid: bd12efafa4115114f90ba79feeb4e8b0, type: 2} + m_CullingMode: 0 + m_UpdateMode: 0 + m_ApplyRootMotion: 0 + m_LinearVelocityBlending: 0 + m_WarningMessage: + m_HasTransformHierarchy: 1 + m_AllowConstantClipSamplingOptimization: 1 + m_KeepAnimatorControllerStateOnDisable: 0 --- !u!1 &13726837293638831 GameObject: m_ObjectHideFlags: 0 diff --git a/game/Assets/Scenes/Main.unity b/game/Assets/Scenes/Main.unity index e2619d6..2b18c62 100644 --- a/game/Assets/Scenes/Main.unity +++ b/game/Assets/Scenes/Main.unity @@ -174,7 +174,7 @@ MonoBehaviour: m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 34418842} - m_Enabled: 1 + m_Enabled: 0 m_EditorHideFlags: 0 m_Script: {fileID: 11500000, guid: 4a7f7dc8ddb842944abcbcbb1d4995f5, type: 3} m_Name: @@ -1163,10 +1163,18 @@ PrefabInstance: propertyPath: m_LocalEulerAnglesHint.z value: 0 objectReference: {fileID: 0} + - target: {fileID: 13726836969441545, guid: 5efe0b059275dbe48a4108d03ad03fd9, type: 3} + propertyPath: m_Enabled + value: 1 + objectReference: {fileID: 0} - target: {fileID: 13726836969441781, guid: 5efe0b059275dbe48a4108d03ad03fd9, type: 3} propertyPath: m_Name value: Player objectReference: {fileID: 0} + - target: {fileID: 13726836969441783, guid: 5efe0b059275dbe48a4108d03ad03fd9, type: 3} + propertyPath: m_Enabled + value: 1 + objectReference: {fileID: 0} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: 5efe0b059275dbe48a4108d03ad03fd9, type: 3} --- !u!1 &1544718414 @@ -1339,53 +1347,22 @@ Transform: m_Father: {fileID: 0} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!1 &1646361021 stripped -GameObject: - m_CorrespondingSourceObject: {fileID: 13726836969441781, guid: 5efe0b059275dbe48a4108d03ad03fd9, type: 3} - m_PrefabInstance: {fileID: 1528237030} - m_PrefabAsset: {fileID: 0} --- !u!114 &1646361025 stripped MonoBehaviour: m_CorrespondingSourceObject: {fileID: 13726836969441780, guid: 5efe0b059275dbe48a4108d03ad03fd9, type: 3} m_PrefabInstance: {fileID: 1528237030} m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1646361021} + m_GameObject: {fileID: 0} m_Enabled: 1 m_EditorHideFlags: 0 m_Script: {fileID: 11500000, guid: 62899f850307741f2a39c98a8b639597, type: 3} m_Name: m_EditorClassIdentifier: ---- !u!95 &1646361029 +--- !u!95 &1646361029 stripped Animator: - serializedVersion: 3 - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} + m_CorrespondingSourceObject: {fileID: 1646361029, guid: 5efe0b059275dbe48a4108d03ad03fd9, type: 3} + m_PrefabInstance: {fileID: 1528237030} m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1646361021} - m_Enabled: 1 - m_Avatar: {fileID: 0} - m_Controller: {fileID: 9100000, guid: bd12efafa4115114f90ba79feeb4e8b0, type: 2} - m_CullingMode: 0 - m_UpdateMode: 0 - m_ApplyRootMotion: 0 - m_LinearVelocityBlending: 0 - m_WarningMessage: - m_HasTransformHierarchy: 1 - m_AllowConstantClipSamplingOptimization: 1 - m_KeepAnimatorControllerStateOnDisable: 0 ---- !u!114 &1646361030 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1646361021} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 4a7f7dc8ddb842944abcbcbb1d4995f5, type: 3} - m_Name: - m_EditorClassIdentifier: --- !u!1 &1853827072 GameObject: m_ObjectHideFlags: 0 @@ -1399,7 +1376,7 @@ GameObject: - component: {fileID: 1853827076} - component: {fileID: 1853827075} - component: {fileID: 1853827074} - m_Layer: 0 + m_Layer: 3 m_Name: SafeZone m_TagString: Untagged m_Icon: {fileID: 0} @@ -1414,7 +1391,7 @@ Transform: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1853827072} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: -2.62, y: -9.48, z: 1.83} + m_LocalPosition: {x: -7.2, y: -9.19, z: -45.53} m_LocalScale: {x: 1, y: 1, z: 1} m_Children: [] m_Father: {fileID: 565379240} @@ -1453,7 +1430,7 @@ MeshRenderer: m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1853827072} - m_Enabled: 0 + m_Enabled: 1 m_CastShadows: 1 m_ReceiveShadows: 1 m_DynamicOccludee: 1 @@ -1465,7 +1442,7 @@ MeshRenderer: m_RenderingLayerMask: 1 m_RendererPriority: 0 m_Materials: - - {fileID: 2100000, guid: 31321ba15b8f8eb4c954353edc038b1d, type: 2} + - {fileID: 2100000, guid: c7c9da98e081aaa43883652afefc74b3, type: 2} m_StaticBatchInfo: firstSubMesh: 0 subMeshCount: 0 diff --git a/game/Assets/Scripts/Checkpoint/SafeZone.cs b/game/Assets/Scripts/Checkpoint/SafeZone.cs index d9fd2b2..c3389a7 100644 --- a/game/Assets/Scripts/Checkpoint/SafeZone.cs +++ b/game/Assets/Scripts/Checkpoint/SafeZone.cs @@ -15,15 +15,15 @@ public class SafeZone : MonoBehaviour // Check to see if other collider is Player. If true set player to other game object. if (other.gameObject.CompareTag("Player")) { - isSafe = true; player = other.gameObject; + isSafe = true; } } private void OnTriggerExit(Collider other) { // Check if other game object is Player. - if (other.gameObject.CompareTag("Player")) + if (other.gameObject.CompareTag ("Player")) { isSafe = false; } diff --git a/game/Assets/Scripts/Death & Respawn/DeathZone.cs b/game/Assets/Scripts/Death & Respawn/DeathZone.cs index b6cd466..d2a4700 100644 --- a/game/Assets/Scripts/Death & Respawn/DeathZone.cs +++ b/game/Assets/Scripts/Death & Respawn/DeathZone.cs @@ -5,7 +5,7 @@ using UnityEngine.InputSystem; public class DeathZone : MonoBehaviour { public Animator animator; - //public GameObject fadeScreen; + public GameObject fadeScreen; private GameObject player; @@ -28,11 +28,11 @@ public class DeathZone : MonoBehaviour _playerInput.enabled = false; yield return new WaitForSeconds(0.5f); - //fadeScreen.GetComponent().SetTrigger("fadeToBlack"); - //yield return new WaitForSeconds(1.5f); + fadeScreen.GetComponent().SetTrigger("fadeToBlack"); + yield return new WaitForSeconds(1.5f); player.transform.position = respawnManager.GetRespawnPoint(); - //fadeScreen.GetComponent().SetTrigger("fadeToClear"); + fadeScreen.GetComponent().SetTrigger("fadeToClear"); yield return new WaitForSeconds(0.5f); _playerInput.enabled = true; diff --git a/game/Assets/Scripts/Death & Respawn/RespawnManager.cs b/game/Assets/Scripts/Death & Respawn/RespawnManager.cs index ee3026d..eb15d82 100644 --- a/game/Assets/Scripts/Death & Respawn/RespawnManager.cs +++ b/game/Assets/Scripts/Death & Respawn/RespawnManager.cs @@ -21,6 +21,6 @@ public class RespawnManager : MonoBehaviour // Show current respawn point in log. This can be deleted at later stage. private void Update() { - Debug.Log(respawnPoint); + Debug.Log("Respawn point is: " + respawnPoint); } }