mirror of
https://github.com/BlackMATov/unity-iso-tools.git
synced 2025-12-15 01:12:05 +07:00
PlayMaker: cache action component
This commit is contained in:
@@ -51,6 +51,7 @@
|
|||||||
<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\IsoComponentAction.cs" />
|
||||||
<Compile Include="Assets\IsoTools\PlayMaker\Actions\IsoGetPosition.cs" />
|
<Compile Include="Assets\IsoTools\PlayMaker\Actions\IsoGetPosition.cs" />
|
||||||
<Compile Include="Assets\IsoTools\PlayMaker\Actions\IsoGetSize.cs" />
|
<Compile Include="Assets\IsoTools\PlayMaker\Actions\IsoGetSize.cs" />
|
||||||
<Compile Include="Assets\IsoTools\PlayMaker\Actions\IsoGetTilePosition.cs" />
|
<Compile Include="Assets\IsoTools\PlayMaker\Actions\IsoGetTilePosition.cs" />
|
||||||
|
|||||||
@@ -443,16 +443,18 @@ MonoBehaviour:
|
|||||||
- IsoTools.PlayMaker.Actions.IsoTranslate
|
- IsoTools.PlayMaker.Actions.IsoTranslate
|
||||||
- HutongGames.PlayMaker.Actions.Wait
|
- HutongGames.PlayMaker.Actions.Wait
|
||||||
- IsoTools.PlayMaker.Actions.IsoGetPosition
|
- IsoTools.PlayMaker.Actions.IsoGetPosition
|
||||||
|
- IsoTools.PlayMaker.Actions.IsoGetSize
|
||||||
- PlayMaker.ConditionalExpression.ConditionalExpression
|
- PlayMaker.ConditionalExpression.ConditionalExpression
|
||||||
customNames:
|
customNames:
|
||||||
-
|
-
|
||||||
-
|
-
|
||||||
-
|
-
|
||||||
-
|
-
|
||||||
actionEnabled: 01010101
|
-
|
||||||
actionIsOpen: 01010101
|
actionEnabled: 0101010101
|
||||||
actionStartIndex: 00000000090000000c00000012000000
|
actionIsOpen: 0000000000
|
||||||
actionHashCodes: 8ef8760048c011017ebd0202490c8701
|
actionStartIndex: 00000000090000000c0000001200000018000000
|
||||||
|
actionHashCodes: 8ef8760048c011017ebd02027ebd0202490c8701
|
||||||
unityObjectParams: []
|
unityObjectParams: []
|
||||||
fsmGameObjectParams: []
|
fsmGameObjectParams: []
|
||||||
fsmOwnerDefaultParams:
|
fsmOwnerDefaultParams:
|
||||||
@@ -472,6 +474,14 @@ MonoBehaviour:
|
|||||||
showInInspector: 0
|
showInInspector: 0
|
||||||
networkSync: 0
|
networkSync: 0
|
||||||
value: {fileID: 0}
|
value: {fileID: 0}
|
||||||
|
- ownerOption: 0
|
||||||
|
gameObject:
|
||||||
|
useVariable: 0
|
||||||
|
name:
|
||||||
|
tooltip:
|
||||||
|
showInInspector: 0
|
||||||
|
networkSync: 0
|
||||||
|
value: {fileID: 0}
|
||||||
animationCurveParams: []
|
animationCurveParams: []
|
||||||
functionCallParams: []
|
functionCallParams: []
|
||||||
fsmTemplateControlParams: []
|
fsmTemplateControlParams: []
|
||||||
@@ -532,6 +542,24 @@ MonoBehaviour:
|
|||||||
showInInspector: 0
|
showInInspector: 0
|
||||||
networkSync: 0
|
networkSync: 0
|
||||||
value: 0
|
value: 0
|
||||||
|
- useVariable: 1
|
||||||
|
name: iso_w
|
||||||
|
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: []
|
fsmIntParams: []
|
||||||
fsmBoolParams:
|
fsmBoolParams:
|
||||||
- useVariable: 1
|
- useVariable: 1
|
||||||
@@ -554,6 +582,12 @@ MonoBehaviour:
|
|||||||
showInInspector: 1
|
showInInspector: 1
|
||||||
networkSync: 0
|
networkSync: 0
|
||||||
value: {x: 0, y: 0, z: 0}
|
value: {x: 0, y: 0, z: 0}
|
||||||
|
- useVariable: 1
|
||||||
|
name: iso_size
|
||||||
|
tooltip:
|
||||||
|
showInInspector: 1
|
||||||
|
networkSync: 0
|
||||||
|
value: {x: 0, y: 0, z: 0}
|
||||||
fsmColorParams: []
|
fsmColorParams: []
|
||||||
fsmRectParams: []
|
fsmRectParams: []
|
||||||
fsmQuaternionParams: []
|
fsmQuaternionParams: []
|
||||||
@@ -561,12 +595,12 @@ MonoBehaviour:
|
|||||||
- FINISHED
|
- FINISHED
|
||||||
- TO_RESET_POSITION
|
- TO_RESET_POSITION
|
||||||
-
|
-
|
||||||
byteData: 0000000001000000
|
byteData: 000000000100000000
|
||||||
arrayParamSizes:
|
arrayParamSizes:
|
||||||
arrayParamTypes: []
|
arrayParamTypes: []
|
||||||
customTypeSizes:
|
customTypeSizes:
|
||||||
customTypeNames: []
|
customTypeNames: []
|
||||||
paramDataType: 140000001c0000000f0000000f0000000f000000010000000100000001000000010000000f0000001700000001000000140000001c0000000f0000000f0000000f00000001000000120000001700000017000000010000000100000011000000
|
paramDataType: 140000001c0000000f0000000f0000000f000000010000000100000001000000010000000f0000001700000001000000140000001c0000000f0000000f0000000f00000001000000140000001c0000000f0000000f0000000f00000001000000120000001700000017000000010000000100000011000000
|
||||||
paramName:
|
paramName:
|
||||||
- gameObject
|
- gameObject
|
||||||
- vector
|
- vector
|
||||||
@@ -586,14 +620,20 @@ MonoBehaviour:
|
|||||||
- y
|
- y
|
||||||
- z
|
- z
|
||||||
- everyFrame
|
- everyFrame
|
||||||
|
- gameObject
|
||||||
|
- vector
|
||||||
|
- x
|
||||||
|
- y
|
||||||
|
- z
|
||||||
|
- everyFrame
|
||||||
- expression
|
- expression
|
||||||
- isTrueEvent
|
- isTrueEvent
|
||||||
- isFalseEvent
|
- isFalseEvent
|
||||||
- everyFrame
|
- everyFrame
|
||||||
- rawResult
|
- rawResult
|
||||||
- storeResult
|
- storeResult
|
||||||
paramDataPos: 000000000000000000000000010000000200000000000000010000000200000003000000030000000000000004000000010000000100000004000000050000000600000005000000000000000100000002000000060000000700000000000000
|
paramDataPos: 000000000000000000000000010000000200000000000000010000000200000003000000030000000000000004000000010000000100000004000000050000000600000005000000020000000200000007000000080000000900000006000000000000000100000002000000070000000800000000000000
|
||||||
paramByteDataSize: 000000000000000000000000000000000000000001000000010000000100000001000000000000000000000001000000000000000000000000000000000000000000000001000000000000000000000000000000010000000100000000000000
|
paramByteDataSize: 000000000000000000000000000000000000000001000000010000000100000001000000000000000000000001000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000001000000000000000000000000000000010000000100000000000000
|
||||||
- name: State 3
|
- name: State 3
|
||||||
description:
|
description:
|
||||||
colorIndex: 0
|
colorIndex: 0
|
||||||
@@ -725,6 +765,12 @@ MonoBehaviour:
|
|||||||
colorIndex: 0
|
colorIndex: 0
|
||||||
variables:
|
variables:
|
||||||
floatVariables:
|
floatVariables:
|
||||||
|
- useVariable: 1
|
||||||
|
name: iso_w
|
||||||
|
tooltip:
|
||||||
|
showInInspector: 1
|
||||||
|
networkSync: 0
|
||||||
|
value: 0
|
||||||
- useVariable: 1
|
- useVariable: 1
|
||||||
name: iso_x
|
name: iso_x
|
||||||
tooltip:
|
tooltip:
|
||||||
@@ -742,6 +788,12 @@ MonoBehaviour:
|
|||||||
showInInspector: 1
|
showInInspector: 1
|
||||||
networkSync: 0
|
networkSync: 0
|
||||||
value: {x: 0, y: 0, z: 0}
|
value: {x: 0, y: 0, z: 0}
|
||||||
|
- useVariable: 1
|
||||||
|
name: iso_size
|
||||||
|
tooltip:
|
||||||
|
showInInspector: 1
|
||||||
|
networkSync: 0
|
||||||
|
value: {x: 0, y: 0, z: 0}
|
||||||
colorVariables: []
|
colorVariables: []
|
||||||
rectVariables: []
|
rectVariables: []
|
||||||
quaternionVariables: []
|
quaternionVariables: []
|
||||||
@@ -753,7 +805,7 @@ MonoBehaviour:
|
|||||||
enumVariables: []
|
enumVariables: []
|
||||||
categories:
|
categories:
|
||||||
-
|
-
|
||||||
variableCategoryIDs: 0000000000000000
|
variableCategoryIDs: 00000000000000000000000000000000
|
||||||
description:
|
description:
|
||||||
docUrl:
|
docUrl:
|
||||||
showStateLabel: 1
|
showStateLabel: 1
|
||||||
|
|||||||
49
Assets/IsoTools/PlayMaker/Actions/IsoComponentAction.cs
Normal file
49
Assets/IsoTools/PlayMaker/Actions/IsoComponentAction.cs
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
using UnityEngine;
|
||||||
|
using HutongGames.PlayMaker;
|
||||||
|
|
||||||
|
namespace IsoTools.PlayMaker.Actions {
|
||||||
|
public abstract class IsoComponentAction<T> : FsmStateAction where T : Component {
|
||||||
|
T _cachedComponent;
|
||||||
|
GameObject _cachedGameObject;
|
||||||
|
|
||||||
|
protected IsoWorld isoWorld {
|
||||||
|
get { return _cachedComponent as IsoWorld; }
|
||||||
|
}
|
||||||
|
|
||||||
|
protected IsoObject isoObject {
|
||||||
|
get { return _cachedComponent as IsoObject; }
|
||||||
|
}
|
||||||
|
|
||||||
|
protected IsoRigidbody isoRigidbody {
|
||||||
|
get { return _cachedComponent as IsoRigidbody; }
|
||||||
|
}
|
||||||
|
|
||||||
|
protected IsoCollider isoCollider {
|
||||||
|
get { return _cachedComponent as IsoCollider; }
|
||||||
|
}
|
||||||
|
|
||||||
|
protected IsoBoxCollider isoBoxCollider {
|
||||||
|
get { return _cachedComponent as IsoBoxCollider; }
|
||||||
|
}
|
||||||
|
|
||||||
|
protected IsoSphereCollider isoSphereCollider {
|
||||||
|
get { return _cachedComponent as IsoSphereCollider; }
|
||||||
|
}
|
||||||
|
|
||||||
|
protected bool UpdateCache(GameObject go) {
|
||||||
|
if ( go ) {
|
||||||
|
if ( _cachedComponent == null || _cachedGameObject != go ) {
|
||||||
|
_cachedComponent = go.GetComponent<T>();
|
||||||
|
_cachedGameObject = go;
|
||||||
|
if ( !_cachedComponent ) {
|
||||||
|
LogWarning("Missing component: " + typeof(T).FullName + " on: " + go.name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
_cachedComponent = null;
|
||||||
|
_cachedGameObject = null;
|
||||||
|
}
|
||||||
|
return _cachedComponent != null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} // IsoTools.PlayMaker.Actions
|
||||||
12
Assets/IsoTools/PlayMaker/Actions/IsoComponentAction.cs.meta
Normal file
12
Assets/IsoTools/PlayMaker/Actions/IsoComponentAction.cs.meta
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 063a1435f504a41b691d2cecde558bc9
|
||||||
|
timeCreated: 1450018514
|
||||||
|
licenseType: Free
|
||||||
|
MonoImporter:
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -4,8 +4,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 : FsmStateAction {
|
public class IsoGetPosition : IsoComponentAction<IsoObject> {
|
||||||
[RequiredField]
|
[RequiredField]
|
||||||
|
[CheckForComponent(typeof(IsoObject))]
|
||||||
public FsmOwnerDefault gameObject;
|
public FsmOwnerDefault gameObject;
|
||||||
|
|
||||||
[UIHint(UIHint.Variable)]
|
[UIHint(UIHint.Variable)]
|
||||||
@@ -44,9 +45,8 @@ namespace IsoTools.PlayMaker.Actions {
|
|||||||
|
|
||||||
void DoGetPosition() {
|
void DoGetPosition() {
|
||||||
var go = Fsm.GetOwnerDefaultTarget(gameObject);
|
var go = Fsm.GetOwnerDefaultTarget(gameObject);
|
||||||
var iso_object = go ? go.GetComponent<IsoObject>() : null;
|
if ( UpdateCache(go) ) {
|
||||||
if ( iso_object ) {
|
var position = isoObject.position;
|
||||||
var position = iso_object.position;
|
|
||||||
vector.Value = position;
|
vector.Value = position;
|
||||||
x.Value = position.x;
|
x.Value = position.x;
|
||||||
y.Value = position.y;
|
y.Value = position.y;
|
||||||
|
|||||||
@@ -4,8 +4,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 : FsmStateAction {
|
public class IsoGetSize : IsoComponentAction<IsoObject> {
|
||||||
[RequiredField]
|
[RequiredField]
|
||||||
|
[CheckForComponent(typeof(IsoObject))]
|
||||||
public FsmOwnerDefault gameObject;
|
public FsmOwnerDefault gameObject;
|
||||||
|
|
||||||
[UIHint(UIHint.Variable)]
|
[UIHint(UIHint.Variable)]
|
||||||
@@ -44,9 +45,8 @@ namespace IsoTools.PlayMaker.Actions {
|
|||||||
|
|
||||||
void DoGetSize() {
|
void DoGetSize() {
|
||||||
var go = Fsm.GetOwnerDefaultTarget(gameObject);
|
var go = Fsm.GetOwnerDefaultTarget(gameObject);
|
||||||
var iso_object = go ? go.GetComponent<IsoObject>() : null;
|
if ( UpdateCache(go) ) {
|
||||||
if ( iso_object ) {
|
var size = isoObject.size;
|
||||||
var size = iso_object.size;
|
|
||||||
vector.Value = size;
|
vector.Value = size;
|
||||||
x.Value = size.x;
|
x.Value = size.x;
|
||||||
y.Value = size.y;
|
y.Value = size.y;
|
||||||
|
|||||||
@@ -4,8 +4,9 @@ using HutongGames.PlayMaker;
|
|||||||
namespace IsoTools.PlayMaker.Actions {
|
namespace IsoTools.PlayMaker.Actions {
|
||||||
[ActionCategory("IsoTools")]
|
[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")]
|
[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 {
|
public class IsoGetTilePosition : IsoComponentAction<IsoObject> {
|
||||||
[RequiredField]
|
[RequiredField]
|
||||||
|
[CheckForComponent(typeof(IsoObject))]
|
||||||
public FsmOwnerDefault gameObject;
|
public FsmOwnerDefault gameObject;
|
||||||
|
|
||||||
[UIHint(UIHint.Variable)]
|
[UIHint(UIHint.Variable)]
|
||||||
@@ -44,9 +45,8 @@ namespace IsoTools.PlayMaker.Actions {
|
|||||||
|
|
||||||
void DoGetPosition() {
|
void DoGetPosition() {
|
||||||
var go = Fsm.GetOwnerDefaultTarget(gameObject);
|
var go = Fsm.GetOwnerDefaultTarget(gameObject);
|
||||||
var iso_object = go ? go.GetComponent<IsoObject>() : null;
|
if ( UpdateCache(go) ) {
|
||||||
if ( iso_object ) {
|
var position = isoObject.tilePosition;
|
||||||
var position = iso_object.tilePosition;
|
|
||||||
vector.Value = position;
|
vector.Value = position;
|
||||||
x.Value = position.x;
|
x.Value = position.x;
|
||||||
y.Value = position.y;
|
y.Value = position.y;
|
||||||
|
|||||||
@@ -4,8 +4,9 @@ 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 : FsmStateAction {
|
public class IsoSetPosition : IsoComponentAction<IsoObject> {
|
||||||
[RequiredField]
|
[RequiredField]
|
||||||
|
[CheckForComponent(typeof(IsoObject))]
|
||||||
public FsmOwnerDefault gameObject;
|
public FsmOwnerDefault gameObject;
|
||||||
|
|
||||||
[UIHint(UIHint.Variable)]
|
[UIHint(UIHint.Variable)]
|
||||||
@@ -52,10 +53,9 @@ namespace IsoTools.PlayMaker.Actions {
|
|||||||
|
|
||||||
void DoSetPosition() {
|
void DoSetPosition() {
|
||||||
var go = Fsm.GetOwnerDefaultTarget(gameObject);
|
var go = Fsm.GetOwnerDefaultTarget(gameObject);
|
||||||
var iso_object = go ? go.GetComponent<IsoObject>() : null;
|
if ( UpdateCache(go) ) {
|
||||||
if ( iso_object ) {
|
|
||||||
var position = vector.IsNone
|
var position = vector.IsNone
|
||||||
? iso_object.position
|
? isoObject.position
|
||||||
: vector.Value;
|
: vector.Value;
|
||||||
|
|
||||||
if ( !x.IsNone ) {
|
if ( !x.IsNone ) {
|
||||||
@@ -68,7 +68,7 @@ namespace IsoTools.PlayMaker.Actions {
|
|||||||
position.z = z.Value;
|
position.z = z.Value;
|
||||||
}
|
}
|
||||||
|
|
||||||
iso_object.position = position;
|
isoObject.position = position;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,8 +4,9 @@ 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 : FsmStateAction {
|
public class IsoSetSize : IsoComponentAction<IsoObject> {
|
||||||
[RequiredField]
|
[RequiredField]
|
||||||
|
[CheckForComponent(typeof(IsoObject))]
|
||||||
public FsmOwnerDefault gameObject;
|
public FsmOwnerDefault gameObject;
|
||||||
|
|
||||||
[UIHint(UIHint.Variable)]
|
[UIHint(UIHint.Variable)]
|
||||||
@@ -52,10 +53,9 @@ namespace IsoTools.PlayMaker.Actions {
|
|||||||
|
|
||||||
void DoSetSize() {
|
void DoSetSize() {
|
||||||
var go = Fsm.GetOwnerDefaultTarget(gameObject);
|
var go = Fsm.GetOwnerDefaultTarget(gameObject);
|
||||||
var iso_object = go ? go.GetComponent<IsoObject>() : null;
|
if ( UpdateCache(go) ) {
|
||||||
if ( iso_object ) {
|
|
||||||
var size = vector.IsNone
|
var size = vector.IsNone
|
||||||
? iso_object.size
|
? isoObject.size
|
||||||
: vector.Value;
|
: vector.Value;
|
||||||
|
|
||||||
if ( !x.IsNone ) {
|
if ( !x.IsNone ) {
|
||||||
@@ -68,7 +68,7 @@ namespace IsoTools.PlayMaker.Actions {
|
|||||||
size.z = z.Value;
|
size.z = z.Value;
|
||||||
}
|
}
|
||||||
|
|
||||||
iso_object.size = size;
|
isoObject.size = size;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,8 +4,9 @@ using HutongGames.PlayMaker;
|
|||||||
namespace IsoTools.PlayMaker.Actions {
|
namespace IsoTools.PlayMaker.Actions {
|
||||||
[ActionCategory("IsoTools")]
|
[ActionCategory("IsoTools")]
|
||||||
[HutongGames.PlayMaker.Tooltip("Sets the TilePosition of a IsoObject. To leave any axis unchanged, set variable to 'None'.")]
|
[HutongGames.PlayMaker.Tooltip("Sets the TilePosition of a IsoObject. To leave any axis unchanged, set variable to 'None'.")]
|
||||||
public class IsoSetTilePosition : FsmStateAction {
|
public class IsoSetTilePosition : IsoComponentAction<IsoObject> {
|
||||||
[RequiredField]
|
[RequiredField]
|
||||||
|
[CheckForComponent(typeof(IsoObject))]
|
||||||
public FsmOwnerDefault gameObject;
|
public FsmOwnerDefault gameObject;
|
||||||
|
|
||||||
[UIHint(UIHint.Variable)]
|
[UIHint(UIHint.Variable)]
|
||||||
@@ -52,10 +53,9 @@ namespace IsoTools.PlayMaker.Actions {
|
|||||||
|
|
||||||
void DoSetTilePosition() {
|
void DoSetTilePosition() {
|
||||||
var go = Fsm.GetOwnerDefaultTarget(gameObject);
|
var go = Fsm.GetOwnerDefaultTarget(gameObject);
|
||||||
var iso_object = go ? go.GetComponent<IsoObject>() : null;
|
if ( UpdateCache(go) ) {
|
||||||
if ( iso_object ) {
|
|
||||||
var tile_position = vector.IsNone
|
var tile_position = vector.IsNone
|
||||||
? iso_object.tilePosition
|
? isoObject.tilePosition
|
||||||
: vector.Value;
|
: vector.Value;
|
||||||
|
|
||||||
if ( !x.IsNone ) {
|
if ( !x.IsNone ) {
|
||||||
@@ -68,7 +68,7 @@ namespace IsoTools.PlayMaker.Actions {
|
|||||||
tile_position.z = z.Value;
|
tile_position.z = z.Value;
|
||||||
}
|
}
|
||||||
|
|
||||||
iso_object.tilePosition = tile_position;
|
isoObject.tilePosition = tile_position;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,8 +4,9 @@ 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 : FsmStateAction {
|
public class IsoTranslate : IsoComponentAction<IsoObject> {
|
||||||
[RequiredField]
|
[RequiredField]
|
||||||
|
[CheckForComponent(typeof(IsoObject))]
|
||||||
public FsmOwnerDefault gameObject;
|
public FsmOwnerDefault gameObject;
|
||||||
|
|
||||||
[UIHint(UIHint.Variable)]
|
[UIHint(UIHint.Variable)]
|
||||||
@@ -69,8 +70,7 @@ namespace IsoTools.PlayMaker.Actions {
|
|||||||
|
|
||||||
void DoTranlate() {
|
void DoTranlate() {
|
||||||
var go = Fsm.GetOwnerDefaultTarget(gameObject);
|
var go = Fsm.GetOwnerDefaultTarget(gameObject);
|
||||||
var iso_object = go ? go.GetComponent<IsoObject>() : null;
|
if ( UpdateCache(go) ) {
|
||||||
if ( iso_object ) {
|
|
||||||
var translate = 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;
|
||||||
@@ -85,7 +85,7 @@ namespace IsoTools.PlayMaker.Actions {
|
|||||||
translate.z = z.Value;
|
translate.z = z.Value;
|
||||||
}
|
}
|
||||||
|
|
||||||
iso_object.position +=
|
isoObject.position +=
|
||||||
translate * (perSecond ? Time.deltaTime : 1.0f);
|
translate * (perSecond ? Time.deltaTime : 1.0f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user