Fix som things on dash

This commit is contained in:
haitem 2021-01-30 16:49:08 +01:00
parent dc2b984951
commit 4a70125fff
2 changed files with 83 additions and 1 deletions

View File

@ -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

View File

@ -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;
}
}
}