blob: 11cd81652847f7a2885c5660952773dc806673a3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
using UnityEngine;
namespace BehaviorDesigner.Runtime.Tasks.Basic.Math
{
[TaskCategory("Basic/Math")]
[TaskDescription("Lerp the angle by an amount.")]
public class LerpAngle : Action
{
[Tooltip("The from value")]
public SharedFloat fromValue;
[Tooltip("The to value")]
public SharedFloat toValue;
[Tooltip("The amount to lerp")]
public SharedFloat lerpAmount;
[Tooltip("The lerp resut")]
[RequiredField]
public SharedFloat storeResult;
public override TaskStatus OnUpdate()
{
storeResult.Value = Mathf.LerpAngle(fromValue.Value, toValue.Value, lerpAmount.Value);
return TaskStatus.Success;
}
public override void OnReset()
{
fromValue = toValue = lerpAmount = storeResult = 0;
}
}
}
|