From eac05d6bfec48944261f52cf1d72c5663a1da934 Mon Sep 17 00:00:00 2001 From: Piegames <14054505+piegamesde@users.noreply.github.com> Date: Tue, 24 Apr 2018 16:06:43 +0200 Subject: [PATCH] Boosting --- Assets/Scenes/CodeDEV.unity | 2 +- Assets/Scripts/PlayerMovement.cs | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/Assets/Scenes/CodeDEV.unity b/Assets/Scenes/CodeDEV.unity index acaeac4..c61063d 100644 --- a/Assets/Scenes/CodeDEV.unity +++ b/Assets/Scenes/CodeDEV.unity @@ -1543,7 +1543,7 @@ Prefab: - target: {fileID: 224150154901314796, guid: 460d856ea4eb14cedb5fecde1fe6d743, type: 2} propertyPath: m_AnchoredPosition.x - value: 38.603355 + value: 38.643215 objectReference: {fileID: 0} - target: {fileID: 224150154901314796, guid: 460d856ea4eb14cedb5fecde1fe6d743, type: 2} diff --git a/Assets/Scripts/PlayerMovement.cs b/Assets/Scripts/PlayerMovement.cs index 875673c..330cc3d 100644 --- a/Assets/Scripts/PlayerMovement.cs +++ b/Assets/Scripts/PlayerMovement.cs @@ -6,6 +6,8 @@ public class PlayerMovement : MonoBehaviour { [SerializeField] public float acceleration = 3; + [SerializeField] + public float boost = 2; [SerializeField] public float friction = 0.1f; [SerializeField] @@ -137,6 +139,8 @@ public class PlayerMovement : MonoBehaviour { Vector3 acc = transform.up * acceleration; if (braking) acc *= 0; + if (Input.GetAxis("Vertical") > 0) + acc *= boost; rb.AddForce(acc); } {// Drag