diff --git a/Assembly-CSharp.csproj b/Assembly-CSharp.csproj index 5327042..1b30dbc 100644 --- a/Assembly-CSharp.csproj +++ b/Assembly-CSharp.csproj @@ -51,6 +51,10 @@ + + + + diff --git a/Assets/IsoTools/Examples/Scenes/Scene07.unity b/Assets/IsoTools/Examples/Scenes/Scene07.unity index d73f81d..8c6fec3 100644 --- a/Assets/IsoTools/Examples/Scenes/Scene07.unity +++ b/Assets/IsoTools/Examples/Scenes/Scene07.unity @@ -102,7 +102,7 @@ Prefab: objectReference: {fileID: 0} - target: {fileID: 453404, guid: d10e5320df9f84d4186bda0ba98db9ff, type: 2} propertyPath: m_LocalPosition.z - value: 1.3000001 + value: 1.4000001 objectReference: {fileID: 0} - target: {fileID: 453404, guid: d10e5320df9f84d4186bda0ba98db9ff, type: 2} propertyPath: m_LocalRotation.x @@ -422,8 +422,8 @@ MonoBehaviour: colorIndex: 0 position: serializedVersion: 2 - x: 240.82031 - y: 102.17969 + x: 84.453125 + y: 167.6875 width: 100 height: 32 isBreakpoint: 0 @@ -442,16 +442,28 @@ MonoBehaviour: actionNames: - IsoTools.PlayMaker.Actions.IsoTranslate - HutongGames.PlayMaker.Actions.Wait + - IsoTools.PlayMaker.Actions.IsoGetPosition + - PlayMaker.ConditionalExpression.ConditionalExpression customNames: - - - actionEnabled: 0101 - actionIsOpen: 0101 - actionStartIndex: 0000000009000000 - actionHashCodes: 8ef8760048c01101 + - + - + actionEnabled: 01010101 + actionIsOpen: 01010101 + actionStartIndex: 00000000090000000c00000012000000 + actionHashCodes: 8ef8760048c011017ebd0202490c8701 unityObjectParams: [] fsmGameObjectParams: [] fsmOwnerDefaultParams: + - ownerOption: 0 + gameObject: + useVariable: 0 + name: + tooltip: + showInInspector: 0 + networkSync: 0 + value: {fileID: 0} - ownerOption: 0 gameObject: useVariable: 0 @@ -466,7 +478,13 @@ MonoBehaviour: fsmEventTargetParams: [] fsmPropertyParams: [] layoutOptionParams: [] - fsmStringParams: [] + fsmStringParams: + - useVariable: 0 + name: + tooltip: + showInInspector: 0 + networkSync: 0 + value: iso_x == 5 fsmObjectParams: [] fsmVarParams: [] fsmArrayParams: [] @@ -496,6 +514,165 @@ MonoBehaviour: showInInspector: 0 networkSync: 0 value: 1 + - useVariable: 1 + name: iso_x + tooltip: + showInInspector: 1 + networkSync: 0 + value: 0 + - useVariable: 1 + name: + tooltip: + showInInspector: 0 + networkSync: 0 + value: 0 + - useVariable: 1 + name: + tooltip: + showInInspector: 0 + networkSync: 0 + value: 0 + fsmIntParams: [] + fsmBoolParams: + - useVariable: 1 + name: + tooltip: + showInInspector: 0 + networkSync: 0 + value: 0 + fsmVector2Params: [] + fsmVector3Params: + - useVariable: 1 + name: + tooltip: + showInInspector: 0 + networkSync: 0 + value: {x: 0, y: 0, z: 0} + - useVariable: 1 + name: iso_position + tooltip: + showInInspector: 1 + networkSync: 0 + value: {x: 0, y: 0, z: 0} + fsmColorParams: [] + fsmRectParams: [] + fsmQuaternionParams: [] + stringParams: + - FINISHED + - TO_RESET_POSITION + - + byteData: 0000000001000000 + arrayParamSizes: + arrayParamTypes: [] + customTypeSizes: + customTypeNames: [] + paramDataType: 140000001c0000000f0000000f0000000f000000010000000100000001000000010000000f0000001700000001000000140000001c0000000f0000000f0000000f00000001000000120000001700000017000000010000000100000011000000 + paramName: + - gameObject + - vector + - x + - y + - z + - perSecond + - everyFrame + - lateUpdate + - fixedUpdate + - time + - finishEvent + - realTime + - gameObject + - vector + - x + - y + - z + - everyFrame + - expression + - isTrueEvent + - isFalseEvent + - everyFrame + - rawResult + - storeResult + paramDataPos: 000000000000000000000000010000000200000000000000010000000200000003000000030000000000000004000000010000000100000004000000050000000600000005000000000000000100000002000000060000000700000000000000 + paramByteDataSize: 000000000000000000000000000000000000000001000000010000000100000001000000000000000000000001000000000000000000000000000000000000000000000001000000000000000000000000000000010000000100000000000000 + - name: State 3 + description: + colorIndex: 0 + position: + serializedVersion: 2 + x: 382.17188 + y: 149.6875 + width: 146 + height: 32 + isBreakpoint: 0 + isSequence: 0 + hideUnused: 0 + transitions: + - fsmEvent: + name: FINISHED + isSystemEvent: 1 + isGlobal: 0 + toState: State 1 + linkStyle: 0 + linkConstraint: 0 + colorIndex: 0 + actionData: + actionNames: + - IsoTools.PlayMaker.Actions.IsoSetPosition + - HutongGames.PlayMaker.Actions.Wait + customNames: + - + - + actionEnabled: 0101 + actionIsOpen: 0101 + actionStartIndex: 0000000007000000 + actionHashCodes: afff110548c01101 + unityObjectParams: [] + fsmGameObjectParams: [] + fsmOwnerDefaultParams: + - ownerOption: 0 + gameObject: + useVariable: 0 + name: + tooltip: + showInInspector: 0 + networkSync: 0 + value: {fileID: 0} + animationCurveParams: [] + functionCallParams: [] + fsmTemplateControlParams: [] + fsmEventTargetParams: [] + fsmPropertyParams: [] + layoutOptionParams: [] + fsmStringParams: [] + fsmObjectParams: [] + fsmVarParams: [] + fsmArrayParams: [] + fsmEnumParams: [] + fsmFloatParams: + - useVariable: 0 + name: + tooltip: + showInInspector: 0 + networkSync: 0 + value: 0 + - useVariable: 0 + name: + tooltip: + showInInspector: 0 + networkSync: 0 + value: 0 + - useVariable: 1 + name: + tooltip: + showInInspector: 0 + networkSync: 0 + value: 0 + - useVariable: 0 + name: + tooltip: + showInInspector: 0 + networkSync: 0 + value: 1 fsmIntParams: [] fsmBoolParams: [] fsmVector2Params: [] @@ -511,39 +688,60 @@ MonoBehaviour: fsmQuaternionParams: [] stringParams: - FINISHED - byteData: 0000000001 + byteData: 000001 arrayParamSizes: arrayParamTypes: [] customTypeSizes: customTypeNames: [] - paramDataType: 140000001c0000000f0000000f0000000f000000010000000100000001000000010000000f0000001700000001000000 + paramDataType: 140000001c0000000f0000000f0000000f00000001000000010000000f0000001700000001000000 paramName: - gameObject - vector - x - y - z - - perSecond - everyFrame - lateUpdate - - fixedUpdate - time - finishEvent - realTime - paramDataPos: 000000000000000000000000010000000200000000000000010000000200000003000000030000000000000004000000 - paramByteDataSize: 000000000000000000000000000000000000000001000000010000000100000001000000000000000000000001000000 + paramDataPos: 00000000000000000000000001000000020000000000000001000000030000000000000002000000 + paramByteDataSize: 00000000000000000000000000000000000000000100000001000000000000000000000001000000 events: - name: FINISHED isSystemEvent: 1 isGlobal: 0 - globalTransitions: [] + - name: TO_RESET_POSITION + isSystemEvent: 0 + isGlobal: 0 + globalTransitions: + - fsmEvent: + name: TO_RESET_POSITION + isSystemEvent: 0 + isGlobal: 0 + toState: State 3 + linkStyle: 0 + linkConstraint: 0 + colorIndex: 0 variables: - floatVariables: [] + floatVariables: + - useVariable: 1 + name: iso_x + tooltip: + showInInspector: 1 + networkSync: 0 + value: 0 intVariables: [] boolVariables: [] stringVariables: [] vector2Variables: [] - vector3Variables: [] + vector3Variables: + - useVariable: 1 + name: iso_position + tooltip: + showInInspector: 1 + networkSync: 0 + value: {x: 0, y: 0, z: 0} colorVariables: [] rectVariables: [] quaternionVariables: [] @@ -555,7 +753,7 @@ MonoBehaviour: enumVariables: [] categories: - - variableCategoryIDs: + variableCategoryIDs: 0000000000000000 description: docUrl: showStateLabel: 1 @@ -577,7 +775,7 @@ MonoBehaviour: handleCollisionExit: 0 handleCollisionStay: 0 handleOnGUI: 0 - handleFixedUpdate: 0 + handleFixedUpdate: 1 handleApplicationEvents: 0 fsmTemplate: {fileID: 0} eventHandlerComponentsAdded: 0 @@ -598,7 +796,7 @@ Prefab: objectReference: {fileID: 0} - target: {fileID: 453404, guid: d10e5320df9f84d4186bda0ba98db9ff, type: 2} propertyPath: m_LocalPosition.z - value: 1.4000001 + value: 1.3000001 objectReference: {fileID: 0} - target: {fileID: 453404, guid: d10e5320df9f84d4186bda0ba98db9ff, type: 2} propertyPath: m_LocalRotation.x @@ -656,7 +854,7 @@ Prefab: objectReference: {fileID: 0} - target: {fileID: 453404, guid: d10e5320df9f84d4186bda0ba98db9ff, type: 2} propertyPath: m_LocalPosition.z - value: 1.1 + value: 1.2 objectReference: {fileID: 0} - target: {fileID: 453404, guid: d10e5320df9f84d4186bda0ba98db9ff, type: 2} propertyPath: m_LocalRotation.x @@ -811,7 +1009,7 @@ Prefab: objectReference: {fileID: 0} - target: {fileID: 453404, guid: d10e5320df9f84d4186bda0ba98db9ff, type: 2} propertyPath: m_LocalPosition.z - value: 1.2 + value: 1.1 objectReference: {fileID: 0} - target: {fileID: 453404, guid: d10e5320df9f84d4186bda0ba98db9ff, type: 2} propertyPath: m_LocalRotation.x diff --git a/Assets/IsoTools/PlayMaker/Actions/IsoGetPosition.cs b/Assets/IsoTools/PlayMaker/Actions/IsoGetPosition.cs new file mode 100644 index 0000000..3095745 --- /dev/null +++ b/Assets/IsoTools/PlayMaker/Actions/IsoGetPosition.cs @@ -0,0 +1,57 @@ +using UnityEngine; +using HutongGames.PlayMaker; + +namespace IsoTools.PlayMaker.Actions { + [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")] + public class IsoGetPosition : FsmStateAction { + [RequiredField] + public FsmOwnerDefault gameObject; + + [UIHint(UIHint.Variable)] + public FsmVector3 vector; + + [UIHint(UIHint.Variable)] + public FsmFloat x; + + [UIHint(UIHint.Variable)] + public FsmFloat y; + + [UIHint(UIHint.Variable)] + public FsmFloat z; + + public bool everyFrame; + + public override void Reset() { + gameObject = null; + vector = null; + x = null; + y = null; + z = null; + everyFrame = false; + } + + public override void OnEnter() { + DoGetPosition(); + if ( !everyFrame ) { + Finish(); + } + } + + public override void OnUpdate() { + DoGetPosition(); + } + + void DoGetPosition() { + var go = Fsm.GetOwnerDefaultTarget(gameObject); + var iso_object = go ? go.GetComponent() : null; + if ( iso_object ) { + var position = iso_object.position; + vector.Value = position; + x.Value = position.x; + y.Value = position.y; + z.Value = position.z; + } + } + } +} // IsoTools.PlayMaker.Actions \ No newline at end of file diff --git a/Assets/IsoTools/PlayMaker/Actions/IsoGetPosition.cs.meta b/Assets/IsoTools/PlayMaker/Actions/IsoGetPosition.cs.meta new file mode 100644 index 0000000..6f43347 --- /dev/null +++ b/Assets/IsoTools/PlayMaker/Actions/IsoGetPosition.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: c611ab0e954f04d81bb71728da293513 +timeCreated: 1450001517 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/IsoTools/PlayMaker/Actions/IsoGetTilePosition.cs b/Assets/IsoTools/PlayMaker/Actions/IsoGetTilePosition.cs new file mode 100644 index 0000000..254fa96 --- /dev/null +++ b/Assets/IsoTools/PlayMaker/Actions/IsoGetTilePosition.cs @@ -0,0 +1,57 @@ +using UnityEngine; +using HutongGames.PlayMaker; + +namespace IsoTools.PlayMaker.Actions { + [ActionCategory("IsoTools")] + [HutongGames.PlayMaker.Tooltip("Gets the TilePosition of a IsoObject and stores it in a Vector3 Variable or each Axis in a Float Variable")] + public class IsoGetTilePosition : FsmStateAction { + [RequiredField] + public FsmOwnerDefault gameObject; + + [UIHint(UIHint.Variable)] + public FsmVector3 vector; + + [UIHint(UIHint.Variable)] + public FsmFloat x; + + [UIHint(UIHint.Variable)] + public FsmFloat y; + + [UIHint(UIHint.Variable)] + public FsmFloat z; + + public bool everyFrame; + + public override void Reset() { + gameObject = null; + vector = null; + x = null; + y = null; + z = null; + everyFrame = false; + } + + public override void OnEnter() { + DoGetPosition(); + if ( !everyFrame ) { + Finish(); + } + } + + public override void OnUpdate() { + DoGetPosition(); + } + + void DoGetPosition() { + var go = Fsm.GetOwnerDefaultTarget(gameObject); + var iso_object = go ? go.GetComponent() : null; + if ( iso_object ) { + var position = iso_object.tilePosition; + vector.Value = position; + x.Value = position.x; + y.Value = position.y; + z.Value = position.z; + } + } + } +} // IsoTools.PlayMaker.Actions \ No newline at end of file diff --git a/Assets/IsoTools/PlayMaker/Actions/IsoGetTilePosition.cs.meta b/Assets/IsoTools/PlayMaker/Actions/IsoGetTilePosition.cs.meta new file mode 100644 index 0000000..fb21bb6 --- /dev/null +++ b/Assets/IsoTools/PlayMaker/Actions/IsoGetTilePosition.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 99d3fea41e1994d8ca652d40c6e8bae5 +timeCreated: 1450007591 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/IsoTools/PlayMaker/Actions/IsoSetPosition.cs b/Assets/IsoTools/PlayMaker/Actions/IsoSetPosition.cs new file mode 100644 index 0000000..86953c4 --- /dev/null +++ b/Assets/IsoTools/PlayMaker/Actions/IsoSetPosition.cs @@ -0,0 +1,80 @@ +using UnityEngine; +using HutongGames.PlayMaker; + +namespace IsoTools.PlayMaker.Actions { + [ActionCategory("IsoTools")] + [HutongGames.PlayMaker.Tooltip("Sets the Position of a IsoObject. To leave any axis unchanged, set variable to 'None'.")] + public class IsoSetPosition : FsmStateAction { + [RequiredField] + [HutongGames.PlayMaker.Tooltip("The GameObject to position.")] + public FsmOwnerDefault gameObject; + + [UIHint(UIHint.Variable)] + [HutongGames.PlayMaker.Tooltip("Use a stored Vector3 position, and/or set individual axis below.")] + public FsmVector3 vector; + + public FsmFloat x; + public FsmFloat y; + public FsmFloat z; + + [HutongGames.PlayMaker.Tooltip("Repeat every frame.")] + public bool everyFrame; + + [HutongGames.PlayMaker.Tooltip("Perform in LateUpdate. This is useful if you want to override the position of objects that are animated or otherwise positioned in Update.")] + public bool lateUpdate; + + public override void Reset() { + gameObject = null; + vector = null; + x = new FsmFloat{UseVariable = true}; + y = new FsmFloat{UseVariable = true}; + z = new FsmFloat{UseVariable = true}; + everyFrame = false; + lateUpdate = false; + } + + public override void OnEnter() { + if ( !everyFrame && !lateUpdate ) { + DoSetPosition(); + Finish(); + } + } + + public override void OnUpdate() { + if ( !lateUpdate ) { + DoSetPosition(); + } + } + + public override void OnLateUpdate() { + if ( lateUpdate ) { + DoSetPosition(); + } + if ( !everyFrame ) { + Finish(); + } + } + + void DoSetPosition() { + var go = Fsm.GetOwnerDefaultTarget(gameObject); + var iso_object = go ? go.GetComponent() : null; + if ( iso_object ) { + var position = vector.IsNone + ? iso_object.position + : vector.Value; + + if ( !x.IsNone ) { + position.x = x.Value; + } + if ( !y.IsNone ) { + position.y = y.Value; + } + if ( !z.IsNone ) { + position.z = z.Value; + } + + iso_object.position = position; + } + } + } +} // IsoTools.PlayMaker.Actions \ No newline at end of file diff --git a/Assets/IsoTools/PlayMaker/Actions/IsoSetPosition.cs.meta b/Assets/IsoTools/PlayMaker/Actions/IsoSetPosition.cs.meta new file mode 100644 index 0000000..15b8ed5 --- /dev/null +++ b/Assets/IsoTools/PlayMaker/Actions/IsoSetPosition.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: f97bd76983db64be3adc438575153e6e +timeCreated: 1450001531 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/IsoTools/PlayMaker/Actions/IsoSetTilePosition.cs b/Assets/IsoTools/PlayMaker/Actions/IsoSetTilePosition.cs new file mode 100644 index 0000000..357de0a --- /dev/null +++ b/Assets/IsoTools/PlayMaker/Actions/IsoSetTilePosition.cs @@ -0,0 +1,80 @@ +using UnityEngine; +using HutongGames.PlayMaker; + +namespace IsoTools.PlayMaker.Actions { + [ActionCategory("IsoTools")] + [HutongGames.PlayMaker.Tooltip("Sets the TilePosition of a IsoObject. To leave any axis unchanged, set variable to 'None'.")] + public class IsoSetTilePosition : FsmStateAction { + [RequiredField] + [HutongGames.PlayMaker.Tooltip("The GameObject to position.")] + public FsmOwnerDefault gameObject; + + [UIHint(UIHint.Variable)] + [HutongGames.PlayMaker.Tooltip("Use a stored Vector3 position, and/or set individual axis below.")] + public FsmVector3 vector; + + public FsmFloat x; + public FsmFloat y; + public FsmFloat z; + + [HutongGames.PlayMaker.Tooltip("Repeat every frame.")] + public bool everyFrame; + + [HutongGames.PlayMaker.Tooltip("Perform in LateUpdate. This is useful if you want to override the position of objects that are animated or otherwise positioned in Update.")] + public bool lateUpdate; + + public override void Reset() { + gameObject = null; + vector = null; + x = new FsmFloat{UseVariable = true}; + y = new FsmFloat{UseVariable = true}; + z = new FsmFloat{UseVariable = true}; + everyFrame = false; + lateUpdate = false; + } + + public override void OnEnter() { + if ( !everyFrame && !lateUpdate ) { + DoSetPosition(); + Finish(); + } + } + + public override void OnUpdate() { + if ( !lateUpdate ) { + DoSetPosition(); + } + } + + public override void OnLateUpdate() { + if ( lateUpdate ) { + DoSetPosition(); + } + if ( !everyFrame ) { + Finish(); + } + } + + void DoSetPosition() { + var go = Fsm.GetOwnerDefaultTarget(gameObject); + var iso_object = go ? go.GetComponent() : null; + if ( iso_object ) { + var position = vector.IsNone + ? iso_object.tilePosition + : vector.Value; + + if ( !x.IsNone ) { + position.x = x.Value; + } + if ( !y.IsNone ) { + position.y = y.Value; + } + if ( !z.IsNone ) { + position.z = z.Value; + } + + iso_object.tilePosition = position; + } + } + } +} // IsoTools.PlayMaker.Actions \ No newline at end of file diff --git a/Assets/IsoTools/PlayMaker/Actions/IsoSetTilePosition.cs.meta b/Assets/IsoTools/PlayMaker/Actions/IsoSetTilePosition.cs.meta new file mode 100644 index 0000000..003a6cb --- /dev/null +++ b/Assets/IsoTools/PlayMaker/Actions/IsoSetTilePosition.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: da4f9180d267144b0ab45cccd2ac2787 +timeCreated: 1450007606 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/IsoTools/PlayMaker/Actions/IsoTranslate.cs b/Assets/IsoTools/PlayMaker/Actions/IsoTranslate.cs index 1b0300f..fb324f9 100644 --- a/Assets/IsoTools/PlayMaker/Actions/IsoTranslate.cs +++ b/Assets/IsoTools/PlayMaker/Actions/IsoTranslate.cs @@ -85,22 +85,22 @@ namespace IsoTools.PlayMaker.Actions { var go = Fsm.GetOwnerDefaultTarget(gameObject); var iso_object = go ? go.GetComponent() : null; if ( iso_object ) { - var trans = vector.IsNone + var translate = vector.IsNone ? new Vector3(x.Value, y.Value, z.Value) : vector.Value; if ( !x.IsNone ) { - trans.x = x.Value; + translate.x = x.Value; } if ( !y.IsNone ) { - trans.y = y.Value; + translate.y = y.Value; } if ( !z.IsNone ) { - trans.z = z.Value; + translate.z = z.Value; } - iso_object.position = iso_object.position + - trans * (perSecond ? Time.deltaTime : 1.0f); + iso_object.position += + translate * (perSecond ? Time.deltaTime : 1.0f); } } }