mirror of
https://github.com/BlackMATov/unity-iso-tools.git
synced 2025-12-15 01:12:05 +07:00
New PlayMaker actions: GetPosition, GetTilePosition, SetPosition, SetTilePosition
This commit is contained in:
@@ -51,6 +51,10 @@
|
|||||||
<Compile Include="Assets\IsoTools\Examples\Scripts\CubeAutoMovement.cs" />
|
<Compile Include="Assets\IsoTools\Examples\Scripts\CubeAutoMovement.cs" />
|
||||||
<Compile Include="Assets\IsoTools\Examples\Scripts\IsoEchoListener.cs" />
|
<Compile Include="Assets\IsoTools\Examples\Scripts\IsoEchoListener.cs" />
|
||||||
<Compile Include="Assets\IsoTools\Examples\Scripts\PlayerController.cs" />
|
<Compile Include="Assets\IsoTools\Examples\Scripts\PlayerController.cs" />
|
||||||
|
<Compile Include="Assets\IsoTools\PlayMaker\Actions\IsoGetPosition.cs" />
|
||||||
|
<Compile Include="Assets\IsoTools\PlayMaker\Actions\IsoGetTilePosition.cs" />
|
||||||
|
<Compile Include="Assets\IsoTools\PlayMaker\Actions\IsoSetPosition.cs" />
|
||||||
|
<Compile Include="Assets\IsoTools\PlayMaker\Actions\IsoSetTilePosition.cs" />
|
||||||
<Compile Include="Assets\IsoTools\PlayMaker\Actions\IsoTranslate.cs" />
|
<Compile Include="Assets\IsoTools\PlayMaker\Actions\IsoTranslate.cs" />
|
||||||
<Compile Include="Assets\IsoTools\Scripts\IsoBoxCollider.cs" />
|
<Compile Include="Assets\IsoTools\Scripts\IsoBoxCollider.cs" />
|
||||||
<Compile Include="Assets\IsoTools\Scripts\IsoCollider.cs" />
|
<Compile Include="Assets\IsoTools\Scripts\IsoCollider.cs" />
|
||||||
|
|||||||
@@ -102,7 +102,7 @@ Prefab:
|
|||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 453404, guid: d10e5320df9f84d4186bda0ba98db9ff, type: 2}
|
- target: {fileID: 453404, guid: d10e5320df9f84d4186bda0ba98db9ff, type: 2}
|
||||||
propertyPath: m_LocalPosition.z
|
propertyPath: m_LocalPosition.z
|
||||||
value: 1.3000001
|
value: 1.4000001
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 453404, guid: d10e5320df9f84d4186bda0ba98db9ff, type: 2}
|
- target: {fileID: 453404, guid: d10e5320df9f84d4186bda0ba98db9ff, type: 2}
|
||||||
propertyPath: m_LocalRotation.x
|
propertyPath: m_LocalRotation.x
|
||||||
@@ -422,8 +422,8 @@ MonoBehaviour:
|
|||||||
colorIndex: 0
|
colorIndex: 0
|
||||||
position:
|
position:
|
||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
x: 240.82031
|
x: 84.453125
|
||||||
y: 102.17969
|
y: 167.6875
|
||||||
width: 100
|
width: 100
|
||||||
height: 32
|
height: 32
|
||||||
isBreakpoint: 0
|
isBreakpoint: 0
|
||||||
@@ -442,16 +442,28 @@ MonoBehaviour:
|
|||||||
actionNames:
|
actionNames:
|
||||||
- IsoTools.PlayMaker.Actions.IsoTranslate
|
- IsoTools.PlayMaker.Actions.IsoTranslate
|
||||||
- HutongGames.PlayMaker.Actions.Wait
|
- HutongGames.PlayMaker.Actions.Wait
|
||||||
|
- IsoTools.PlayMaker.Actions.IsoGetPosition
|
||||||
|
- PlayMaker.ConditionalExpression.ConditionalExpression
|
||||||
customNames:
|
customNames:
|
||||||
-
|
-
|
||||||
-
|
-
|
||||||
actionEnabled: 0101
|
-
|
||||||
actionIsOpen: 0101
|
-
|
||||||
actionStartIndex: 0000000009000000
|
actionEnabled: 01010101
|
||||||
actionHashCodes: 8ef8760048c01101
|
actionIsOpen: 01010101
|
||||||
|
actionStartIndex: 00000000090000000c00000012000000
|
||||||
|
actionHashCodes: 8ef8760048c011017ebd0202490c8701
|
||||||
unityObjectParams: []
|
unityObjectParams: []
|
||||||
fsmGameObjectParams: []
|
fsmGameObjectParams: []
|
||||||
fsmOwnerDefaultParams:
|
fsmOwnerDefaultParams:
|
||||||
|
- ownerOption: 0
|
||||||
|
gameObject:
|
||||||
|
useVariable: 0
|
||||||
|
name:
|
||||||
|
tooltip:
|
||||||
|
showInInspector: 0
|
||||||
|
networkSync: 0
|
||||||
|
value: {fileID: 0}
|
||||||
- ownerOption: 0
|
- ownerOption: 0
|
||||||
gameObject:
|
gameObject:
|
||||||
useVariable: 0
|
useVariable: 0
|
||||||
@@ -466,7 +478,13 @@ MonoBehaviour:
|
|||||||
fsmEventTargetParams: []
|
fsmEventTargetParams: []
|
||||||
fsmPropertyParams: []
|
fsmPropertyParams: []
|
||||||
layoutOptionParams: []
|
layoutOptionParams: []
|
||||||
fsmStringParams: []
|
fsmStringParams:
|
||||||
|
- useVariable: 0
|
||||||
|
name:
|
||||||
|
tooltip:
|
||||||
|
showInInspector: 0
|
||||||
|
networkSync: 0
|
||||||
|
value: iso_x == 5
|
||||||
fsmObjectParams: []
|
fsmObjectParams: []
|
||||||
fsmVarParams: []
|
fsmVarParams: []
|
||||||
fsmArrayParams: []
|
fsmArrayParams: []
|
||||||
@@ -496,6 +514,165 @@ MonoBehaviour:
|
|||||||
showInInspector: 0
|
showInInspector: 0
|
||||||
networkSync: 0
|
networkSync: 0
|
||||||
value: 1
|
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: []
|
fsmIntParams: []
|
||||||
fsmBoolParams: []
|
fsmBoolParams: []
|
||||||
fsmVector2Params: []
|
fsmVector2Params: []
|
||||||
@@ -511,39 +688,60 @@ MonoBehaviour:
|
|||||||
fsmQuaternionParams: []
|
fsmQuaternionParams: []
|
||||||
stringParams:
|
stringParams:
|
||||||
- FINISHED
|
- FINISHED
|
||||||
byteData: 0000000001
|
byteData: 000001
|
||||||
arrayParamSizes:
|
arrayParamSizes:
|
||||||
arrayParamTypes: []
|
arrayParamTypes: []
|
||||||
customTypeSizes:
|
customTypeSizes:
|
||||||
customTypeNames: []
|
customTypeNames: []
|
||||||
paramDataType: 140000001c0000000f0000000f0000000f000000010000000100000001000000010000000f0000001700000001000000
|
paramDataType: 140000001c0000000f0000000f0000000f00000001000000010000000f0000001700000001000000
|
||||||
paramName:
|
paramName:
|
||||||
- gameObject
|
- gameObject
|
||||||
- vector
|
- vector
|
||||||
- x
|
- x
|
||||||
- y
|
- y
|
||||||
- z
|
- z
|
||||||
- perSecond
|
|
||||||
- everyFrame
|
- everyFrame
|
||||||
- lateUpdate
|
- lateUpdate
|
||||||
- fixedUpdate
|
|
||||||
- time
|
- time
|
||||||
- finishEvent
|
- finishEvent
|
||||||
- realTime
|
- realTime
|
||||||
paramDataPos: 000000000000000000000000010000000200000000000000010000000200000003000000030000000000000004000000
|
paramDataPos: 00000000000000000000000001000000020000000000000001000000030000000000000002000000
|
||||||
paramByteDataSize: 000000000000000000000000000000000000000001000000010000000100000001000000000000000000000001000000
|
paramByteDataSize: 00000000000000000000000000000000000000000100000001000000000000000000000001000000
|
||||||
events:
|
events:
|
||||||
- name: FINISHED
|
- name: FINISHED
|
||||||
isSystemEvent: 1
|
isSystemEvent: 1
|
||||||
isGlobal: 0
|
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:
|
variables:
|
||||||
floatVariables: []
|
floatVariables:
|
||||||
|
- useVariable: 1
|
||||||
|
name: iso_x
|
||||||
|
tooltip:
|
||||||
|
showInInspector: 1
|
||||||
|
networkSync: 0
|
||||||
|
value: 0
|
||||||
intVariables: []
|
intVariables: []
|
||||||
boolVariables: []
|
boolVariables: []
|
||||||
stringVariables: []
|
stringVariables: []
|
||||||
vector2Variables: []
|
vector2Variables: []
|
||||||
vector3Variables: []
|
vector3Variables:
|
||||||
|
- useVariable: 1
|
||||||
|
name: iso_position
|
||||||
|
tooltip:
|
||||||
|
showInInspector: 1
|
||||||
|
networkSync: 0
|
||||||
|
value: {x: 0, y: 0, z: 0}
|
||||||
colorVariables: []
|
colorVariables: []
|
||||||
rectVariables: []
|
rectVariables: []
|
||||||
quaternionVariables: []
|
quaternionVariables: []
|
||||||
@@ -555,7 +753,7 @@ MonoBehaviour:
|
|||||||
enumVariables: []
|
enumVariables: []
|
||||||
categories:
|
categories:
|
||||||
-
|
-
|
||||||
variableCategoryIDs:
|
variableCategoryIDs: 0000000000000000
|
||||||
description:
|
description:
|
||||||
docUrl:
|
docUrl:
|
||||||
showStateLabel: 1
|
showStateLabel: 1
|
||||||
@@ -577,7 +775,7 @@ MonoBehaviour:
|
|||||||
handleCollisionExit: 0
|
handleCollisionExit: 0
|
||||||
handleCollisionStay: 0
|
handleCollisionStay: 0
|
||||||
handleOnGUI: 0
|
handleOnGUI: 0
|
||||||
handleFixedUpdate: 0
|
handleFixedUpdate: 1
|
||||||
handleApplicationEvents: 0
|
handleApplicationEvents: 0
|
||||||
fsmTemplate: {fileID: 0}
|
fsmTemplate: {fileID: 0}
|
||||||
eventHandlerComponentsAdded: 0
|
eventHandlerComponentsAdded: 0
|
||||||
@@ -598,7 +796,7 @@ Prefab:
|
|||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 453404, guid: d10e5320df9f84d4186bda0ba98db9ff, type: 2}
|
- target: {fileID: 453404, guid: d10e5320df9f84d4186bda0ba98db9ff, type: 2}
|
||||||
propertyPath: m_LocalPosition.z
|
propertyPath: m_LocalPosition.z
|
||||||
value: 1.4000001
|
value: 1.3000001
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 453404, guid: d10e5320df9f84d4186bda0ba98db9ff, type: 2}
|
- target: {fileID: 453404, guid: d10e5320df9f84d4186bda0ba98db9ff, type: 2}
|
||||||
propertyPath: m_LocalRotation.x
|
propertyPath: m_LocalRotation.x
|
||||||
@@ -656,7 +854,7 @@ Prefab:
|
|||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 453404, guid: d10e5320df9f84d4186bda0ba98db9ff, type: 2}
|
- target: {fileID: 453404, guid: d10e5320df9f84d4186bda0ba98db9ff, type: 2}
|
||||||
propertyPath: m_LocalPosition.z
|
propertyPath: m_LocalPosition.z
|
||||||
value: 1.1
|
value: 1.2
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 453404, guid: d10e5320df9f84d4186bda0ba98db9ff, type: 2}
|
- target: {fileID: 453404, guid: d10e5320df9f84d4186bda0ba98db9ff, type: 2}
|
||||||
propertyPath: m_LocalRotation.x
|
propertyPath: m_LocalRotation.x
|
||||||
@@ -811,7 +1009,7 @@ Prefab:
|
|||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 453404, guid: d10e5320df9f84d4186bda0ba98db9ff, type: 2}
|
- target: {fileID: 453404, guid: d10e5320df9f84d4186bda0ba98db9ff, type: 2}
|
||||||
propertyPath: m_LocalPosition.z
|
propertyPath: m_LocalPosition.z
|
||||||
value: 1.2
|
value: 1.1
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 453404, guid: d10e5320df9f84d4186bda0ba98db9ff, type: 2}
|
- target: {fileID: 453404, guid: d10e5320df9f84d4186bda0ba98db9ff, type: 2}
|
||||||
propertyPath: m_LocalRotation.x
|
propertyPath: m_LocalRotation.x
|
||||||
|
|||||||
57
Assets/IsoTools/PlayMaker/Actions/IsoGetPosition.cs
Normal file
57
Assets/IsoTools/PlayMaker/Actions/IsoGetPosition.cs
Normal file
@@ -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<IsoObject>() : 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
|
||||||
12
Assets/IsoTools/PlayMaker/Actions/IsoGetPosition.cs.meta
Normal file
12
Assets/IsoTools/PlayMaker/Actions/IsoGetPosition.cs.meta
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: c611ab0e954f04d81bb71728da293513
|
||||||
|
timeCreated: 1450001517
|
||||||
|
licenseType: Free
|
||||||
|
MonoImporter:
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
57
Assets/IsoTools/PlayMaker/Actions/IsoGetTilePosition.cs
Normal file
57
Assets/IsoTools/PlayMaker/Actions/IsoGetTilePosition.cs
Normal file
@@ -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<IsoObject>() : 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
|
||||||
12
Assets/IsoTools/PlayMaker/Actions/IsoGetTilePosition.cs.meta
Normal file
12
Assets/IsoTools/PlayMaker/Actions/IsoGetTilePosition.cs.meta
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 99d3fea41e1994d8ca652d40c6e8bae5
|
||||||
|
timeCreated: 1450007591
|
||||||
|
licenseType: Free
|
||||||
|
MonoImporter:
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
80
Assets/IsoTools/PlayMaker/Actions/IsoSetPosition.cs
Normal file
80
Assets/IsoTools/PlayMaker/Actions/IsoSetPosition.cs
Normal file
@@ -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<IsoObject>() : 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
|
||||||
12
Assets/IsoTools/PlayMaker/Actions/IsoSetPosition.cs.meta
Normal file
12
Assets/IsoTools/PlayMaker/Actions/IsoSetPosition.cs.meta
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: f97bd76983db64be3adc438575153e6e
|
||||||
|
timeCreated: 1450001531
|
||||||
|
licenseType: Free
|
||||||
|
MonoImporter:
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
80
Assets/IsoTools/PlayMaker/Actions/IsoSetTilePosition.cs
Normal file
80
Assets/IsoTools/PlayMaker/Actions/IsoSetTilePosition.cs
Normal file
@@ -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<IsoObject>() : 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
|
||||||
12
Assets/IsoTools/PlayMaker/Actions/IsoSetTilePosition.cs.meta
Normal file
12
Assets/IsoTools/PlayMaker/Actions/IsoSetTilePosition.cs.meta
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: da4f9180d267144b0ab45cccd2ac2787
|
||||||
|
timeCreated: 1450007606
|
||||||
|
licenseType: Free
|
||||||
|
MonoImporter:
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -85,22 +85,22 @@ namespace IsoTools.PlayMaker.Actions {
|
|||||||
var go = Fsm.GetOwnerDefaultTarget(gameObject);
|
var go = Fsm.GetOwnerDefaultTarget(gameObject);
|
||||||
var iso_object = go ? go.GetComponent<IsoObject>() : null;
|
var iso_object = go ? go.GetComponent<IsoObject>() : null;
|
||||||
if ( iso_object ) {
|
if ( iso_object ) {
|
||||||
var trans = vector.IsNone
|
var translate = vector.IsNone
|
||||||
? new Vector3(x.Value, y.Value, z.Value)
|
? new Vector3(x.Value, y.Value, z.Value)
|
||||||
: vector.Value;
|
: vector.Value;
|
||||||
|
|
||||||
if ( !x.IsNone ) {
|
if ( !x.IsNone ) {
|
||||||
trans.x = x.Value;
|
translate.x = x.Value;
|
||||||
}
|
}
|
||||||
if ( !y.IsNone ) {
|
if ( !y.IsNone ) {
|
||||||
trans.y = y.Value;
|
translate.y = y.Value;
|
||||||
}
|
}
|
||||||
if ( !z.IsNone ) {
|
if ( !z.IsNone ) {
|
||||||
trans.z = z.Value;
|
translate.z = z.Value;
|
||||||
}
|
}
|
||||||
|
|
||||||
iso_object.position = iso_object.position +
|
iso_object.position +=
|
||||||
trans * (perSecond ? Time.deltaTime : 1.0f);
|
translate * (perSecond ? Time.deltaTime : 1.0f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user