changed: changed facing direction into BBParamater
This commit is contained in:
@@ -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;
|
||||||
|
|
||||||
@@ -59,7 +61,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) {
|
||||||
airMoveDirection.value = currentVelocityVector3;
|
airMoveDirection.value = currentVelocityVector3;
|
||||||
|
|||||||
@@ -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 {
|
||||||
|
|
||||||
@@ -9,6 +11,8 @@ namespace NodeCanvas.Tasks.Actions {
|
|||||||
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;
|
||||||
|
|
||||||
//Use for initialization. This is called only once in the lifetime of the task.
|
//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.
|
//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(){
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,12 +6,16 @@ using ParadoxNotion.Services;
|
|||||||
using Unity.Cinemachine;
|
using Unity.Cinemachine;
|
||||||
using Unity.Mathematics;
|
using Unity.Mathematics;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
using Reset.Player.Movement;
|
||||||
|
|
||||||
|
namespace Reset.Player.Movement{
|
||||||
public enum PlayerFacingDirection{
|
public enum PlayerFacingDirection{
|
||||||
Target = 0,
|
Target = 0,
|
||||||
Movement,
|
Movement,
|
||||||
MatchCamera
|
MatchCamera
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
namespace NodeCanvas.Tasks.Actions {
|
namespace NodeCanvas.Tasks.Actions {
|
||||||
|
|
||||||
@@ -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));
|
||||||
|
|||||||
Reference in New Issue
Block a user