change: started unified movement handler
This commit is contained in:
@@ -1,56 +1,33 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using Drawing;
|
using Drawing;
|
||||||
|
using Sirenix.OdinInspector;
|
||||||
|
|
||||||
public class PlayerMovement : MonoBehaviour
|
namespace Reset.Unit{
|
||||||
{
|
public class UnitMovementHandler : MonoBehaviour{
|
||||||
// Raycasts
|
private CharacterController controller;
|
||||||
public RaycastHit forwardRay;
|
|
||||||
public RaycastHit leftRay;
|
|
||||||
public RaycastHit rightRay;
|
|
||||||
|
|
||||||
// References
|
// Move Speed
|
||||||
private Player thisPlayer;
|
[ShowInInspector, ReadOnly] private float currentSpeed;
|
||||||
|
public float targetSpeed;
|
||||||
|
public float smoothing = 10f;
|
||||||
|
|
||||||
|
// Jumping
|
||||||
|
[ShowInInspector, ReadOnly] private float jumpPower;
|
||||||
|
public float jumpPowerDecay;
|
||||||
|
|
||||||
|
// Gravity
|
||||||
|
[ShowInInspector, ReadOnly] public float gravityPower;
|
||||||
|
public float gravityMax;
|
||||||
|
public float gravityAcceleration;
|
||||||
|
|
||||||
void Awake(){
|
void Awake(){
|
||||||
thisPlayer = GetComponent<Player>();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// void Update(){
|
public void DoMovement(Vector3 moveDir, float speed){
|
||||||
// // Create Ray Colors
|
controller.Move(moveDir * speed * Time.deltaTime);
|
||||||
// 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