Roman aa6e1ebe90 任务:创建项目,引入部分将会用到的插件和包
1.引入URP
2.引入InputSystem
3.引入Fungus
4.引入DoTween
5.引入CinemaMachine
6.引入BehaviorTree
7.引入BehaviorTree动作包
8.配置了渲染管线资源

🥵🥵🥵🥵🥵
2021-11-21 15:14:51 +08:00

36 lines
1.3 KiB
C#

using UnityEngine;
namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityVector3
{
[TaskCategory("Unity/Vector3")]
[TaskDescription("Rotate the current rotation to the target rotation.")]
public class RotateTowards : Action
{
[Tooltip("The current rotation in euler angles")]
public SharedVector3 currentRotation;
[Tooltip("The target rotation in euler angles")]
public SharedVector3 targetRotation;
[Tooltip("The maximum delta of the degrees")]
public SharedFloat maxDegreesDelta;
[Tooltip("The maximum delta of the magnitude")]
public SharedFloat maxMagnitudeDelta;
[Tooltip("The rotation resut")]
[RequiredField]
public SharedVector3 storeResult;
public override TaskStatus OnUpdate()
{
storeResult.Value = Vector3.RotateTowards(currentRotation.Value, targetRotation.Value, maxDegreesDelta.Value * Mathf.Deg2Rad * Time.deltaTime, maxMagnitudeDelta.Value);
return TaskStatus.Success;
}
public override void OnReset()
{
currentRotation = Vector3.zero;
targetRotation = Vector3.zero;
storeResult = Vector3.zero;
maxDegreesDelta = 0;
maxMagnitudeDelta = 0;
}
}
}