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 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<float> jumpStrength;
public BBParameter<Vector3> airMoveDirection;
public BBParameter<PlayerFacingDirection> playerFacingDirection;
[Range(0f, 1f)]
public BBParameter<float> standStillJumpStrength;
@@ -59,7 +61,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) {
airMoveDirection.value = currentVelocityVector3;

View File

@@ -1,6 +1,8 @@
using NodeCanvas.Framework;
using ParadoxNotion.Design;
using UnityEngine;
using Reset.Player.Movement;
namespace NodeCanvas.Tasks.Actions {
@@ -9,6 +11,8 @@ namespace NodeCanvas.Tasks.Actions {
public BBParameter<Vector3> airMoveDirection;
public BBParameter<Vector3> groundMoveDirection;
public BBParameter<PlayerFacingDirection> playerFacingDirection;
private float airControlPower = 1f;
//Use for initialization. This is called only once in the lifetime of the task.
@@ -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(){
}

View File

@@ -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<float> jumpPowerDecay;
// Rotation
public PlayerFacingDirection playerFacingDirection;
public BBParameter<PlayerFacingDirection> 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));