Switch back to sphere casting
This commit is contained in:
@@ -1,27 +1,28 @@
|
||||
using UnityEngine;
|
||||
using Scampz.GameJam.Assets.Scripts.Player;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Scampz.GameJam.Assets.Scripts
|
||||
{
|
||||
public class CharacterInputController : MonoBehaviour
|
||||
{
|
||||
private CharacterController _controller;
|
||||
private RayCaster _caster;
|
||||
public float Speed = 10f;
|
||||
public float RotateSpeed = 720.0f;
|
||||
private Animator _animator;
|
||||
private PlayerState _playerState;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
_controller = GetComponent<CharacterController>();
|
||||
_caster = _controller.GetComponent<RayCaster>();
|
||||
_animator = GetComponent<Animator>();
|
||||
_playerState = GetComponent<PlayerState>();
|
||||
}
|
||||
|
||||
void Update()
|
||||
{
|
||||
var direction = new Vector3(Input.GetAxisRaw(InputOptions.Horizontal), 0, Input.GetAxisRaw(InputOptions.Vertical)).normalized;
|
||||
|
||||
if (_caster.IsWithinBounds())
|
||||
if (_playerState.CanMove)
|
||||
_controller.SimpleMove(-direction * Speed);
|
||||
|
||||
if (direction != Vector3.zero)
|
||||
|
||||
Reference in New Issue
Block a user