go to home and quit button fixed + resume via esc

Main_Menu
Balex123 2 years ago
parent 451fbd7ce1
commit d0e3f9a6ae

@ -8,12 +8,28 @@ public class PauseMenu : MonoBehaviour
public GameObject pauseMenu;
private bool paused = false;
public GameObject homeObj;
public PlayerMovement mov;
void Update()
{
if (Input.GetKeyDown(KeyCode.Escape))
{
paused = !paused;
}
ToggleActive();
}
public void ResumeGame()
{
paused = false;
}
public void GoToHome()
{
mov.rb.position = homeObj.transform.position;
paused = false;
}
private void ToggleActive()
{
if (paused)
{
pauseMenu.SetActive(true);

@ -217,7 +217,7 @@ RectTransform:
m_Children:
- {fileID: 345050014}
m_Father: {fileID: 0}
m_RootOrder: 5
m_RootOrder: 4
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
@ -584,13 +584,13 @@ MonoBehaviour:
m_OnClick:
m_PersistentCalls:
m_Calls:
- m_Target: {fileID: 0}
m_TargetAssemblyTypeName:
m_MethodName:
- m_Target: {fileID: 1426947902}
m_TargetAssemblyTypeName: PauseMenu, Assembly-CSharp
m_MethodName: GoToHome
m_Mode: 1
m_Arguments:
m_ObjectArgument: {fileID: 0}
m_ObjectArgumentAssemblyTypeName:
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
m_IntArgument: 0
m_FloatArgument: 0
m_StringArgument:
@ -667,6 +667,37 @@ Transform:
m_Father: {fileID: 0}
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &305885761
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 305885762}
m_Layer: 0
m_Name: Home
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &305885762
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 305885761}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: -44.1, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 6
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &345050013
GameObject:
m_ObjectHideFlags: 0
@ -770,7 +801,7 @@ Transform:
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 4
m_RootOrder: 5
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &874085733
GameObject:
@ -5780,6 +5811,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: a238c84151853e1438fb4bf8922712a7, type: 3}
m_Name:
m_EditorClassIdentifier:
rb: {fileID: 0}
drag: 1
GroundLayer:
serializedVersion: 2
@ -5821,6 +5853,8 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
pauseMenu: {fileID: 345050013}
homeObj: {fileID: 305885761}
mov: {fileID: 1426947900}
--- !u!1 &1504207989
GameObject:
m_ObjectHideFlags: 0
@ -5935,13 +5969,13 @@ MonoBehaviour:
m_OnClick:
m_PersistentCalls:
m_Calls:
- m_Target: {fileID: 0}
m_TargetAssemblyTypeName:
m_MethodName:
- m_Target: {fileID: 1426947902}
m_TargetAssemblyTypeName: PauseMenu, Assembly-CSharp
m_MethodName: ResumeGame
m_Mode: 1
m_Arguments:
m_ObjectArgument: {fileID: 0}
m_ObjectArgumentAssemblyTypeName:
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
m_IntArgument: 0
m_FloatArgument: 0
m_StringArgument:
@ -6631,7 +6665,7 @@ MonoBehaviour:
m_IntArgument: 0
m_FloatArgument: 0
m_StringArgument:
m_BoolArgument: 1
m_BoolArgument: 0
m_CallState: 2
--- !u!114 &1812337264
MonoBehaviour:

@ -6,7 +6,7 @@ using UnityEngine.InputSystem;
public class PlayerMovement : MonoBehaviour
{
private Rigidbody2D rb;
public Rigidbody2D rb;
private SpriteRenderer SR;
private Transform Gr;
private Animator Ani;

File diff suppressed because one or more lines are too long

@ -12,10 +12,10 @@ EditorUserSettings:
value: 0508030352075a085a565a7b41200f44431619287e2925342e2f1b6ae3b86439
flags: 0
RecentlyUsedSceneGuid-2:
value: 02095251535050595d5e0f2311735c44124f1c2e7b7077667f7e4560b7b3306b
value: 50545254560458595a5e0e7748215d4442161e7e7b2e22342e2c4866b6b4376a
flags: 0
RecentlyUsedSceneGuid-3:
value: 50545254560458595a5e0e7748215d4442161e7e7b2e22342e2c4866b6b4376a
value: 02095251535050595d5e0f2311735c44124f1c2e7b7077667f7e4560b7b3306b
flags: 0
vcSharedLogLevel:
value: 0d5e400f0650

Loading…
Cancel
Save