From 4a70125fff6a59bbf2999d0defe652e4d09be60d Mon Sep 17 00:00:00 2001 From: haitem Date: Sat, 30 Jan 2021 16:49:08 +0100 Subject: [PATCH] Fix som things on dash --- Assets/Scenes/Filip.unity | 74 +++++++++++++++++++++++++++++++++ Assets/Scripts/PlayerManager.cs | 10 ++++- 2 files changed, 83 insertions(+), 1 deletion(-) diff --git a/Assets/Scenes/Filip.unity b/Assets/Scenes/Filip.unity index 8a831fb..1441a8d 100644 --- a/Assets/Scenes/Filip.unity +++ b/Assets/Scenes/Filip.unity @@ -214,6 +214,75 @@ Transform: m_Father: {fileID: 0} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1001 &509978202 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 0} + m_Modifications: + - target: {fileID: 7120608647080996497, guid: 597897b562955934fae65d62e0a8e3cd, + type: 3} + propertyPath: m_Name + value: PushPullCube + objectReference: {fileID: 0} + - target: {fileID: 7120608647080996506, guid: 597897b562955934fae65d62e0a8e3cd, + type: 3} + propertyPath: m_RootOrder + value: 4 + objectReference: {fileID: 0} + - target: {fileID: 7120608647080996506, guid: 597897b562955934fae65d62e0a8e3cd, + type: 3} + propertyPath: m_LocalPosition.x + value: 4.67 + objectReference: {fileID: 0} + - target: {fileID: 7120608647080996506, guid: 597897b562955934fae65d62e0a8e3cd, + type: 3} + propertyPath: m_LocalPosition.y + value: 0.76 + objectReference: {fileID: 0} + - target: {fileID: 7120608647080996506, guid: 597897b562955934fae65d62e0a8e3cd, + type: 3} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 7120608647080996506, guid: 597897b562955934fae65d62e0a8e3cd, + type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 7120608647080996506, guid: 597897b562955934fae65d62e0a8e3cd, + type: 3} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 7120608647080996506, guid: 597897b562955934fae65d62e0a8e3cd, + type: 3} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 7120608647080996506, guid: 597897b562955934fae65d62e0a8e3cd, + type: 3} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 7120608647080996506, guid: 597897b562955934fae65d62e0a8e3cd, + type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 7120608647080996506, guid: 597897b562955934fae65d62e0a8e3cd, + type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 7120608647080996506, guid: 597897b562955934fae65d62e0a8e3cd, + type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: 597897b562955934fae65d62e0a8e3cd, type: 3} --- !u!1 &964739489 GameObject: m_ObjectHideFlags: 0 @@ -318,6 +387,11 @@ PrefabInstance: propertyPath: m_Name value: Player objectReference: {fileID: 0} + - target: {fileID: 7094923891560833916, guid: e4d82994b58b7304b91c915c597b71f8, + type: 3} + propertyPath: activeAbility.Array.data[0] + value: 0 + objectReference: {fileID: 0} - target: {fileID: 7094923891560833917, guid: e4d82994b58b7304b91c915c597b71f8, type: 3} propertyPath: m_RootOrder diff --git a/Assets/Scripts/PlayerManager.cs b/Assets/Scripts/PlayerManager.cs index 2d022c2..589fd50 100644 --- a/Assets/Scripts/PlayerManager.cs +++ b/Assets/Scripts/PlayerManager.cs @@ -24,6 +24,7 @@ public class PlayerManager : MonoBehaviour public float dashTime = 0.2f; private float actualDashTime; private int dashButton; + private bool dash = false; private bool startEating = false; @@ -92,7 +93,7 @@ public class PlayerManager : MonoBehaviour } else if (activeAbility.Count > 0 && activeAbility[0] == 3) { - if (Input.GetKeyUp(KeyCode.D) || Input.GetKeyUp(KeyCode.A)) { + if (Input.GetKeyUp(KeyCode.D) || Input.GetKeyUp(KeyCode.A) && !dash) { if (actualDashTime < Time.time) { if (Input.GetKeyUp(KeyCode.D)) @@ -113,6 +114,7 @@ public class PlayerManager : MonoBehaviour (transform.up * 1 * 10 * Time.deltaTime), ForceMode.VelocityChange ); + dash = true; dashButton = 0; actualDashTime = Time.time - 1f; } @@ -123,6 +125,7 @@ public class PlayerManager : MonoBehaviour (transform.up * 1 * 10 * Time.deltaTime), ForceMode.VelocityChange ); + dash = true; dashButton = 0; actualDashTime = Time.time - 1f; } @@ -300,6 +303,7 @@ public class PlayerManager : MonoBehaviour rigidBody.MovePosition(transform.position); onGround = true; dubleJump = true; + dash = false; } } @@ -308,6 +312,7 @@ public class PlayerManager : MonoBehaviour if (other.tag == "Ground" || other.tag == "Objects") { onGround = false; + dash = false; } } @@ -320,6 +325,9 @@ public class PlayerManager : MonoBehaviour onGround = true; dubleJump = true; } + if (onGround) { + dash = false; + } } }