diff --git a/.idea/.idea.MADBombs/.idea/indexLayout.xml b/.idea/.idea.MADBombs/.idea/indexLayout.xml index ccd893d..a69d26f 100644 --- a/.idea/.idea.MADBombs/.idea/indexLayout.xml +++ b/.idea/.idea.MADBombs/.idea/indexLayout.xml @@ -18,7 +18,6 @@ .idea Library Logs - Temp obj diff --git a/Assets/Scenes/SampleScene.unity b/Assets/Scenes/SampleScene.unity index 095b1c2..07e67a1 100644 --- a/Assets/Scenes/SampleScene.unity +++ b/Assets/Scenes/SampleScene.unity @@ -7628,6 +7628,36 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: ac0b09e7857660247b1477e93731de29, type: 3} m_Name: m_EditorClassIdentifier: +--- !u!1 &185746014 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 185746015} + m_Layer: 0 + m_Name: RespawnPosition + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &185746015 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 185746014} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: -7.564, y: 2.318, z: -9.895229} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 5 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &266944714 GameObject: m_ObjectHideFlags: 0 @@ -7691,7 +7721,7 @@ Transform: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 266944714} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: -6.47, y: 1.52, z: -2.7893844} + m_LocalPosition: {x: -10.33, y: 1.49, z: -2.7893844} m_LocalScale: {x: 1, y: 1, z: 1} m_Children: - {fileID: 97386695} @@ -7829,7 +7859,7 @@ Transform: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 519420028} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 1.6028743, y: -2.0120425, z: -2.7893844} + m_LocalPosition: {x: 1.6028738, y: -2.0120423, z: -2.7893844} m_LocalScale: {x: 1, y: 1, z: 1} m_Children: [] m_Father: {fileID: 0} @@ -7976,6 +8006,7 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: movementSpeed: 4 + respawnPosition: {fileID: 185746015} --- !u!212 &1352658976 SpriteRenderer: m_ObjectHideFlags: 0 @@ -8032,7 +8063,7 @@ Transform: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1352658974} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: -6.47, y: 1.52, z: 7.2106156} + m_LocalPosition: {x: -10.33, y: 1.49, z: 7.2106156} m_LocalScale: {x: 7, y: 7, z: 0} m_Children: [] m_Father: {fileID: 0} diff --git a/Assets/Scripts/src/Player/PlayerController.cs b/Assets/Scripts/src/Player/PlayerController.cs index 58e9adb..5faea67 100644 --- a/Assets/Scripts/src/Player/PlayerController.cs +++ b/Assets/Scripts/src/Player/PlayerController.cs @@ -6,9 +6,14 @@ namespace src.Player { public class PlayerController : PlayerBase { + public Transform respawnPosition; + protected new void Start() { base.Start(); + + /* Always start at the starting point. */ + Respawn(); } private void Update() @@ -41,5 +46,10 @@ namespace src.Player // Console movement is not supported yet. #endif } + + private void Respawn() + { + transform.position = respawnPosition.position; + } } } \ No newline at end of file