diff --git a/Assembly-CSharp.csproj b/Assembly-CSharp.csproj index 604c141..66f17c7 100644 --- a/Assembly-CSharp.csproj +++ b/Assembly-CSharp.csproj @@ -60,6 +60,7 @@ + diff --git a/Assets/IsoTools/Examples/Scenes/Scene07.unity b/Assets/IsoTools/Examples/Scenes/Scene07.unity index 847a06d..255ce7e 100644 --- a/Assets/IsoTools/Examples/Scenes/Scene07.unity +++ b/Assets/IsoTools/Examples/Scenes/Scene07.unity @@ -1734,6 +1734,7 @@ MonoBehaviour: transitions: [] actionData: actionNames: + - IsoTools.PlayMaker.Actions.IsoGetSpeed - IsoTools.PlayMaker.Actions.IsoGetVelocity - IsoTools.PlayMaker.Events.IsoTriggerEvent - IsoTools.PlayMaker.Events.IsoCollisionEvent @@ -1741,10 +1742,11 @@ MonoBehaviour: - - - - actionEnabled: 010101 - actionIsOpen: 010101 - actionStartIndex: 00000000060000000b000000 - actionHashCodes: 7ebd02028802cd006a86ae01 + - + actionEnabled: 01010101 + actionIsOpen: 01010101 + actionStartIndex: 0000000003000000090000000e000000 + actionHashCodes: 32d594027ebd02028802cd006a86ae01 unityObjectParams: [] fsmGameObjectParams: - useVariable: 1 @@ -1784,6 +1786,14 @@ MonoBehaviour: showInInspector: 0 networkSync: 0 value: {fileID: 0} + - ownerOption: 0 + gameObject: + useVariable: 0 + name: + tooltip: + showInInspector: 0 + networkSync: 0 + value: {fileID: 0} animationCurveParams: [] functionCallParams: [] fsmTemplateControlParams: [] @@ -1808,6 +1818,12 @@ MonoBehaviour: fsmArrayParams: [] fsmEnumParams: [] fsmFloatParams: + - useVariable: 1 + name: iso_speed + tooltip: + showInInspector: 0 + networkSync: 0 + value: 0 - useVariable: 1 name: tooltip: @@ -1848,14 +1864,17 @@ MonoBehaviour: stringParams: - TO_UP - TO_UP - byteData: 010000000000000000 + byteData: 01010000000000000000 arrayParamSizes: arrayParamTypes: [] customTypeSizes: customTypeNames: [] - paramDataType: 140000001c0000000f0000000f0000000f00000001000000140000000700000012000000170000001300000014000000070000001200000017000000130000000f000000 + paramDataType: 140000000f00000001000000140000001c0000000f0000000f0000000f00000001000000140000000700000012000000170000001300000014000000070000001200000017000000130000000f000000 paramName: - gameObject + - storeResult + - everyFrame + - gameObject - storeVector - storeX - storeY @@ -1872,8 +1891,8 @@ MonoBehaviour: - sendEvent - storeIsoCollider - storeForce - paramDataPos: 0000000000000000000000000100000002000000000000000100000001000000000000000000000000000000020000000500000001000000010000000100000003000000 - paramByteDataSize: 0000000000000000000000000000000000000000010000000000000004000000000000000000000000000000000000000400000000000000000000000000000000000000 + paramDataPos: 0000000000000000000000000100000000000000010000000200000003000000010000000200000002000000000000000000000000000000030000000600000001000000010000000100000004000000 + paramByteDataSize: 0000000000000000010000000000000000000000000000000000000000000000010000000000000004000000000000000000000000000000000000000400000000000000000000000000000000000000 - name: up description: colorIndex: 0 @@ -1992,7 +2011,13 @@ MonoBehaviour: linkConstraint: 0 colorIndex: 0 variables: - floatVariables: [] + floatVariables: + - useVariable: 1 + name: iso_speed + tooltip: + showInInspector: 1 + networkSync: 0 + value: 0 intVariables: [] boolVariables: [] stringVariables: [] @@ -2015,7 +2040,7 @@ MonoBehaviour: enumVariables: [] categories: - - variableCategoryIDs: 00000000 + variableCategoryIDs: 0000000000000000 description: docUrl: showStateLabel: 1 diff --git a/Assets/IsoTools/PlayMaker/Actions/IsoGetSpeed.cs b/Assets/IsoTools/PlayMaker/Actions/IsoGetSpeed.cs new file mode 100644 index 0000000..de2cb89 --- /dev/null +++ b/Assets/IsoTools/PlayMaker/Actions/IsoGetSpeed.cs @@ -0,0 +1,44 @@ +using UnityEngine; +using HutongGames.PlayMaker; +using IsoTools.PlayMaker.Internal; + +namespace IsoTools.PlayMaker.Actions { + [ActionCategory("IsoTools")] + [HutongGames.PlayMaker.Tooltip( + "Gets the Speed of a IsoRigidbody and stores it in a Float Variable.")] + public class IsoGetSpeed : IsoComponentAction { + [RequiredField] + [CheckForComponent(typeof(IsoRigidbody))] + public FsmOwnerDefault gameObject; + + [RequiredField] + [UIHint(UIHint.Variable)] + public FsmFloat storeResult; + + public bool everyFrame; + + public override void Reset() { + gameObject = null; + storeResult = null; + everyFrame = false; + } + + public override void OnEnter() { + DoAction(); + if ( !everyFrame ) { + Finish(); + } + } + + public override void OnUpdate() { + DoAction(); + } + + void DoAction() { + var go = Fsm.GetOwnerDefaultTarget(gameObject); + if ( UpdateCache(go) ) { + storeResult.Value = isoRigidbody.velocity.magnitude; + } + } + } +} // IsoTools.PlayMaker.Actions \ No newline at end of file diff --git a/Assets/IsoTools/PlayMaker/Actions/IsoGetSpeed.cs.meta b/Assets/IsoTools/PlayMaker/Actions/IsoGetSpeed.cs.meta new file mode 100644 index 0000000..09f8cd7 --- /dev/null +++ b/Assets/IsoTools/PlayMaker/Actions/IsoGetSpeed.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 47bdbba00b58348cd9376287604f29ce +timeCreated: 1450620446 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: