changed: changed facing direction into BBParamater
This commit is contained in:
@@ -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));
|
||||
|
||||
Reference in New Issue
Block a user