Playable demo build (no airship)
This commit is contained in:
@@ -5,8 +5,6 @@ namespace Scampz.GameJam.Assets.Scripts.Player
|
||||
public class PlayerState : MonoBehaviour
|
||||
{
|
||||
private Animator _animator;
|
||||
private RayCaster _rayCaster;
|
||||
|
||||
private bool _canMove;
|
||||
private GameObject _player;
|
||||
private CharacterController _characterController;
|
||||
@@ -14,16 +12,17 @@ namespace Scampz.GameJam.Assets.Scripts.Player
|
||||
private void Start()
|
||||
{
|
||||
_animator = GetComponent<Animator>();
|
||||
_rayCaster = GetComponent<RayCaster>();
|
||||
_player = GameObject.FindGameObjectWithTag("Player");
|
||||
_characterController = _player.GetComponent<CharacterController>();
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
_canMove = true;
|
||||
_animator.SetFloat("Speed", _characterController.velocity.magnitude);
|
||||
if (_rayCaster.enabled)
|
||||
_canMove = _rayCaster.IsWithinBounds();
|
||||
var rayCasterExists = TryGetComponent<RayCaster>(out var rayCaster);
|
||||
if (rayCasterExists)
|
||||
_canMove = rayCaster.IsWithinBoundsWithRay();
|
||||
}
|
||||
|
||||
public bool CanMove => _canMove;
|
||||
|
||||
Reference in New Issue
Block a user