#if HAVE_NODECANVAS
using System;
using UnityEngine;
using ParadoxNotion.Design;
using NodeCanvas.Framework;
namespace Framework.Actors {
/// Switches an actor presenter to a different state
[Category("Actors")]
[Description("Place an actor at a predetermined position")]
public class PlaceAtPositionTask : ActionTask {
/// Actor that will be placed at a predetermined position
[RequiredField]
public BBParameter Actor;
/// Position (and orientation) the actor will be placed at
/// Overrides the transform in the task if present
public BBParameter Transform;
/// Position at which the actor will be placed
public Vector3 Position;
/// Orientation of the actor
public Quaternion Orientation;
/// Summary of what this action does
protected override string info {
get {
return
"Place " + this.Actor.name + " at {" +
this.Position.x.ToString() + ", " +
this.Position.y.ToString() + ", " +
this.Position.z.ToString() + ", " +
"}";
}
}
/// Called once when the action is executed
protected override void OnExecute() {
Transform actorTransform = this.Actor.value.transform;
if(this.Transform.value == null) {
actorTransform.position = this.Position;
actorTransform.rotation = this.Orientation;
} else {
actorTransform.position = this.Transform.value.position;
actorTransform.rotation = this.Transform.value.rotation;
}
EndAction();
}
}
} // namespace Framework.Actors
#endif // HAVE_NODECANVAS