Add boundaries to world map

This commit is contained in:
2022-08-28 21:04:20 -07:00
parent e59eb73745
commit 571639f8d1
2 changed files with 8 additions and 4 deletions

View File

@@ -1075,9 +1075,9 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: e12a799f5a50bc34a94898baf2917b7b, type: 3} m_Script: {fileID: 11500000, guid: e12a799f5a50bc34a94898baf2917b7b, type: 3}
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
rayCastDistance: 4 rayCastDistance: 10
rayCastAngle: 60 rayCastAngle: 60
sphereRadius: 1 sphereRadius: 5
--- !u!114 &7831886137308850989 --- !u!114 &7831886137308850989
MonoBehaviour: MonoBehaviour:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0

View File

@@ -1,4 +1,5 @@
using UnityEngine; using Scampz.GameJam.Assets.Scripts.Player;
using UnityEngine;
namespace Scampz.GameJam.Assets.Scripts namespace Scampz.GameJam.Assets.Scripts
{ {
@@ -8,10 +9,12 @@ namespace Scampz.GameJam.Assets.Scripts
public float Speed = 10f; public float Speed = 10f;
public float RotateSpeed = 720.0f; public float RotateSpeed = 720.0f;
private float _ySpeed = 0f; private float _ySpeed = 0f;
private PlayerState _playerState;
private void Start() private void Start()
{ {
_controller = GetComponent<CharacterController>(); _controller = GetComponent<CharacterController>();
_playerState = GetComponent<PlayerState>();
} }
void Update() void Update()
@@ -36,6 +39,7 @@ namespace Scampz.GameJam.Assets.Scripts
velocity = AdjustVelocityToSlope(velocity); velocity = AdjustVelocityToSlope(velocity);
velocity.y += _ySpeed; velocity.y += _ySpeed;
if (_playerState.CanMove)
_controller.Move(velocity * Time.deltaTime); _controller.Move(velocity * Time.deltaTime);
if (movementDirection != Vector3.zero) if (movementDirection != Vector3.zero)