New PlayMaker actions: IsoGetVelocity and IsoSetVelocity

This commit is contained in:
2015-12-20 20:05:27 +06:00
parent aa737810bd
commit 6c7a10c348
6 changed files with 202 additions and 11 deletions

View File

@@ -63,11 +63,13 @@
<Compile Include="Assets\IsoTools\PlayMaker\Actions\IsoGetTilePosition.cs" />
<Compile Include="Assets\IsoTools\PlayMaker\Actions\IsoGetTouchIsoPosition.cs" />
<Compile Include="Assets\IsoTools\PlayMaker\Actions\IsoGetTouchIsoTilePosition.cs" />
<Compile Include="Assets\IsoTools\PlayMaker\Actions\IsoGetVelocity.cs" />
<Compile Include="Assets\IsoTools\PlayMaker\Actions\IsoGetWorldProps.cs" />
<Compile Include="Assets\IsoTools\PlayMaker\Actions\IsoResize.cs" />
<Compile Include="Assets\IsoTools\PlayMaker\Actions\IsoSetMode.cs" />
<Compile Include="Assets\IsoTools\PlayMaker\Actions\IsoSetPosition.cs" />
<Compile Include="Assets\IsoTools\PlayMaker\Actions\IsoSetSize.cs" />
<Compile Include="Assets\IsoTools\PlayMaker\Actions\IsoSetVelocity.cs" />
<Compile Include="Assets\IsoTools\PlayMaker\Actions\IsoSetWorldProps.cs" />
<Compile Include="Assets\IsoTools\PlayMaker\Actions\IsoTranslate.cs" />
<Compile Include="Assets\IsoTools\PlayMaker\Events\IsoCollisionEvent.cs" />

View File

@@ -1734,15 +1734,17 @@ MonoBehaviour:
transitions: []
actionData:
actionNames:
- IsoTools.PlayMaker.Actions.IsoGetVelocity
- IsoTools.PlayMaker.Events.IsoTriggerEvent
- IsoTools.PlayMaker.Events.IsoCollisionEvent
customNames:
-
-
actionEnabled: 0101
actionIsOpen: 0101
actionStartIndex: 0000000005000000
actionHashCodes: 8802cd006a86ae01
-
actionEnabled: 010101
actionIsOpen: 010101
actionStartIndex: 00000000060000000b000000
actionHashCodes: 7ebd02028802cd006a86ae01
unityObjectParams: []
fsmGameObjectParams:
- useVariable: 1
@@ -1774,6 +1776,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: []
@@ -1798,6 +1808,24 @@ MonoBehaviour:
fsmArrayParams: []
fsmEnumParams: []
fsmFloatParams:
- useVariable: 1
name:
tooltip:
showInInspector: 0
networkSync: 0
value: 0
- useVariable: 1
name:
tooltip:
showInInspector: 0
networkSync: 0
value: 0
- useVariable: 1
name:
tooltip:
showInInspector: 0
networkSync: 0
value: 0
- useVariable: 1
name:
tooltip:
@@ -1807,21 +1835,33 @@ MonoBehaviour:
fsmIntParams: []
fsmBoolParams: []
fsmVector2Params: []
fsmVector3Params: []
fsmVector3Params:
- useVariable: 1
name: iso_vel
tooltip:
showInInspector: 1
networkSync: 0
value: {x: 0, y: 0, z: 0}
fsmColorParams: []
fsmRectParams: []
fsmQuaternionParams: []
stringParams:
- TO_UP
- TO_UP
byteData: 0000000000000000
byteData: 010000000000000000
arrayParamSizes:
arrayParamTypes: []
customTypeSizes:
customTypeNames: []
paramDataType: 140000000700000012000000170000001300000014000000070000001200000017000000130000000f000000
paramDataType: 140000001c0000000f0000000f0000000f00000001000000140000000700000012000000170000001300000014000000070000001200000017000000130000000f000000
paramName:
- gameObject
- storeVector
- storeX
- storeY
- storeZ
- everyFrame
- gameObject
- triggerType
- collideTag
- sendEvent
@@ -1832,8 +1872,8 @@ MonoBehaviour:
- sendEvent
- storeIsoCollider
- storeForce
paramDataPos: 0000000000000000000000000000000000000000010000000400000001000000010000000100000000000000
paramByteDataSize: 0000000004000000000000000000000000000000000000000400000000000000000000000000000000000000
paramDataPos: 0000000000000000000000000100000002000000000000000100000001000000000000000000000000000000020000000500000001000000010000000100000003000000
paramByteDataSize: 0000000000000000000000000000000000000000010000000000000004000000000000000000000000000000000000000400000000000000000000000000000000000000
- name: up
description:
colorIndex: 0
@@ -1957,7 +1997,13 @@ MonoBehaviour:
boolVariables: []
stringVariables: []
vector2Variables: []
vector3Variables: []
vector3Variables:
- useVariable: 1
name: iso_vel
tooltip:
showInInspector: 1
networkSync: 0
value: {x: 0, y: 0, z: 0}
colorVariables: []
rectVariables: []
quaternionVariables: []
@@ -1969,7 +2015,7 @@ MonoBehaviour:
enumVariables: []
categories:
-
variableCategoryIDs:
variableCategoryIDs: 00000000
description:
docUrl:
showStateLabel: 1

View File

@@ -0,0 +1,60 @@
using UnityEngine;
using HutongGames.PlayMaker;
using IsoTools.PlayMaker.Internal;
namespace IsoTools.PlayMaker.Actions {
[ActionCategory("IsoTools")]
[HutongGames.PlayMaker.Tooltip(
"Gets the Velocity of a IsoRigidbody and stores it " +
"in a Vector3 Variable or each Axis in a Float Variable")]
public class IsoGetVelocity : IsoComponentAction<IsoRigidbody> {
[RequiredField]
[CheckForComponent(typeof(IsoRigidbody))]
public FsmOwnerDefault gameObject;
[UIHint(UIHint.Variable)]
public FsmVector3 storeVector;
[UIHint(UIHint.Variable)]
public FsmFloat storeX;
[UIHint(UIHint.Variable)]
public FsmFloat storeY;
[UIHint(UIHint.Variable)]
public FsmFloat storeZ;
public bool everyFrame;
public override void Reset() {
gameObject = null;
storeVector = null;
storeX = null;
storeY = null;
storeZ = 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 = isoRigidbody.velocity;
storeVector.Value = value;
storeX.Value = value.x;
storeY.Value = value.y;
storeZ.Value = value.z;
}
}
}
} // IsoTools.PlayMaker.Actions

View File

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

View File

@@ -0,0 +1,59 @@
using UnityEngine;
using HutongGames.PlayMaker;
using IsoTools.PlayMaker.Internal;
namespace IsoTools.PlayMaker.Actions {
[ActionCategory("IsoTools")]
[HutongGames.PlayMaker.Tooltip(
"Sets the Velocity of a IsoRigidbody. " +
"To leave any axis unchanged, set variable to 'None'.")]
public class IsoSetVelocity : IsoComponentAction<IsoRigidbody> {
[RequiredField]
[CheckForComponent(typeof(IsoRigidbody))]
public FsmOwnerDefault gameObject;
[UIHint(UIHint.Variable)]
public FsmVector3 vector;
public FsmFloat x;
public FsmFloat y;
public FsmFloat z;
public bool everyFrame;
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;
}
public override void OnPreprocess() {
Fsm.HandleFixedUpdate = true;
}
public override void OnEnter() {
DoAction();
if ( !everyFrame ) {
Finish();
}
}
public override void OnFixedUpdate() {
DoAction();
}
void DoAction() {
var go = Fsm.GetOwnerDefaultTarget(gameObject);
if ( UpdateCache(go) ) {
var value = vector.IsNone ? isoRigidbody.velocity : vector.Value;
if ( !x.IsNone ) { value.x = x.Value; }
if ( !y.IsNone ) { value.y = y.Value; }
if ( !z.IsNone ) { value.z = z.Value; }
isoRigidbody.velocity = value;
}
}
}
} // IsoTools.PlayMaker.Actions

View File

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