New PlayMaker action: GetMode

This commit is contained in:
2015-12-13 23:08:18 +06:00
parent ffaed11858
commit e8627d11ee
11 changed files with 193 additions and 53 deletions

View File

@@ -52,6 +52,7 @@
<Compile Include="Assets\IsoTools\Examples\Scripts\IsoEchoListener.cs" />
<Compile Include="Assets\IsoTools\Examples\Scripts\PlayerController.cs" />
<Compile Include="Assets\IsoTools\PlayMaker\Actions\IsoComponentAction.cs" />
<Compile Include="Assets\IsoTools\PlayMaker\Actions\IsoGetMode.cs" />
<Compile Include="Assets\IsoTools\PlayMaker\Actions\IsoGetPosition.cs" />
<Compile Include="Assets\IsoTools\PlayMaker\Actions\IsoGetSize.cs" />
<Compile Include="Assets\IsoTools\PlayMaker\Actions\IsoResize.cs" />

View File

@@ -444,6 +444,7 @@ MonoBehaviour:
- HutongGames.PlayMaker.Actions.Wait
- IsoTools.PlayMaker.Actions.IsoGetPosition
- IsoTools.PlayMaker.Actions.IsoGetSize
- IsoTools.PlayMaker.Actions.IsoGetMode
- PlayMaker.ConditionalExpression.ConditionalExpression
customNames:
-
@@ -451,10 +452,11 @@ MonoBehaviour:
-
-
-
actionEnabled: 0101010101
actionIsOpen: 0000000000
actionStartIndex: 00000000090000000c0000001200000018000000
actionHashCodes: 8ef8760048c011017ebd02027ebd0202490c8701
-
actionEnabled: 010101010101
actionIsOpen: 000000000100
actionStartIndex: 00000000090000000c00000012000000180000001b000000
actionHashCodes: 8ef8760048c011017ebd02027ebd020236f6fc01490c8701
unityObjectParams: []
fsmGameObjectParams: []
fsmOwnerDefaultParams:
@@ -482,6 +484,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: []
@@ -498,7 +508,14 @@ MonoBehaviour:
fsmObjectParams: []
fsmVarParams: []
fsmArrayParams: []
fsmEnumParams: []
fsmEnumParams:
- useVariable: 1
name: iso_mode
tooltip:
showInInspector: 1
networkSync: 0
enumName: IsoTools.IsoObject+Mode
intValue: 0
fsmFloatParams:
- useVariable: 1
name:
@@ -595,12 +612,12 @@ MonoBehaviour:
- FINISHED
- TO_RESET_POSITION
-
byteData: 000000000100000000
byteData: 00000000010000000000
arrayParamSizes:
arrayParamTypes: []
customTypeSizes:
customTypeNames: []
paramDataType: 140000001c0000000f0000000f0000000f000000010000000100000001000000010000000f0000001700000001000000140000001c0000000f0000000f0000000f00000001000000140000001c0000000f0000000f0000000f00000001000000120000001700000017000000010000000100000011000000
paramDataType: 140000001c0000000f0000000f0000000f000000010000000100000001000000010000000f0000001700000001000000140000001c0000000f0000000f0000000f00000001000000140000001c0000000f0000000f0000000f00000001000000140000002a00000001000000120000001700000017000000010000000100000011000000
paramName:
- gameObject
- vector
@@ -626,14 +643,17 @@ MonoBehaviour:
- y
- z
- everyFrame
- gameObject
- mode
- everyFrame
- expression
- isTrueEvent
- isFalseEvent
- everyFrame
- rawResult
- storeResult
paramDataPos: 000000000000000000000000010000000200000000000000010000000200000003000000030000000000000004000000010000000100000004000000050000000600000005000000020000000200000007000000080000000900000006000000000000000100000002000000070000000800000000000000
paramByteDataSize: 000000000000000000000000000000000000000001000000010000000100000001000000000000000000000001000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000001000000000000000000000000000000010000000100000000000000
paramDataPos: 000000000000000000000000010000000200000000000000010000000200000003000000030000000000000004000000010000000100000004000000050000000600000005000000020000000200000007000000080000000900000006000000030000000000000007000000000000000100000002000000080000000900000000000000
paramByteDataSize: 000000000000000000000000000000000000000001000000010000000100000001000000000000000000000001000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000001000000000000000000000001000000000000000000000000000000010000000100000000000000
- name: State 3
description:
colorIndex: 0
@@ -659,16 +679,26 @@ MonoBehaviour:
actionNames:
- IsoTools.PlayMaker.Actions.IsoSetPosition
- HutongGames.PlayMaker.Actions.Wait
- IsoTools.PlayMaker.Actions.IsoSetMode
customNames:
-
-
actionEnabled: 0101
actionIsOpen: 0101
actionStartIndex: 0000000007000000
actionHashCodes: afff110548c01101
-
actionEnabled: 010101
actionIsOpen: 010101
actionStartIndex: 00000000080000000b000000
actionHashCodes: ac9f610448c01101672cde03
unityObjectParams: []
fsmGameObjectParams: []
fsmOwnerDefaultParams:
- ownerOption: 0
gameObject:
useVariable: 0
name:
tooltip:
showInInspector: 0
networkSync: 0
value: {fileID: 0}
- ownerOption: 0
gameObject:
useVariable: 0
@@ -687,7 +717,14 @@ MonoBehaviour:
fsmObjectParams: []
fsmVarParams: []
fsmArrayParams: []
fsmEnumParams: []
fsmEnumParams:
- useVariable: 0
name:
tooltip:
showInInspector: 0
networkSync: 0
enumName: IsoTools.IsoObject+Mode
intValue: 1
fsmFloatParams:
- useVariable: 0
name:
@@ -728,12 +765,12 @@ MonoBehaviour:
fsmQuaternionParams: []
stringParams:
- FINISHED
byteData: 000001
byteData: 00000001
arrayParamSizes:
arrayParamTypes: []
customTypeSizes:
customTypeNames: []
paramDataType: 140000001c0000000f0000000f0000000f00000001000000010000000f0000001700000001000000
paramDataType: 140000001c0000000f0000000f0000000f0000000100000001000000010000000f0000001700000001000000140000002a000000
paramName:
- gameObject
- vector
@@ -742,11 +779,14 @@ MonoBehaviour:
- z
- everyFrame
- lateUpdate
- fixedUpdate
- time
- finishEvent
- realTime
paramDataPos: 00000000000000000000000001000000020000000000000001000000030000000000000002000000
paramByteDataSize: 00000000000000000000000000000000000000000100000001000000000000000000000001000000
- gameObject
- mode
paramDataPos: 00000000000000000000000001000000020000000000000001000000020000000300000000000000030000000100000000000000
paramByteDataSize: 00000000000000000000000000000000000000000100000001000000010000000000000000000000010000000000000000000000
events:
- name: FINISHED
isSystemEvent: 1
@@ -802,10 +842,17 @@ MonoBehaviour:
materialVariables: []
textureVariables: []
arrayVariables: []
enumVariables: []
enumVariables:
- useVariable: 1
name: iso_mode
tooltip:
showInInspector: 1
networkSync: 0
enumName: IsoTools.IsoObject+Mode
intValue: 0
categories:
-
variableCategoryIDs: 00000000000000000000000000000000
variableCategoryIDs: 0000000000000000000000000000000000000000
description:
docUrl:
showStateLabel: 1

View File

@@ -0,0 +1,43 @@
using UnityEngine;
using HutongGames.PlayMaker;
namespace IsoTools.PlayMaker.Actions {
[ActionCategory("IsoTools")]
[HutongGames.PlayMaker.Tooltip("Gets the Mode of a IsoObject and stores it in a Enum Variable")]
public class IsoGetMode : IsoComponentAction<IsoObject> {
[RequiredField]
[CheckForComponent(typeof(IsoObject))]
public FsmOwnerDefault gameObject;
[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();
}
void DoAction() {
var go = Fsm.GetOwnerDefaultTarget(gameObject);
if ( UpdateCache(go) ) {
var value = isoObject.mode;
mode.Value = value;
}
}
}
} // IsoTools.PlayMaker.Actions

View File

@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: ee5d31a178d81452ea41e5945bdec367
timeCreated: 1450021857
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -33,17 +33,17 @@ namespace IsoTools.PlayMaker.Actions {
}
public override void OnEnter() {
DoGetPosition();
DoAction();
if ( !everyFrame ) {
Finish();
}
}
public override void OnUpdate() {
DoGetPosition();
DoAction();
}
void DoGetPosition() {
void DoAction() {
var go = Fsm.GetOwnerDefaultTarget(gameObject);
if ( UpdateCache(go) ) {
var value = isoObject.position;

View File

@@ -33,17 +33,17 @@ namespace IsoTools.PlayMaker.Actions {
}
public override void OnEnter() {
DoGetSize();
DoAction();
if ( !everyFrame ) {
Finish();
}
}
public override void OnUpdate() {
DoGetSize();
DoAction();
}
void DoGetSize() {
void DoAction() {
var go = Fsm.GetOwnerDefaultTarget(gameObject);
if ( UpdateCache(go) ) {
var value = isoObject.size;

View File

@@ -39,20 +39,20 @@ namespace IsoTools.PlayMaker.Actions {
public override void OnEnter() {
if ( !everyFrame && !lateUpdate && !fixedUpdate ) {
DoResize();
DoAction();
Finish();
}
}
public override void OnUpdate() {
if ( !lateUpdate && !fixedUpdate ) {
DoResize();
DoAction();
}
}
public override void OnLateUpdate() {
if ( lateUpdate ) {
DoResize();
DoAction();
}
if ( !everyFrame ) {
Finish();
@@ -61,18 +61,18 @@ namespace IsoTools.PlayMaker.Actions {
public override void OnFixedUpdate() {
if ( fixedUpdate ) {
DoResize();
DoAction();
}
if ( !everyFrame ) {
Finish();
}
}
void DoResize() {
void DoAction() {
var go = Fsm.GetOwnerDefaultTarget(gameObject);
if ( UpdateCache(go) ) {
var value = vector.IsNone
? new Vector3(x.Value, y.Value, z.Value)
? Vector3.zero
: vector.Value;
if ( !x.IsNone ) {

View File

@@ -12,17 +12,54 @@ namespace IsoTools.PlayMaker.Actions {
[ObjectType(typeof(IsoObject.Mode))]
public FsmEnum mode;
public bool everyFrame;
public bool lateUpdate;
public bool fixedUpdate;
public override void Reset() {
gameObject = null;
mode = IsoObject.Mode.Mode2d;
gameObject = null;
mode = new FsmEnum{UseVariable = true};
everyFrame = false;
lateUpdate = false;
fixedUpdate = false;
}
public override void OnPreprocess() {
Fsm.HandleFixedUpdate = true;
}
public override void OnEnter() {
DoSetMode();
Finish();
if ( !everyFrame && !lateUpdate && !fixedUpdate ) {
DoAction();
Finish();
}
}
void DoSetMode() {
public override void OnUpdate() {
if ( !lateUpdate && !fixedUpdate ) {
DoAction();
}
}
public override void OnLateUpdate() {
if ( lateUpdate ) {
DoAction();
}
if ( !everyFrame ) {
Finish();
}
}
public override void OnFixedUpdate() {
if ( fixedUpdate ) {
DoAction();
}
if ( !everyFrame ) {
Finish();
}
}
void DoAction() {
var go = Fsm.GetOwnerDefaultTarget(gameObject);
if ( UpdateCache(go) ) {
isoObject.mode = (IsoObject.Mode)mode.Value;

View File

@@ -37,20 +37,20 @@ namespace IsoTools.PlayMaker.Actions {
public override void OnEnter() {
if ( !everyFrame && !lateUpdate && !fixedUpdate ) {
DoSetPosition();
DoAction();
Finish();
}
}
public override void OnUpdate() {
if ( !lateUpdate && !fixedUpdate ) {
DoSetPosition();
DoAction();
}
}
public override void OnLateUpdate() {
if ( lateUpdate ) {
DoSetPosition();
DoAction();
}
if ( !everyFrame ) {
Finish();
@@ -59,14 +59,14 @@ namespace IsoTools.PlayMaker.Actions {
public override void OnFixedUpdate() {
if ( fixedUpdate ) {
DoSetPosition();
DoAction();
}
if ( !everyFrame ) {
Finish();
}
}
void DoSetPosition() {
void DoAction() {
var go = Fsm.GetOwnerDefaultTarget(gameObject);
if ( UpdateCache(go) ) {
var value = vector.IsNone

View File

@@ -37,20 +37,20 @@ namespace IsoTools.PlayMaker.Actions {
public override void OnEnter() {
if ( !everyFrame && !lateUpdate && !fixedUpdate ) {
DoSetSize();
DoAction();
Finish();
}
}
public override void OnUpdate() {
if ( !lateUpdate && !fixedUpdate ) {
DoSetSize();
DoAction();
}
}
public override void OnLateUpdate() {
if ( lateUpdate ) {
DoSetSize();
DoAction();
}
if ( !everyFrame ) {
Finish();
@@ -59,14 +59,14 @@ namespace IsoTools.PlayMaker.Actions {
public override void OnFixedUpdate() {
if ( fixedUpdate ) {
DoSetSize();
DoAction();
}
if ( !everyFrame ) {
Finish();
}
}
void DoSetSize() {
void DoAction() {
var go = Fsm.GetOwnerDefaultTarget(gameObject);
if ( UpdateCache(go) ) {
var value = vector.IsNone

View File

@@ -39,20 +39,20 @@ namespace IsoTools.PlayMaker.Actions {
public override void OnEnter() {
if ( !everyFrame && !lateUpdate && !fixedUpdate ) {
DoTranlate();
DoAction();
Finish();
}
}
public override void OnUpdate() {
if ( !lateUpdate && !fixedUpdate ) {
DoTranlate();
DoAction();
}
}
public override void OnLateUpdate() {
if ( lateUpdate ) {
DoTranlate();
DoAction();
}
if ( !everyFrame ) {
Finish();
@@ -61,18 +61,18 @@ namespace IsoTools.PlayMaker.Actions {
public override void OnFixedUpdate() {
if ( fixedUpdate ) {
DoTranlate();
DoAction();
}
if ( !everyFrame ) {
Finish();
}
}
void DoTranlate() {
void DoAction() {
var go = Fsm.GetOwnerDefaultTarget(gameObject);
if ( UpdateCache(go) ) {
var value = vector.IsNone
? new Vector3(x.Value, y.Value, z.Value)
? Vector3.zero
: vector.Value;
if ( !x.IsNone ) {