PlayMaker action tooltips

This commit is contained in:
2015-12-14 22:23:52 +06:00
parent cd540daa22
commit 3ba6543f38
8 changed files with 83 additions and 66 deletions

View File

@@ -3,7 +3,8 @@ using HutongGames.PlayMaker;
namespace IsoTools.PlayMaker.Actions { namespace IsoTools.PlayMaker.Actions {
[ActionCategory("IsoTools")] [ActionCategory("IsoTools")]
[HutongGames.PlayMaker.Tooltip("Gets the Mode of a IsoObject and stores it in a Enum Variable")] [HutongGames.PlayMaker.Tooltip(
"Gets the Mode of a IsoObject and stores it in a Enum Variable")]
public class IsoGetMode : IsoComponentAction<IsoObject> { public class IsoGetMode : IsoComponentAction<IsoObject> {
[RequiredField] [RequiredField]
[CheckForComponent(typeof(IsoObject))] [CheckForComponent(typeof(IsoObject))]

View File

@@ -3,7 +3,9 @@ using HutongGames.PlayMaker;
namespace IsoTools.PlayMaker.Actions { namespace IsoTools.PlayMaker.Actions {
[ActionCategory("IsoTools")] [ActionCategory("IsoTools")]
[HutongGames.PlayMaker.Tooltip("Gets the Position of a IsoObject and stores it in a Vector3 Variable or each Axis in a Float Variable")] [HutongGames.PlayMaker.Tooltip(
"Gets the Position of a IsoObject and stores it " +
"in a Vector3 Variable or each Axis in a Float Variable")]
public class IsoGetPosition : IsoComponentAction<IsoObject> { public class IsoGetPosition : IsoComponentAction<IsoObject> {
[RequiredField] [RequiredField]
[CheckForComponent(typeof(IsoObject))] [CheckForComponent(typeof(IsoObject))]

View File

@@ -3,7 +3,9 @@ using HutongGames.PlayMaker;
namespace IsoTools.PlayMaker.Actions { namespace IsoTools.PlayMaker.Actions {
[ActionCategory("IsoTools")] [ActionCategory("IsoTools")]
[HutongGames.PlayMaker.Tooltip("Gets the Size of a IsoObject and stores it in a Vector3 Variable or each Axis in a Float Variable")] [HutongGames.PlayMaker.Tooltip(
"Gets the Size of a IsoObject and stores it " +
"in a Vector3 Variable or each Axis in a Float Variable")]
public class IsoGetSize : IsoComponentAction<IsoObject> { public class IsoGetSize : IsoComponentAction<IsoObject> {
[RequiredField] [RequiredField]
[CheckForComponent(typeof(IsoObject))] [CheckForComponent(typeof(IsoObject))]

View File

@@ -3,22 +3,36 @@ using HutongGames.PlayMaker;
namespace IsoTools.PlayMaker.Actions { namespace IsoTools.PlayMaker.Actions {
[ActionCategory("IsoTools")] [ActionCategory("IsoTools")]
[HutongGames.PlayMaker.Tooltip("Resizes a IsoObject. Use a Vector3 variable and/or XYZ components. To leave any axis unchanged, set variable to 'None'.")] [HutongGames.PlayMaker.Tooltip(
"Resizes a IsoObject. " +
"Use a Vector3 variable and/or XYZ components. " +
"To leave any axis unchanged, set variable to 'None'.")]
public class IsoResize : IsoComponentAction<IsoObject> { public class IsoResize : IsoComponentAction<IsoObject> {
[RequiredField] [RequiredField]
[CheckForComponent(typeof(IsoObject))] [CheckForComponent(typeof(IsoObject))]
[HutongGames.PlayMaker.Tooltip("The IsoObject to resize.")]
public FsmOwnerDefault gameObject; public FsmOwnerDefault gameObject;
[UIHint(UIHint.Variable)] [UIHint(UIHint.Variable)]
[HutongGames.PlayMaker.Tooltip(
"Use a stored resize Vector3, " +
"and/or set individual axis below.")]
public FsmVector3 vector; public FsmVector3 vector;
public FsmFloat x; public FsmFloat x;
public FsmFloat y; public FsmFloat y;
public FsmFloat z; public FsmFloat z;
[HutongGames.PlayMaker.Tooltip("Resize over one second")]
public bool perSecond; public bool perSecond;
[HutongGames.PlayMaker.Tooltip("Repeat every frame.")]
public bool everyFrame; public bool everyFrame;
[HutongGames.PlayMaker.Tooltip("Perform the resize in LateUpdate.")]
public bool lateUpdate; public bool lateUpdate;
[HutongGames.PlayMaker.Tooltip("Perform the resize in FixedUpdate.")]
public bool fixedUpdate; public bool fixedUpdate;
public override void Reset() { public override void Reset() {
@@ -71,22 +85,12 @@ namespace IsoTools.PlayMaker.Actions {
void DoAction() { void DoAction() {
var go = Fsm.GetOwnerDefaultTarget(gameObject); var go = Fsm.GetOwnerDefaultTarget(gameObject);
if ( UpdateCache(go) ) { if ( UpdateCache(go) ) {
var value = vector.IsNone var value = vector.IsNone ? Vector3.zero : vector.Value;
? Vector3.zero if ( !x.IsNone ) { value.x = x.Value; }
: vector.Value; if ( !y.IsNone ) { value.y = y.Value; }
if ( !z.IsNone ) { value.z = z.Value; }
if ( !x.IsNone ) {
value.x = x.Value;
}
if ( !y.IsNone ) {
value.y = y.Value;
}
if ( !z.IsNone ) {
value.z = z.Value;
}
isoObject.size += isoObject.size +=
value * (perSecond ? Time.deltaTime : 1.0f); perSecond ? value * Time.deltaTime : value;
} }
} }
} }

View File

@@ -3,10 +3,12 @@ using HutongGames.PlayMaker;
namespace IsoTools.PlayMaker.Actions { namespace IsoTools.PlayMaker.Actions {
[ActionCategory("IsoTools")] [ActionCategory("IsoTools")]
[HutongGames.PlayMaker.Tooltip("Sets the Mode of a IsoObject.")] [HutongGames.PlayMaker.Tooltip(
"Sets the Mode of a IsoObject.")]
public class IsoSetMode : IsoComponentAction<IsoObject> { public class IsoSetMode : IsoComponentAction<IsoObject> {
[RequiredField] [RequiredField]
[CheckForComponent(typeof(IsoObject))] [CheckForComponent(typeof(IsoObject))]
[HutongGames.PlayMaker.Tooltip("The IsoObject to mode.")]
public FsmOwnerDefault gameObject; public FsmOwnerDefault gameObject;
[RequiredField] [RequiredField]

View File

@@ -3,21 +3,32 @@ using HutongGames.PlayMaker;
namespace IsoTools.PlayMaker.Actions { namespace IsoTools.PlayMaker.Actions {
[ActionCategory("IsoTools")] [ActionCategory("IsoTools")]
[HutongGames.PlayMaker.Tooltip("Sets the Position of a IsoObject. To leave any axis unchanged, set variable to 'None'.")] [HutongGames.PlayMaker.Tooltip(
"Sets the Position of a IsoObject. " +
"To leave any axis unchanged, set variable to 'None'.")]
public class IsoSetPosition : IsoComponentAction<IsoObject> { public class IsoSetPosition : IsoComponentAction<IsoObject> {
[RequiredField] [RequiredField]
[CheckForComponent(typeof(IsoObject))] [CheckForComponent(typeof(IsoObject))]
[HutongGames.PlayMaker.Tooltip("The IsoObject to position.")]
public FsmOwnerDefault gameObject; public FsmOwnerDefault gameObject;
[UIHint(UIHint.Variable)] [UIHint(UIHint.Variable)]
[HutongGames.PlayMaker.Tooltip(
"Use a stored Vector3 position, " +
"and/or set individual axis below.")]
public FsmVector3 vector; public FsmVector3 vector;
public FsmFloat x; public FsmFloat x;
public FsmFloat y; public FsmFloat y;
public FsmFloat z; public FsmFloat z;
[HutongGames.PlayMaker.Tooltip("Repeat every frame.")]
public bool everyFrame; public bool everyFrame;
[HutongGames.PlayMaker.Tooltip("Perform in LateUpdate.")]
public bool lateUpdate; public bool lateUpdate;
[HutongGames.PlayMaker.Tooltip("Perform in FixedUpdate.")]
public bool fixedUpdate; public bool fixedUpdate;
public override void Reset() { public override void Reset() {
@@ -69,20 +80,10 @@ namespace IsoTools.PlayMaker.Actions {
void DoAction() { void DoAction() {
var go = Fsm.GetOwnerDefaultTarget(gameObject); var go = Fsm.GetOwnerDefaultTarget(gameObject);
if ( UpdateCache(go) ) { if ( UpdateCache(go) ) {
var value = vector.IsNone var value = vector.IsNone ? isoObject.position : vector.Value;
? isoObject.position if ( !x.IsNone ) { value.x = x.Value; }
: vector.Value; if ( !y.IsNone ) { value.y = y.Value; }
if ( !z.IsNone ) { value.z = z.Value; }
if ( !x.IsNone ) {
value.x = x.Value;
}
if ( !y.IsNone ) {
value.y = y.Value;
}
if ( !z.IsNone ) {
value.z = z.Value;
}
isoObject.position = value; isoObject.position = value;
} }
} }

View File

@@ -3,21 +3,32 @@ using HutongGames.PlayMaker;
namespace IsoTools.PlayMaker.Actions { namespace IsoTools.PlayMaker.Actions {
[ActionCategory("IsoTools")] [ActionCategory("IsoTools")]
[HutongGames.PlayMaker.Tooltip("Sets the Size of a IsoObject. To leave any axis unchanged, set variable to 'None'.")] [HutongGames.PlayMaker.Tooltip(
"Sets the Size of a IsoObject. " +
"To leave any axis unchanged, set variable to 'None'.")]
public class IsoSetSize : IsoComponentAction<IsoObject> { public class IsoSetSize : IsoComponentAction<IsoObject> {
[RequiredField] [RequiredField]
[CheckForComponent(typeof(IsoObject))] [CheckForComponent(typeof(IsoObject))]
[HutongGames.PlayMaker.Tooltip("The IsoObject to size.")]
public FsmOwnerDefault gameObject; public FsmOwnerDefault gameObject;
[UIHint(UIHint.Variable)] [UIHint(UIHint.Variable)]
[HutongGames.PlayMaker.Tooltip(
"Use a stored Vector3 size, " +
"and/or set individual axis below.")]
public FsmVector3 vector; public FsmVector3 vector;
public FsmFloat x; public FsmFloat x;
public FsmFloat y; public FsmFloat y;
public FsmFloat z; public FsmFloat z;
[HutongGames.PlayMaker.Tooltip("Repeat every frame.")]
public bool everyFrame; public bool everyFrame;
[HutongGames.PlayMaker.Tooltip("Perform in LateUpdate.")]
public bool lateUpdate; public bool lateUpdate;
[HutongGames.PlayMaker.Tooltip("Perform in FixedUpdate.")]
public bool fixedUpdate; public bool fixedUpdate;
public override void Reset() { public override void Reset() {
@@ -69,20 +80,10 @@ namespace IsoTools.PlayMaker.Actions {
void DoAction() { void DoAction() {
var go = Fsm.GetOwnerDefaultTarget(gameObject); var go = Fsm.GetOwnerDefaultTarget(gameObject);
if ( UpdateCache(go) ) { if ( UpdateCache(go) ) {
var value = vector.IsNone var value = vector.IsNone ? isoObject.size : vector.Value;
? isoObject.size if ( !x.IsNone ) { value.x = x.Value; }
: vector.Value; if ( !y.IsNone ) { value.y = y.Value; }
if ( !z.IsNone ) { value.z = z.Value; }
if ( !x.IsNone ) {
value.x = x.Value;
}
if ( !y.IsNone ) {
value.y = y.Value;
}
if ( !z.IsNone ) {
value.z = z.Value;
}
isoObject.size = value; isoObject.size = value;
} }
} }

View File

@@ -3,22 +3,36 @@ using HutongGames.PlayMaker;
namespace IsoTools.PlayMaker.Actions { namespace IsoTools.PlayMaker.Actions {
[ActionCategory("IsoTools")] [ActionCategory("IsoTools")]
[HutongGames.PlayMaker.Tooltip("Translates a IsoObject. Use a Vector3 variable and/or XYZ components. To leave any axis unchanged, set variable to 'None'.")] [HutongGames.PlayMaker.Tooltip(
"Translates a IsoObject. " +
"Use a Vector3 variable and/or XYZ components. " +
"To leave any axis unchanged, set variable to 'None'.")]
public class IsoTranslate : IsoComponentAction<IsoObject> { public class IsoTranslate : IsoComponentAction<IsoObject> {
[RequiredField] [RequiredField]
[CheckForComponent(typeof(IsoObject))] [CheckForComponent(typeof(IsoObject))]
[HutongGames.PlayMaker.Tooltip("The IsoObject to translate.")]
public FsmOwnerDefault gameObject; public FsmOwnerDefault gameObject;
[UIHint(UIHint.Variable)] [UIHint(UIHint.Variable)]
[HutongGames.PlayMaker.Tooltip(
"Use a stored translation Vector3, " +
"and/or set individual axis below.")]
public FsmVector3 vector; public FsmVector3 vector;
public FsmFloat x; public FsmFloat x;
public FsmFloat y; public FsmFloat y;
public FsmFloat z; public FsmFloat z;
[HutongGames.PlayMaker.Tooltip("Translate over one second")]
public bool perSecond; public bool perSecond;
[HutongGames.PlayMaker.Tooltip("Repeat every frame.")]
public bool everyFrame; public bool everyFrame;
[HutongGames.PlayMaker.Tooltip("Perform the translate in LateUpdate.")]
public bool lateUpdate; public bool lateUpdate;
[HutongGames.PlayMaker.Tooltip("Perform the translate in FixedUpdate.")]
public bool fixedUpdate; public bool fixedUpdate;
public override void Reset() { public override void Reset() {
@@ -71,22 +85,12 @@ namespace IsoTools.PlayMaker.Actions {
void DoAction() { void DoAction() {
var go = Fsm.GetOwnerDefaultTarget(gameObject); var go = Fsm.GetOwnerDefaultTarget(gameObject);
if ( UpdateCache(go) ) { if ( UpdateCache(go) ) {
var value = vector.IsNone var value = vector.IsNone ? Vector3.zero : vector.Value;
? Vector3.zero if ( !x.IsNone ) { value.x = x.Value; }
: vector.Value; if ( !y.IsNone ) { value.y = y.Value; }
if ( !z.IsNone ) { value.z = z.Value; }
if ( !x.IsNone ) {
value.x = x.Value;
}
if ( !y.IsNone ) {
value.y = y.Value;
}
if ( !z.IsNone ) {
value.z = z.Value;
}
isoObject.position += isoObject.position +=
value * (perSecond ? Time.deltaTime : 1.0f); perSecond ? value * Time.deltaTime : value;
} }
} }
} }