changed: changed facing direction into BBParamater

This commit is contained in:
Chris
2025-07-15 17:01:58 -04:00
parent 103ffce69b
commit 9e321677c5
3 changed files with 17 additions and 10 deletions

View File

@@ -5,7 +5,7 @@ using ParadoxNotion;
using ParadoxNotion.Design; using ParadoxNotion.Design;
using UnityEngine; using UnityEngine;
using UnityEngine.InputSystem; using UnityEngine.InputSystem;
using Reset.Player.Movement;
namespace NodeCanvas.Tasks.Actions { namespace NodeCanvas.Tasks.Actions {
[Category("Reset/Movement")] [Category("Reset/Movement")]
@@ -13,6 +13,8 @@ namespace NodeCanvas.Tasks.Actions {
public BBParameter<float> jumpStrength; public BBParameter<float> jumpStrength;
public BBParameter<Vector3> airMoveDirection; public BBParameter<Vector3> airMoveDirection;
public BBParameter<PlayerFacingDirection> playerFacingDirection;
[Range(0f, 1f)] [Range(0f, 1f)]
public BBParameter<float> standStillJumpStrength; public BBParameter<float> standStillJumpStrength;
@@ -58,7 +60,6 @@ namespace NodeCanvas.Tasks.Actions {
// Get the dot product between current velocity's direction and current input (UNUSED FOR NOW) // Get the dot product between current velocity's direction and current input (UNUSED FOR NOW)
float velocityInputDot = Vector3.Dot(currentVelocityWorld, currentInputVector3); float velocityInputDot = Vector3.Dot(currentVelocityWorld, currentInputVector3);
// Set air move direction // Set air move direction
if (agent.isGrounded) { if (agent.isGrounded) {

View File

@@ -1,6 +1,8 @@
using NodeCanvas.Framework; using NodeCanvas.Framework;
using ParadoxNotion.Design; using ParadoxNotion.Design;
using UnityEngine; using UnityEngine;
using Reset.Player.Movement;
namespace NodeCanvas.Tasks.Actions { namespace NodeCanvas.Tasks.Actions {
@@ -8,6 +10,8 @@ namespace NodeCanvas.Tasks.Actions {
public class CalculateAirMovement : ActionTask<Transform>{ public class CalculateAirMovement : ActionTask<Transform>{
public BBParameter<Vector3> airMoveDirection; public BBParameter<Vector3> airMoveDirection;
public BBParameter<Vector3> groundMoveDirection; public BBParameter<Vector3> groundMoveDirection;
public BBParameter<PlayerFacingDirection> playerFacingDirection;
private float airControlPower = 1f; private float airControlPower = 1f;
@@ -20,8 +24,6 @@ namespace NodeCanvas.Tasks.Actions {
//This is called once each time the task is enabled. //This is called once each time the task is enabled.
//Call EndAction() to mark the action as finished, either in success or failure. //Call EndAction() to mark the action as finished, either in success or failure.
//EndAction can be called from anywhere. //EndAction can be called from anywhere.
protected override void OnExecute() {
airControlPower = 1f;
protected override void OnExecute(){ protected override void OnExecute(){
} }

View File

@@ -6,13 +6,17 @@ using ParadoxNotion.Services;
using Unity.Cinemachine; using Unity.Cinemachine;
using Unity.Mathematics; using Unity.Mathematics;
using UnityEngine; using UnityEngine;
using Reset.Player.Movement;
public enum PlayerFacingDirection{ namespace Reset.Player.Movement{
Target = 0, public enum PlayerFacingDirection{
Movement, Target = 0,
MatchCamera Movement,
MatchCamera
}
} }
namespace NodeCanvas.Tasks.Actions { namespace NodeCanvas.Tasks.Actions {
[Category("Reset/Movement")] [Category("Reset/Movement")]
@@ -28,7 +32,7 @@ namespace NodeCanvas.Tasks.Actions {
public BBParameter<float> jumpPowerDecay; public BBParameter<float> jumpPowerDecay;
// Rotation // Rotation
public PlayerFacingDirection playerFacingDirection; public BBParameter<PlayerFacingDirection> playerFacingDirection;
[ShowIf("playerFacingDirection", 0)] [ShowIf("playerFacingDirection", 0)]
public Vector3 rotationTargetPosition; public Vector3 rotationTargetPosition;
@@ -76,7 +80,7 @@ namespace NodeCanvas.Tasks.Actions {
// Calculate rotation speed // Calculate rotation speed
currentRotSpeed = Mathf.Lerp(currentRotSpeed, rotationSpeed.value, rotationSmoothing.value * Time.deltaTime); currentRotSpeed = Mathf.Lerp(currentRotSpeed, rotationSpeed.value, rotationSmoothing.value * Time.deltaTime);
switch (playerFacingDirection) { switch (playerFacingDirection.value) {
case PlayerFacingDirection.Target: case PlayerFacingDirection.Target:
// Set rotation to just the direction of the target // Set rotation to just the direction of the target
targetRotation = Quaternion.LookRotation((agent.transform.position.DirectionTo(rotationTargetPosition)).Flatten(null, 0, null)); targetRotation = Quaternion.LookRotation((agent.transform.position.DirectionTo(rotationTargetPosition)).Flatten(null, 0, null));