pause implementation

This commit is contained in:
Rizvee committed 2022-02-21 19:17:16 -06:00
1 parent 7ba5981a03
commit 668924c0a8
3 files changed
+168 -86

No files matched your search

@@ -41,7 +41,7 @@ Texture2D:
m_ColorSpace: 0
m_PlatformBlob:
image data: 1048576
_typelessdata: 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020507080e11131310090907030608090d0f100f09090703030709090d0f0f0c07070401000000000000000000000000000000000306070707070707070707070707070707070707070707070707070707070707070707070707070707070706050300000000000000000000000000000000050a0e10101109090703000000000000000000000000000000000000000000030608091113120e080705020000000000000000000000000000000000000000000000010507070f13110b0a080400000000000000000407090a0d0a0a0804000000000000000000000000000000000000000000000000000000000000000000000000000000000000000406071013100a060503000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002090e1214151b1e201f1d1615130f1215151a1c1d1c1615130f0f1315161a1b1c191413110d0801000000000000000000000000060c1012131414141414141414141414141414141414141414141414141414141414141414141414141414141413120f0b06000000000000000000000000030a11161a1c1d1e1615130f0a040000000000000000000000000000000000040a0f1315161e201e1b1414110e09020000000000000000000000000000000000000002080d1113141c1f1e171714110c0500000000050b101316171a171614100b05000000000000000000000000000000000000000000000000000000000000000000000000000000070c1013131d1f1c1713120f0b0600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000Line truncated
_typelessdata: 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020507080e11131310090907030608090d0f100f09090703030709090d0f0f0c07070401000000000000000000000000000000000306070707070707070707070707070707070707070707070707070707070707070707070707070707070706050300000000000000000000000000000000050a0e10101109090703000000000000000000000000000000000000000000030608091113120e080705020000000000000000000000000000000000000000000000010507070f13110b0a080400000000000000000407090a0d0a0a0804000000000000000000000000000000000000000000000000000000000000000000000000000000000000000406071013100a060503000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002090e1214151b1e201f1d1615130f1215151a1c1d1c1615130f0f1315161a1b1c191413110d0801000000000000000000000000060c1012131414141414141414141414141414141414141414141414141414141414141414141414141414141413120f0b06000000000000000000000000030a11161a1c1d1e1615130f0a040000000000000000000000000000000000040a0f1315161e201e1b1414110e09020000000000000000000000000000000000000002080d1113141c1f1e171714110c0500000000050b101316171a171614100b05000000000000000000000000000000000000000000000000000000000000000000000000000000070c1013131d1f1c1713120f0b0600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000Line truncated
m_StreamData:
serializedVersion: 2
offset: 0
@@ -859,6 +859,20 @@ MonoBehaviour:
m_Height: 37
m_Scale: 1
m_AtlasIndex: 0
- m_Index: 191
m_Metrics:
m_Width: 13.8125
m_Height: 13.09375
m_HorizontalBearingX: 5.75
m_HorizontalBearingY: 59.984375
m_HorizontalAdvance: 26.234375
m_GlyphRect:
m_X: 176
m_Y: 539
m_Width: 15
m_Height: 14
m_Scale: 1
m_AtlasIndex: 0
m_CharacterTable:
- m_ElementType: 1
m_Unicode: 32
@@ -1080,6 +1094,10 @@ MonoBehaviour:
m_Unicode: 122
m_GlyphIndex: 91
m_Scale: 1
- m_ElementType: 1
m_Unicode: 34
m_GlyphIndex: 191
m_Scale: 1
m_AtlasTextures:
- {fileID: -945783019454701266}
m_AtlasTextureIndex: 0
@@ -1302,6 +1320,10 @@ MonoBehaviour:
m_Y: 290
m_Width: 49
m_Height: 56
- m_X: 166
m_Y: 529
m_Width: 34
m_Height: 33
m_FreeGlyphRects:
- m_X: 296
m_Y: 0
@@ -1447,18 +1469,6 @@ MonoBehaviour:
m_Y: 529
m_Width: 808
m_Height: 494
- m_X: 196
m_Y: 529
m_Width: 827
m_Height: 304
- m_X: 166
m_Y: 529
m_Width: 857
m_Height: 34
- m_X: 170
m_Y: 529
m_Width: 853
m_Height: 233
- m_X: 137
m_Y: 392
m_Width: 44
@@ -1491,6 +1501,22 @@ MonoBehaviour:
m_Y: 346
m_Width: 793
m_Height: 677
- m_X: 196
m_Y: 562
m_Width: 827
m_Height: 271
- m_X: 200
m_Y: 529
m_Width: 823
m_Height: 304
- m_X: 166
m_Y: 562
m_Width: 857
m_Height: 1
- m_X: 170
m_Y: 562
m_Width: 853
m_Height: 200
m_fontInfo:
Name:
PointSize: 0
@@ -2588,6 +2614,66 @@ MonoBehaviour:
m_XAdvance: 0
m_YAdvance: 0
m_FeatureLookupFlags: 0
- m_FirstAdjustmentRecord:
m_GlyphIndex: 34
m_GlyphValueRecord:
m_XPlacement: 0
m_YPlacement: 0
m_XAdvance: -13.71875
m_YAdvance: 0
m_SecondAdjustmentRecord:
m_GlyphIndex: 191
m_GlyphValueRecord:
m_XPlacement: 0
m_YPlacement: 0
m_XAdvance: 0
m_YAdvance: 0
m_FeatureLookupFlags: 0
- m_FirstAdjustmentRecord:
m_GlyphIndex: 45
m_GlyphValueRecord:
m_XPlacement: 0
m_YPlacement: 0
m_XAdvance: -23.328125
m_YAdvance: 0
m_SecondAdjustmentRecord:
m_GlyphIndex: 191
m_GlyphValueRecord:
m_XPlacement: 0
m_YPlacement: 0
m_XAdvance: 0
m_YAdvance: 0
m_FeatureLookupFlags: 0
- m_FirstAdjustmentRecord:
m_GlyphIndex: 71
m_GlyphValueRecord:
m_XPlacement: 0
m_YPlacement: 0
m_XAdvance: -3.390625
m_YAdvance: 0
m_SecondAdjustmentRecord:
m_GlyphIndex: 191
m_GlyphValueRecord:
m_XPlacement: 0
m_YPlacement: 0
m_XAdvance: 0
m_YAdvance: 0
m_FeatureLookupFlags: 0
- m_FirstAdjustmentRecord:
m_GlyphIndex: 191
m_GlyphValueRecord:
m_XPlacement: 0
m_YPlacement: 0
m_XAdvance: -15.375
m_YAdvance: 0
m_SecondAdjustmentRecord:
m_GlyphIndex: 34
m_GlyphValueRecord:
m_XPlacement: 0
m_YPlacement: 0
m_XAdvance: 0
m_YAdvance: 0
m_FeatureLookupFlags: 0
fallbackFontAssets: []
m_FallbackFontAssetTable: []
m_CreationSettings:
+62 -58
View File
@@ -20,6 +20,7 @@ public class Movement : MonoBehaviour
private Rigidbody2D m_Rigidbody2D;
private bool m_FacingRight = true; // For determining which way the player is currently facing.
private Vector3 m_Velocity = Vector3.zero;
public static bool pause = false;
[Header("Events")]
[Space]
@@ -65,74 +66,77 @@ public class Movement : MonoBehaviour
public void Move(float move, bool crouch, bool jump)
{
// If crouching, check to see if the character can stand up
if (!crouch)
if(!pause)
{
// If the character has a ceiling preventing them from standing up, keep them crouching
if (Physics2D.OverlapCircle(m_CeilingCheck.position, k_CeilingRadius, m_WhatIsGround))
// If crouching, check to see if the character can stand up
if (!crouch)
{
crouch = true;
}
}
//only control the player if grounded or airControl is turned on
if (m_Grounded || m_AirControl)
{
// If crouching
if (crouch)
{
if (!m_wasCrouching)
// If the character has a ceiling preventing them from standing up, keep them crouching
if (Physics2D.OverlapCircle(m_CeilingCheck.position, k_CeilingRadius, m_WhatIsGround))
{
m_wasCrouching = true;
OnCrouchEvent.Invoke(true);
}
// Reduce the speed by the crouchSpeed multiplier
move *= m_CrouchSpeed;
// Disable one of the colliders when crouching
if (m_CrouchDisableCollider != null)
m_CrouchDisableCollider.enabled = false;
}
else
{
// Enable the collider when not crouching
if (m_CrouchDisableCollider != null)
m_CrouchDisableCollider.enabled = true;
if (m_wasCrouching)
{
m_wasCrouching = false;
OnCrouchEvent.Invoke(false);
crouch = true;
}
}
// Move the character by finding the target velocity
Vector3 targetVelocity = new Vector2(move * 10f, m_Rigidbody2D.velocity.y);
// And then smoothing it out and applying it to the character
m_Rigidbody2D.velocity = Vector3.SmoothDamp(m_Rigidbody2D.velocity, targetVelocity, ref m_Velocity, m_MovementSmoothing);
//only control the player if grounded or airControl is turned on
if (m_Grounded || m_AirControl)
{
// If the input is moving the player right and the player is facing left...
if (move > 0 && !m_FacingRight)
{
// ... flip the player.
Flip();
// If crouching
if (crouch)
{
if (!m_wasCrouching)
{
m_wasCrouching = true;
OnCrouchEvent.Invoke(true);
}
// Reduce the speed by the crouchSpeed multiplier
move *= m_CrouchSpeed;
// Disable one of the colliders when crouching
if (m_CrouchDisableCollider != null)
m_CrouchDisableCollider.enabled = false;
}
else
{
// Enable the collider when not crouching
if (m_CrouchDisableCollider != null)
m_CrouchDisableCollider.enabled = true;
if (m_wasCrouching)
{
m_wasCrouching = false;
OnCrouchEvent.Invoke(false);
}
}
// Move the character by finding the target velocity
Vector3 targetVelocity = new Vector2(move * 10f, m_Rigidbody2D.velocity.y);
// And then smoothing it out and applying it to the character
m_Rigidbody2D.velocity = Vector3.SmoothDamp(m_Rigidbody2D.velocity, targetVelocity, ref m_Velocity, m_MovementSmoothing);
// If the input is moving the player right and the player is facing left...
if (move > 0 && !m_FacingRight)
{
// ... flip the player.
Flip();
}
// Otherwise if the input is moving the player left and the player is facing right...
else if (move < 0 && m_FacingRight)
{
// ... flip the player.
Flip();
}
}
// Otherwise if the input is moving the player left and the player is facing right...
else if (move < 0 && m_FacingRight)
// If the player should jump...
if (m_Grounded && jump)
{
// ... flip the player.
Flip();
// Add a vertical force to the player.
m_Grounded = false;
m_Rigidbody2D.AddForce(new Vector2(0f, m_JumpForce));
}
}
}
// If the player should jump...
if (m_Grounded && jump)
{
// Add a vertical force to the player.
m_Grounded = false;
m_Rigidbody2D.AddForce(new Vector2(0f, m_JumpForce));
}
}
+7 -15
View File
@@ -266,7 +266,6 @@ MonoBehaviour:
m_EditorClassIdentifier:
controller: {fileID: 187176290}
runSpeed: 40
test: {fileID: 1543674772}
--- !u!1 &519420028
GameObject:
m_ObjectHideFlags: 0
@@ -579,17 +578,6 @@ Transform:
m_Father: {fileID: 0}
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &1543674772 stripped
MonoBehaviour:
m_CorrespondingSourceObject: {fileID: 3758862681294202868, guid: 6ea336e93a8128346aad568255a7e6af, type: 3}
m_PrefabInstance: {fileID: 7059772332933783824}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 4098cb6d8f351b44ca98b3bb6311f330, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!1 &1650102864
GameObject:
m_ObjectHideFlags: 0
@@ -807,15 +795,19 @@ PrefabInstance:
objectReference: {fileID: 0}
- target: {fileID: 3758862681294202868, guid: 6ea336e93a8128346aad568255a7e6af, type: 3}
propertyPath: pages.Array.size
value: 2
value: 3
objectReference: {fileID: 0}
- target: {fileID: 3758862681294202868, guid: 6ea336e93a8128346aad568255a7e6af, type: 3}
propertyPath: pages.Array.data[0]
value: '"this is a testsadfasdfsadfsadfasdfasdfasdfasdf"'
value: blah blah balaba blaha balh blah blah blah blah
objectReference: {fileID: 0}
- target: {fileID: 3758862681294202868, guid: 6ea336e93a8128346aad568255a7e6af, type: 3}
propertyPath: pages.Array.data[1]
value: '"test part 2"'
value: this is a generic questline
objectReference: {fileID: 0}
- target: {fileID: 3758862681294202868, guid: 6ea336e93a8128346aad568255a7e6af, type: 3}
propertyPath: pages.Array.data[2]
value: congrats you won
objectReference: {fileID: 0}
- target: {fileID: 7059772333487008123, guid: 6ea336e93a8128346aad568255a7e6af, type: 3}
propertyPath: m_Name