Add boundaries to world map
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using UnityEngine;
|
||||
using Scampz.GameJam.Assets.Scripts.Player;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Scampz.GameJam.Assets.Scripts
|
||||
{
|
||||
@@ -8,10 +9,12 @@ namespace Scampz.GameJam.Assets.Scripts
|
||||
public float Speed = 10f;
|
||||
public float RotateSpeed = 720.0f;
|
||||
private float _ySpeed = 0f;
|
||||
private PlayerState _playerState;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
_controller = GetComponent<CharacterController>();
|
||||
_playerState = GetComponent<PlayerState>();
|
||||
}
|
||||
|
||||
void Update()
|
||||
@@ -36,7 +39,8 @@ namespace Scampz.GameJam.Assets.Scripts
|
||||
velocity = AdjustVelocityToSlope(velocity);
|
||||
velocity.y += _ySpeed;
|
||||
|
||||
_controller.Move(velocity * Time.deltaTime);
|
||||
if (_playerState.CanMove)
|
||||
_controller.Move(velocity * Time.deltaTime);
|
||||
|
||||
if (movementDirection != Vector3.zero)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user