#if GRAPH_DESIGNER /// --------------------------------------------- /// Behavior Designer /// Copyright (c) Opsive. All Rights Reserved. /// https://www.opsive.com /// --------------------------------------------- namespace Opsive.BehaviorDesigner.Runtime.Tasks.Actions.Math { using Opsive.GraphDesigner.Runtime.Variables; using UnityEngine; [Opsive.Shared.Utility.Category("Math")] [Opsive.Shared.Utility.Description("Converts an angle (in degrees) to a Vector2 direction.")] public class AngleToDirection : Action { [Tooltip("The angle in degrees.")] [SerializeField] protected SharedVariable m_Angle; [Tooltip("The resulting Vector2 direction.")] [SerializeField] [RequireShared] protected SharedVariable m_Result; /// /// Converts the angle to a direction. /// /// The status of the action. public override TaskStatus OnUpdate() { var radians = m_Angle.Value * Mathf.Deg2Rad; m_Result.Value = new Vector2(Mathf.Cos(radians), Mathf.Sin(radians)); return TaskStatus.Success; } } } #endif