Cease v0.5
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
using Scampz.GameJam.Assets.Scripts.Player;
|
||||
using UnityEngine;
|
||||
using UnityEngine.InputSystem;
|
||||
|
||||
namespace Scampz.GameJam.Assets.Scripts
|
||||
{
|
||||
@@ -10,6 +11,28 @@ namespace Scampz.GameJam.Assets.Scripts
|
||||
public float RotateSpeed = 720.0f;
|
||||
private float _ySpeed = 0f;
|
||||
private PlayerState _playerState;
|
||||
public PlayerControls playerControls;
|
||||
private InputAction move;
|
||||
private InputAction sprint;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
playerControls = new PlayerControls();
|
||||
}
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
move = playerControls.Player.Move;
|
||||
sprint = playerControls.Player.Sprint;
|
||||
move.Enable();
|
||||
sprint.Enable();
|
||||
}
|
||||
|
||||
private void OnDisable()
|
||||
{
|
||||
move.Disable();
|
||||
sprint.Disable();
|
||||
}
|
||||
|
||||
private void Start()
|
||||
{
|
||||
@@ -25,12 +48,10 @@ namespace Scampz.GameJam.Assets.Scripts
|
||||
void Move()
|
||||
{
|
||||
var movementSpeed = Speed;
|
||||
if (Input.GetButton(InputOptions.Sprint))
|
||||
if (sprint.IsPressed())
|
||||
movementSpeed *= 2;
|
||||
var horizontalMovement = Input.GetAxisRaw(InputOptions.Horizontal);
|
||||
var verticalMovement = Input.GetAxisRaw(InputOptions.Vertical);
|
||||
|
||||
var movementDirection = new Vector3(-horizontalMovement, 0, -verticalMovement);
|
||||
var movement = move.ReadValue<Vector2>();
|
||||
var movementDirection = new Vector3(-movement.x, 0, -movement.y);
|
||||
var magnitude = Mathf.Clamp01(movementDirection.magnitude) * movementSpeed;
|
||||
movementDirection.Normalize();
|
||||
_ySpeed += Physics.gravity.y * Time.deltaTime;
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
namespace Scampz.GameJam.Assets.Scripts
|
||||
{
|
||||
public static class InputOptions
|
||||
{
|
||||
public static string Vertical => "Vertical";
|
||||
|
||||
public static string Horizontal => "Horizontal";
|
||||
|
||||
public static string Submit => "Submit";
|
||||
|
||||
public static string Cancel => "Cancel";
|
||||
|
||||
public static string Sprint => "Sprint";
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 032f3415ba7c171498cf298f0fb45c7e
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user