From cd540daa220a3776f1eea2d07c619bcddd8cc9a2 Mon Sep 17 00:00:00 2001 From: BlackMATov Date: Mon, 14 Dec 2015 02:08:53 +0600 Subject: [PATCH] New PlayMaker action: ChangeWorld --- Assembly-CSharp.csproj | 1 + Assets/IsoTools/Examples/Scenes/Scene07.unity | 51 +++++++++--------- .../PlayMaker/Actions/IsoChangeWorld.cs | 54 +++++++++++++++++++ .../PlayMaker/Actions/IsoChangeWorld.cs.meta | 12 +++++ .../IsoTools/PlayMaker/Actions/IsoGetMode.cs | 15 ++---- .../IsoTools/PlayMaker/Actions/IsoSetMode.cs | 1 + 6 files changed, 96 insertions(+), 38 deletions(-) create mode 100644 Assets/IsoTools/PlayMaker/Actions/IsoChangeWorld.cs create mode 100644 Assets/IsoTools/PlayMaker/Actions/IsoChangeWorld.cs.meta diff --git a/Assembly-CSharp.csproj b/Assembly-CSharp.csproj index f8f9203..336c28d 100644 --- a/Assembly-CSharp.csproj +++ b/Assembly-CSharp.csproj @@ -51,6 +51,7 @@ + diff --git a/Assets/IsoTools/Examples/Scenes/Scene07.unity b/Assets/IsoTools/Examples/Scenes/Scene07.unity index 11d2ecf..886be9b 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 @@ -441,10 +441,10 @@ MonoBehaviour: actionData: actionNames: - IsoTools.PlayMaker.Actions.IsoTranslate - - HutongGames.PlayMaker.Actions.Wait - IsoTools.PlayMaker.Actions.IsoGetPosition - IsoTools.PlayMaker.Actions.IsoGetSize - IsoTools.PlayMaker.Actions.IsoGetMode + - HutongGames.PlayMaker.Actions.Wait - PlayMaker.ConditionalExpression.ConditionalExpression customNames: - @@ -454,9 +454,9 @@ MonoBehaviour: - - actionEnabled: 010101010101 - actionIsOpen: 000000000100 - actionStartIndex: 00000000090000000c00000012000000180000001b000000 - actionHashCodes: 8ef8760048c011017ebd02027ebd020236f6fc01490c8701 + actionIsOpen: 000000010100 + actionStartIndex: 00000000090000000f00000015000000170000001a000000 + actionHashCodes: 8ef876007ebd02027ebd0202672cde0348c01101490c8701 unityObjectParams: [] fsmGameObjectParams: [] fsmOwnerDefaultParams: @@ -535,12 +535,6 @@ MonoBehaviour: showInInspector: 0 networkSync: 0 value: 0 - - useVariable: 0 - name: - tooltip: - showInInspector: 0 - networkSync: 0 - value: 1 - useVariable: 1 name: iso_x tooltip: @@ -577,6 +571,12 @@ MonoBehaviour: showInInspector: 0 networkSync: 0 value: 0 + - useVariable: 0 + name: + tooltip: + showInInspector: 0 + networkSync: 0 + value: 1 fsmIntParams: [] fsmBoolParams: - useVariable: 1 @@ -612,12 +612,12 @@ MonoBehaviour: - FINISHED - TO_RESET_POSITION - - byteData: 00000000010000000000 + byteData: 000000000000010000 arrayParamSizes: arrayParamTypes: [] customTypeSizes: customTypeNames: [] - paramDataType: 140000001c0000000f0000000f0000000f000000010000000100000001000000010000000f0000001700000001000000140000001c0000000f0000000f0000000f00000001000000140000001c0000000f0000000f0000000f00000001000000140000002a00000001000000120000001700000017000000010000000100000011000000 + paramDataType: 140000001c0000000f0000000f0000000f00000001000000010000000100000001000000140000001c0000000f0000000f0000000f00000001000000140000001c0000000f0000000f0000000f00000001000000140000002a0000000f0000001700000001000000120000001700000017000000010000000100000011000000 paramName: - gameObject - vector @@ -628,9 +628,6 @@ MonoBehaviour: - everyFrame - lateUpdate - fixedUpdate - - time - - finishEvent - - realTime - gameObject - vector - x @@ -645,15 +642,17 @@ MonoBehaviour: - everyFrame - gameObject - mode - - everyFrame + - time + - finishEvent + - realTime - expression - isTrueEvent - isFalseEvent - everyFrame - rawResult - storeResult - paramDataPos: 000000000000000000000000010000000200000000000000010000000200000003000000030000000000000004000000010000000100000004000000050000000600000005000000020000000200000007000000080000000900000006000000030000000000000007000000000000000100000002000000080000000900000000000000 - paramByteDataSize: 000000000000000000000000000000000000000001000000010000000100000001000000000000000000000001000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000001000000000000000000000001000000000000000000000000000000010000000100000000000000 + paramDataPos: 0000000000000000000000000100000002000000000000000100000002000000030000000100000001000000030000000400000005000000040000000200000002000000060000000700000008000000050000000300000000000000090000000000000006000000000000000100000002000000070000000800000000000000 + paramByteDataSize: 0000000000000000000000000000000000000000010000000100000001000000010000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000010000000000000000000000000000000000000001000000000000000000000000000000010000000100000000000000 - name: State 3 description: colorIndex: 0 @@ -895,7 +894,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 @@ -953,7 +952,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 @@ -999,11 +998,11 @@ Prefab: m_Modifications: - target: {fileID: 417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2} propertyPath: m_LocalPosition.x - value: -0.0000019073486 + value: -0.0000038146973 objectReference: {fileID: 0} - target: {fileID: 417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2} propertyPath: m_LocalPosition.y - value: 15.999999 + value: 31.999998 objectReference: {fileID: 0} - target: {fileID: 417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2} propertyPath: m_LocalPosition.z @@ -1031,11 +1030,11 @@ Prefab: objectReference: {fileID: 0} - target: {fileID: 11417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2} propertyPath: _position.x - value: 1 + value: 2 objectReference: {fileID: 0} - target: {fileID: 11417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2} propertyPath: _position.y - value: 1 + value: 2 objectReference: {fileID: 0} - target: {fileID: 11417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2} propertyPath: _position.z @@ -1112,7 +1111,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/IsoChangeWorld.cs b/Assets/IsoTools/PlayMaker/Actions/IsoChangeWorld.cs new file mode 100644 index 0000000..11bdbb8 --- /dev/null +++ b/Assets/IsoTools/PlayMaker/Actions/IsoChangeWorld.cs @@ -0,0 +1,54 @@ +using UnityEngine; +using HutongGames.PlayMaker; + +namespace IsoTools.PlayMaker.Actions { + [ActionCategory("IsoTools")] + [HutongGames.PlayMaker.Tooltip("Change IsoWorld options.")] + public class IsoChangeWorld : FsmStateAction { + + public FsmFloat tileSize; + public FsmFloat tileRatio; + public FsmFloat tileAngle; + public FsmFloat tileHeight; + public FsmFloat stepDepth; + public FsmFloat startDepth; + + public override void Reset() { + tileSize = new FsmFloat{UseVariable = true}; + tileRatio = new FsmFloat{UseVariable = true}; + tileAngle = new FsmFloat{UseVariable = true}; + tileHeight = new FsmFloat{UseVariable = true}; + stepDepth = new FsmFloat{UseVariable = true}; + startDepth = new FsmFloat{UseVariable = true}; + } + + public override void OnEnter() { + DoAction(); + Finish(); + } + + void DoAction() { + var iso_world = GameObject.FindObjectOfType(); + if ( iso_world ) { + if ( !tileSize.IsNone ) { + iso_world.tileSize = tileSize.Value; + } + if ( !tileRatio.IsNone ) { + iso_world.tileRatio = tileRatio.Value; + } + if ( !tileAngle.IsNone ) { + iso_world.tileAngle = tileAngle.Value; + } + if ( !tileHeight.IsNone ) { + iso_world.tileHeight = tileHeight.Value; + } + if ( !stepDepth.IsNone ) { + iso_world.stepDepth = stepDepth.Value; + } + if ( !startDepth.IsNone ) { + iso_world.startDepth = startDepth.Value; + } + } + } + } +} // IsoTools.PlayMaker.Actions \ No newline at end of file diff --git a/Assets/IsoTools/PlayMaker/Actions/IsoChangeWorld.cs.meta b/Assets/IsoTools/PlayMaker/Actions/IsoChangeWorld.cs.meta new file mode 100644 index 0000000..8c61325 --- /dev/null +++ b/Assets/IsoTools/PlayMaker/Actions/IsoChangeWorld.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 989d7fb6aa6b440f185314c637d25bd5 +timeCreated: 1450036398 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/IsoTools/PlayMaker/Actions/IsoGetMode.cs b/Assets/IsoTools/PlayMaker/Actions/IsoGetMode.cs index f8c3b80..e38a5f7 100644 --- a/Assets/IsoTools/PlayMaker/Actions/IsoGetMode.cs +++ b/Assets/IsoTools/PlayMaker/Actions/IsoGetMode.cs @@ -9,34 +9,25 @@ namespace IsoTools.PlayMaker.Actions { [CheckForComponent(typeof(IsoObject))] public FsmOwnerDefault gameObject; + [RequiredField] [ObjectType(typeof(IsoObject.Mode))] [UIHint(UIHint.Variable)] public FsmEnum mode; - public bool everyFrame; - public override void Reset() { gameObject = null; mode = null; - everyFrame = false; } public override void OnEnter() { DoAction(); - if ( !everyFrame ) { - Finish(); - } - } - - public override void OnUpdate() { - DoAction(); + Finish(); } void DoAction() { var go = Fsm.GetOwnerDefaultTarget(gameObject); if ( UpdateCache(go) ) { - var value = isoObject.mode; - mode.Value = value; + mode.Value = isoObject.mode; } } } diff --git a/Assets/IsoTools/PlayMaker/Actions/IsoSetMode.cs b/Assets/IsoTools/PlayMaker/Actions/IsoSetMode.cs index 84324ac..cd1c82b 100644 --- a/Assets/IsoTools/PlayMaker/Actions/IsoSetMode.cs +++ b/Assets/IsoTools/PlayMaker/Actions/IsoSetMode.cs @@ -9,6 +9,7 @@ namespace IsoTools.PlayMaker.Actions { [CheckForComponent(typeof(IsoObject))] public FsmOwnerDefault gameObject; + [RequiredField] [ObjectType(typeof(IsoObject.Mode))] public FsmEnum mode;