From 9e321677c5112db5f304692288e0334018d748d2 Mon Sep 17 00:00:00 2001 From: Chris Date: Tue, 15 Jul 2025 17:01:58 -0400 Subject: [PATCH] changed: changed facing direction into BBParamater --- Assets/Scripts/Core/Graph Tasks/AddJump.cs | 5 +++-- .../Core/Graph Tasks/CalculateAirMovement.cs | 6 ++++-- .../Scripts/Core/Graph Tasks/ProcessMovement.cs | 16 ++++++++++------ 3 files changed, 17 insertions(+), 10 deletions(-) diff --git a/Assets/Scripts/Core/Graph Tasks/AddJump.cs b/Assets/Scripts/Core/Graph Tasks/AddJump.cs index 6f16a3d..9b6ea07 100644 --- a/Assets/Scripts/Core/Graph Tasks/AddJump.cs +++ b/Assets/Scripts/Core/Graph Tasks/AddJump.cs @@ -5,7 +5,7 @@ using ParadoxNotion; using ParadoxNotion.Design; using UnityEngine; using UnityEngine.InputSystem; - +using Reset.Player.Movement; namespace NodeCanvas.Tasks.Actions { [Category("Reset/Movement")] @@ -13,6 +13,8 @@ namespace NodeCanvas.Tasks.Actions { public BBParameter jumpStrength; public BBParameter airMoveDirection; + public BBParameter playerFacingDirection; + [Range(0f, 1f)] public BBParameter standStillJumpStrength; @@ -58,7 +60,6 @@ namespace NodeCanvas.Tasks.Actions { // Get the dot product between current velocity's direction and current input (UNUSED FOR NOW) float velocityInputDot = Vector3.Dot(currentVelocityWorld, currentInputVector3); - // Set air move direction if (agent.isGrounded) { diff --git a/Assets/Scripts/Core/Graph Tasks/CalculateAirMovement.cs b/Assets/Scripts/Core/Graph Tasks/CalculateAirMovement.cs index 0cf9d87..075de6c 100644 --- a/Assets/Scripts/Core/Graph Tasks/CalculateAirMovement.cs +++ b/Assets/Scripts/Core/Graph Tasks/CalculateAirMovement.cs @@ -1,6 +1,8 @@ using NodeCanvas.Framework; using ParadoxNotion.Design; using UnityEngine; +using Reset.Player.Movement; + namespace NodeCanvas.Tasks.Actions { @@ -8,6 +10,8 @@ namespace NodeCanvas.Tasks.Actions { public class CalculateAirMovement : ActionTask{ public BBParameter airMoveDirection; public BBParameter groundMoveDirection; + + public BBParameter playerFacingDirection; private float airControlPower = 1f; @@ -20,8 +24,6 @@ namespace NodeCanvas.Tasks.Actions { //This is called once each time the task is enabled. //Call EndAction() to mark the action as finished, either in success or failure. //EndAction can be called from anywhere. - protected override void OnExecute() { - airControlPower = 1f; protected override void OnExecute(){ } diff --git a/Assets/Scripts/Core/Graph Tasks/ProcessMovement.cs b/Assets/Scripts/Core/Graph Tasks/ProcessMovement.cs index 2d61d83..1ab94de 100644 --- a/Assets/Scripts/Core/Graph Tasks/ProcessMovement.cs +++ b/Assets/Scripts/Core/Graph Tasks/ProcessMovement.cs @@ -6,13 +6,17 @@ using ParadoxNotion.Services; using Unity.Cinemachine; using Unity.Mathematics; using UnityEngine; +using Reset.Player.Movement; -public enum PlayerFacingDirection{ - Target = 0, - Movement, - MatchCamera +namespace Reset.Player.Movement{ + public enum PlayerFacingDirection{ + Target = 0, + Movement, + MatchCamera + } } + namespace NodeCanvas.Tasks.Actions { [Category("Reset/Movement")] @@ -28,7 +32,7 @@ namespace NodeCanvas.Tasks.Actions { public BBParameter jumpPowerDecay; // Rotation - public PlayerFacingDirection playerFacingDirection; + public BBParameter playerFacingDirection; [ShowIf("playerFacingDirection", 0)] public Vector3 rotationTargetPosition; @@ -76,7 +80,7 @@ namespace NodeCanvas.Tasks.Actions { // Calculate rotation speed currentRotSpeed = Mathf.Lerp(currentRotSpeed, rotationSpeed.value, rotationSmoothing.value * Time.deltaTime); - switch (playerFacingDirection) { + switch (playerFacingDirection.value) { case PlayerFacingDirection.Target: // Set rotation to just the direction of the target targetRotation = Quaternion.LookRotation((agent.transform.position.DirectionTo(rotationTargetPosition)).Flatten(null, 0, null));