Add SFX to dialogue, revamp control scheme (broken world map camera)

This commit is contained in:
2022-08-17 22:12:53 -07:00
parent 294b113598
commit bc8092d454
29 changed files with 1413 additions and 485 deletions

View File

@@ -7,7 +7,7 @@ namespace Scampz.GameJam.Assets.Scripts
private CharacterController _controller;
private RayCaster _caster;
public float Speed = 10f;
public float RotateSpeed = 1.0f;
public float RotateSpeed = 720.0f;
private void Start()
{
@@ -17,15 +17,16 @@ namespace Scampz.GameJam.Assets.Scripts
void Update()
{
// Rotation
transform.Rotate(0, Input.GetAxis(InputOptions.Horizontal) * RotateSpeed, 0);
var direction = new Vector3(Input.GetAxisRaw(InputOptions.Horizontal), 0, Input.GetAxisRaw(InputOptions.Vertical)).normalized;
// Move
if (_caster.IsWithinBounds())
_controller.SimpleMove(-direction * Speed);
if (direction != Vector3.zero)
{
var forward = transform.TransformDirection(Vector3.forward);
var curSpeed = Speed * Input.GetAxis(InputOptions.Vertical);
_controller.SimpleMove(forward * curSpeed);
var toRotation = Quaternion.LookRotation(-direction, Vector3.up);
transform.rotation = Quaternion.RotateTowards(transform.rotation, toRotation, RotateSpeed);
}
}
}