Make jump speed a public variable
This commit is contained in:
@@ -840,7 +840,7 @@ MonoBehaviour:
|
|||||||
m_Script: {fileID: 11500000, guid: 184b34bca7785c52e81be409a778c622, type: 3}
|
m_Script: {fileID: 11500000, guid: 184b34bca7785c52e81be409a778c622, type: 3}
|
||||||
m_Name:
|
m_Name:
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
speed: 4
|
speed: 5
|
||||||
gravity: -9.81
|
gravity: -9.81
|
||||||
velocity: {x: 0, y: 0, z: 0}
|
velocity: {x: 0, y: 0, z: 0}
|
||||||
drag: {x: 0.1, y: 0.1, z: 0.1}
|
drag: {x: 0.1, y: 0.1, z: 0.1}
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ public class FishController : MonoBehaviour
|
|||||||
{
|
{
|
||||||
public float speed = 4f;
|
public float speed = 4f;
|
||||||
public float gravity = -9.81f;
|
public float gravity = -9.81f;
|
||||||
|
public float jumpSpeed = 8;
|
||||||
public Vector3 velocity;
|
public Vector3 velocity;
|
||||||
public Vector3 drag;
|
public Vector3 drag;
|
||||||
|
|
||||||
@@ -32,7 +33,7 @@ public class FishController : MonoBehaviour
|
|||||||
|
|
||||||
if (Input.GetButtonDown("Jump") && controller.isGrounded)
|
if (Input.GetButtonDown("Jump") && controller.isGrounded)
|
||||||
{
|
{
|
||||||
velocity.y += 8;
|
velocity.y += jumpSpeed;
|
||||||
}
|
}
|
||||||
|
|
||||||
velocity.x = moveX * speed;
|
velocity.x = moveX * speed;
|
||||||
@@ -43,7 +44,6 @@ public class FishController : MonoBehaviour
|
|||||||
|
|
||||||
if (moveVelocity.y < 0 && Math.Abs(moveVelocity.y) < controller.minMoveDistance)
|
if (moveVelocity.y < 0 && Math.Abs(moveVelocity.y) < controller.minMoveDistance)
|
||||||
{
|
{
|
||||||
Debug.Log(String.Format("Abs velocity: {0}, controller.minMoveDistance: {1}", Math.Abs(moveVelocity.y), controller.minMoveDistance));
|
|
||||||
moveVelocity.y = (gravity * 0.1f) * Time.deltaTime;
|
moveVelocity.y = (gravity * 0.1f) * Time.deltaTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user