#if HAVE_NODECANVAS using System; using UnityEngine; using ParadoxNotion.Design; using NodeCanvas.Framework; using Framework.Actors; using Framework.Actors.Shooter; using Framework.Support; namespace Game.Actors.Shooter { /// Alters the range of head movement available to a head look controller [Category("Actors")] [Description("Change the movement range of a character's head")] public class ChangeHeadMovementRangeTask : ActionTask { /// Actor whose head movement range will be altered [RequiredField] public BBParameter Actor; /// How far the user can move the characters head left and right public Range YawRange = new Range(-80.0f, 80.0f); /// How far the user can move the characters head up and down public Range PitchRange = new Range(-40.0f, 85.0f); /// Whether the head look controller is allowed to bend the spine public bool AllowSpinePosing = true; /// Summary of what this action does protected override string info { get { return "Set " + this.Actor.name + " head range to {" + this.YawRange.Start.ToString() + "; " + this.YawRange.End.ToString() + "} by {" + this.PitchRange.Start.ToString() + "; " + this.PitchRange.End.ToString() + "}"; } } /// Called once when the action is executed protected override void OnExecute() { HeadMovementRange movementRange = this.Actor.value.GetComponent(); if(movementRange == null) { Debug.LogWarning( "Could not change head movement range on actor '" + this.Actor.name + "' " + "because the actor does not have the HeadMovementRange component." ); return; } movementRange.YawRange = this.YawRange; movementRange.PitchRange = this.PitchRange; EndAction(); } } } // namespace Game.Actors.Shooter #endif // HAVE_NODECANVAS