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