change: separated all functions of movement into separate tasks
This commit is contained in:
56
Assets/Scripts/Player/UnitMovementHandler.cs
Normal file
56
Assets/Scripts/Player/UnitMovementHandler.cs
Normal file
@@ -0,0 +1,56 @@
|
||||
using UnityEngine;
|
||||
using Drawing;
|
||||
|
||||
public class PlayerMovement : MonoBehaviour
|
||||
{
|
||||
// Raycasts
|
||||
public RaycastHit forwardRay;
|
||||
public RaycastHit leftRay;
|
||||
public RaycastHit rightRay;
|
||||
|
||||
// References
|
||||
private Player thisPlayer;
|
||||
|
||||
void Awake(){
|
||||
thisPlayer = GetComponent<Player>();
|
||||
}
|
||||
|
||||
// void Update(){
|
||||
// // Create Ray Colors
|
||||
// Color forwardRayStatus = Color.red;
|
||||
// Color leftRayStatus = Color.red;
|
||||
// Color rightRayStatus = Color.red;
|
||||
//
|
||||
// if (forwardRay.collider&& forwardRay.transform.gameObject.layer == LayerMask.NameToLayer("Environment")){ forwardRayStatus = Color.green;}
|
||||
// if (leftRay.collider&& leftRay.transform.gameObject.layer == LayerMask.NameToLayer("Environment")){ leftRayStatus = Color.green;}
|
||||
// if (rightRay.collider&& rightRay.transform.gameObject.layer == LayerMask.NameToLayer("Environment")){ rightRayStatus = Color.green;}
|
||||
//
|
||||
// using (Draw.WithColor(forwardRayStatus)) {
|
||||
// Draw.Line(transform.position + transform.up, transform.position + transform.forward * 2.5f + transform.up);
|
||||
// }
|
||||
//
|
||||
// using (Draw.WithColor(leftRayStatus)) {
|
||||
// Draw.Line(transform.position + transform.up, transform.position + -transform.right * 2f + transform.up);
|
||||
// }
|
||||
//
|
||||
// using (Draw.WithColor(rightRayStatus)) {
|
||||
// Draw.Line(transform.position + transform.up, transform.position + transform.right * 2f + transform.up);
|
||||
// }
|
||||
// }
|
||||
|
||||
// void FixedUpdate(){
|
||||
// LayerMask environmentLayer = LayerMask.NameToLayer("Environment");
|
||||
//
|
||||
// if (Physics.Raycast(transform.position + Vector3.up, transform.forward, out forwardRay, 2.5f, ~environmentLayer)){
|
||||
// thisPlayer.controls.graph.SendEvent("ForwardRay", true, null);
|
||||
// }
|
||||
//
|
||||
// if (Physics.Raycast(transform.position + Vector3.up, transform.position + Vector3.left, out leftRay, maxDistance: 2f, ~environmentLayer )) {
|
||||
// thisPlayer.controls.graph.SendEvent("LeftRay", true, null);
|
||||
// }
|
||||
//
|
||||
// if (Physics.Raycast(transform.position + Vector3.up, transform.position + Vector3.right, out rightRay, maxDistance: 2f, ~environmentLayer )) {
|
||||
// thisPlayer.controls.graph.SendEvent("RightRay", true, null);
|
||||
// }
|
||||
// }
|
||||
}
|
||||
Reference in New Issue
Block a user