New PlayMaker actions: GetMouseIsoPosition and GetMouseIsoTilePosition

This commit is contained in:
2015-12-17 00:55:35 +06:00
parent c92716ff01
commit 9291d29cba
7 changed files with 359 additions and 23 deletions

View File

@@ -55,6 +55,8 @@
<Compile Include="Assets\IsoTools\PlayMaker\Actions\IsoConvertIsometricToScreen.cs" /> <Compile Include="Assets\IsoTools\PlayMaker\Actions\IsoConvertIsometricToScreen.cs" />
<Compile Include="Assets\IsoTools\PlayMaker\Actions\IsoConvertScreenToIsometric.cs" /> <Compile Include="Assets\IsoTools\PlayMaker\Actions\IsoConvertScreenToIsometric.cs" />
<Compile Include="Assets\IsoTools\PlayMaker\Actions\IsoGetMode.cs" /> <Compile Include="Assets\IsoTools\PlayMaker\Actions\IsoGetMode.cs" />
<Compile Include="Assets\IsoTools\PlayMaker\Actions\IsoGetMouseIsoPosition.cs" />
<Compile Include="Assets\IsoTools\PlayMaker\Actions\IsoGetMouseIsoTilePosition.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" />

View File

@@ -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
@@ -443,6 +443,8 @@ MonoBehaviour:
- IsoTools.PlayMaker.Actions.IsoTranslate - IsoTools.PlayMaker.Actions.IsoTranslate
- IsoTools.PlayMaker.Actions.IsoGetPosition - IsoTools.PlayMaker.Actions.IsoGetPosition
- IsoTools.PlayMaker.Actions.IsoGetSize - IsoTools.PlayMaker.Actions.IsoGetSize
- IsoTools.PlayMaker.Actions.IsoGetMouseIsoTilePosition
- IsoTools.PlayMaker.Actions.IsoGetMouseIsoPosition
- IsoTools.PlayMaker.Actions.IsoGetMode - IsoTools.PlayMaker.Actions.IsoGetMode
- HutongGames.PlayMaker.Actions.Wait - HutongGames.PlayMaker.Actions.Wait
- IsoTools.PlayMaker.Actions.IsoConvertIsometricToScreen - IsoTools.PlayMaker.Actions.IsoConvertIsometricToScreen
@@ -457,12 +459,26 @@ MonoBehaviour:
- -
- -
- -
actionEnabled: 0101010101010101 -
actionIsOpen: 0000000101010100 -
actionStartIndex: 00000000090000000f00000015000000170000001a0000001e00000023000000 actionEnabled: 01010101010101010101
actionHashCodes: 8ef876007ebd02027ebd0202672cde0348c0110184d171054627a803490c8701 actionIsOpen: 00000001010101010100
actionStartIndex: 00000000090000000f000000150000001d00000025000000270000002a0000003000000038000000
actionHashCodes: 8ef876007ebd02027ebd02021dc7a9001dc7a900672cde0348c0110105efec04a946b005490c8701
unityObjectParams: [] unityObjectParams: []
fsmGameObjectParams: [] fsmGameObjectParams:
- useVariable: 1
name:
tooltip:
showInInspector: 0
networkSync: 0
value: {fileID: 0}
- useVariable: 1
name:
tooltip:
showInInspector: 0
networkSync: 0
value: {fileID: 0}
fsmOwnerDefaultParams: fsmOwnerDefaultParams:
- ownerOption: 0 - ownerOption: 0
gameObject: gameObject:
@@ -488,6 +504,22 @@ MonoBehaviour:
showInInspector: 0 showInInspector: 0
networkSync: 0 networkSync: 0
value: {fileID: 0} value: {fileID: 0}
- ownerOption: 1
gameObject:
useVariable: 0
name:
tooltip:
showInInspector: 0
networkSync: 0
value: {fileID: 600542277}
- ownerOption: 1
gameObject:
useVariable: 0
name:
tooltip:
showInInspector: 0
networkSync: 0
value: {fileID: 600542277}
- ownerOption: 0 - ownerOption: 0
gameObject: gameObject:
useVariable: 0 useVariable: 0
@@ -591,18 +623,96 @@ MonoBehaviour:
showInInspector: 0 showInInspector: 0
networkSync: 0 networkSync: 0
value: 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:
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:
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: 0 - useVariable: 0
name: name:
tooltip: tooltip:
showInInspector: 0 showInInspector: 0
networkSync: 0 networkSync: 0
value: 1 value: 1
- useVariable: 1
name:
tooltip:
showInInspector: 0
networkSync: 0
value: 0
- useVariable: 1
name:
tooltip:
showInInspector: 0
networkSync: 0
value: 0
- useVariable: 0 - useVariable: 0
name: name:
tooltip: tooltip:
showInInspector: 0 showInInspector: 0
networkSync: 0 networkSync: 0
value: 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:
showInInspector: 0
networkSync: 0
value: 0
fsmIntParams: [] fsmIntParams: []
fsmBoolParams: fsmBoolParams:
- useVariable: 1 - useVariable: 1
@@ -643,6 +753,18 @@ 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: mouse_iso_tile
tooltip:
showInInspector: 1
networkSync: 0
value: {x: 0, y: 0, z: 0}
- useVariable: 1
name: mouse_iso_pos
tooltip:
showInInspector: 1
networkSync: 0
value: {x: 0, y: 0, z: 0}
- useVariable: 1 - useVariable: 1
name: iso_position name: iso_position
tooltip: tooltip:
@@ -662,12 +784,12 @@ MonoBehaviour:
- FINISHED - FINISHED
- TO_RESET_POSITION - TO_RESET_POSITION
- -
byteData: 0000000000000100000000 byteData: 00000000000000000100000000
arrayParamSizes: arrayParamSizes:
arrayParamTypes: [] arrayParamTypes: []
customTypeSizes: customTypeSizes:
customTypeNames: [] customTypeNames: []
paramDataType: 140000001c0000000f0000000f0000000f00000001000000010000000100000001000000140000001c0000000f0000000f0000000f00000001000000140000001c0000000f0000000f0000000f00000001000000140000002a0000000f0000001700000001000000140000001c000000250000000100000014000000250000000f0000001c00000001000000120000001700000017000000010000000100000011000000 paramDataType: 140000001c0000000f0000000f0000000f00000001000000010000000100000001000000140000001c0000000f0000000f0000000f00000001000000140000001c0000000f0000000f0000000f0000000100000014000000130000000f0000001c0000000f0000000f0000000f0000000100000014000000130000000f0000001c0000000f0000000f0000000f00000001000000140000002a0000000f0000001700000001000000140000001c000000250000000f0000000f0000000100000014000000250000000f0000001c0000000f0000000f0000000f00000001000000120000001700000017000000010000000100000011000000
paramName: paramName:
- gameObject - gameObject
- vector - vector
@@ -679,30 +801,51 @@ MonoBehaviour:
- lateUpdate - lateUpdate
- fixedUpdate - fixedUpdate
- gameObject - gameObject
- vector - storeVector
- x - storeX
- y - storeY
- z - storeZ
- everyFrame - everyFrame
- gameObject - gameObject
- vector - storeVector
- x - storeX
- y - storeY
- z - storeZ
- everyFrame - everyFrame
- gameObject - gameObject
- mode - camera
- specificIsometricZ
- storeVector
- storeX
- storeY
- storeZ
- everyFrame
- gameObject
- camera
- specificIsometricZ
- storeVector
- storeX
- storeY
- storeZ
- everyFrame
- gameObject
- storeMode
- time - time
- finishEvent - finishEvent
- realTime - realTime
- gameObject - gameObject
- isometricVector - isometricVector
- storeScreenVector - storeScreenVector
- storeScreenX
- storeScreenY
- everyFrame - everyFrame
- gameObject - gameObject
- screenVector - screenVector
- specificIsometricZ - specificIsometricZ
- storeIsometricVector - storeIsometricVector
- storeIsometricX
- storeIsometricY
- storeIsometricZ
- everyFrame - everyFrame
- expression - expression
- isTrueEvent - isTrueEvent
@@ -710,8 +853,8 @@ MonoBehaviour:
- everyFrame - everyFrame
- rawResult - rawResult
- storeResult - storeResult
paramDataPos: 00000000000000000000000001000000020000000000000001000000020000000300000001000000010000000300000004000000050000000400000002000000020000000600000007000000080000000500000003000000000000000900000000000000060000000400000003000000000000000700000005000000010000000a0000000400000008000000000000000100000002000000090000000a00000000000000 paramDataPos: 000000000000000000000000010000000200000000000000010000000200000003000000010000000100000003000000040000000500000004000000020000000200000006000000070000000800000005000000030000000000000009000000030000000a0000000b0000000c0000000600000004000000010000000d000000040000000e0000000f00000010000000070000000500000000000000110000000000000008000000060000000500000000000000120000001300000009000000070000000100000014000000060000001500000016000000170000000a0000000000000001000000020000000b0000000c00000000000000
paramByteDataSize: 0000000000000000000000000000000000000000010000000100000001000000010000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000010000000000000000000000000000000000000001000000000000000000000000000000010000000000000000000000000000000000000001000000000000000000000000000000010000000100000000000000 paramByteDataSize: 0000000000000000000000000000000000000000010000000100000001000000010000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000010000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000010000000100000000000000
- name: State 3 - name: State 3
description: description:
colorIndex: 0 colorIndex: 0
@@ -1047,6 +1190,18 @@ 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: mouse_iso_pos
tooltip:
showInInspector: 1
networkSync: 0
value: {x: 0, y: 0, z: 0}
- useVariable: 1
name: mouse_iso_tile
tooltip:
showInInspector: 1
networkSync: 0
value: {x: 0, y: 0, z: 0}
colorVariables: [] colorVariables: []
rectVariables: [] rectVariables: []
quaternionVariables: [] quaternionVariables: []
@@ -1065,7 +1220,7 @@ MonoBehaviour:
intValue: 0 intValue: 0
categories: categories:
- -
variableCategoryIDs: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 variableCategoryIDs: 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
description: description:
docUrl: docUrl:
showStateLabel: 1 showStateLabel: 1
@@ -1108,7 +1263,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
@@ -1166,7 +1321,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
@@ -1325,7 +1480,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

View File

@@ -0,0 +1,77 @@
using UnityEngine;
using HutongGames.PlayMaker;
namespace IsoTools.PlayMaker.Actions {
[ActionCategory("IsoTools")]
[HutongGames.PlayMaker.Tooltip(
"Gets a mouse isometric position.")]
public class IsoGetMouseIsoPosition : IsoComponentAction<IsoWorld> {
[RequiredField]
[CheckForComponent(typeof(IsoWorld))]
[HutongGames.PlayMaker.Title("IsoWorld (In)")]
public FsmOwnerDefault gameObject;
[CheckForComponent(typeof(Camera))]
[HutongGames.PlayMaker.Title("Camera (In)")]
[HutongGames.PlayMaker.Tooltip("Specific camera or main camera for 'None'.")]
public FsmGameObject camera;
[HutongGames.PlayMaker.Title("Specific Isometric Z (In)")]
[HutongGames.PlayMaker.Tooltip("Specific Isometric Z or 0.0f for 'None'")]
public FsmFloat specificIsometricZ;
[UIHint(UIHint.Variable)]
[HutongGames.PlayMaker.Title("Store Position (Out)")]
public FsmVector3 storeVector;
[UIHint(UIHint.Variable)]
[HutongGames.PlayMaker.Title("Store Position X (Out)")]
public FsmFloat storeX;
[UIHint(UIHint.Variable)]
[HutongGames.PlayMaker.Title("Store Position Y (Out)")]
public FsmFloat storeY;
[UIHint(UIHint.Variable)]
[HutongGames.PlayMaker.Title("Store Position Z (Out)")]
public FsmFloat storeZ;
[HutongGames.PlayMaker.Tooltip("Repeat every frame.")]
public bool everyFrame;
public override void Reset() {
gameObject = null;
camera = null;
specificIsometricZ = 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 = isoWorld.MouseIsoPosition(
camera.IsNone ? Camera.main : camera.Value.GetComponent<Camera>(),
specificIsometricZ.IsNone ? 0.0f : specificIsometricZ.Value);
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: 2dffeb7d382404baa9daf01f1da629a1
timeCreated: 1450288005
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,77 @@
using UnityEngine;
using HutongGames.PlayMaker;
namespace IsoTools.PlayMaker.Actions {
[ActionCategory("IsoTools")]
[HutongGames.PlayMaker.Tooltip(
"Gets a mouse isometric tile position.")]
public class IsoGetMouseIsoTilePosition : IsoComponentAction<IsoWorld> {
[RequiredField]
[CheckForComponent(typeof(IsoWorld))]
[HutongGames.PlayMaker.Title("IsoWorld (In)")]
public FsmOwnerDefault gameObject;
[CheckForComponent(typeof(Camera))]
[HutongGames.PlayMaker.Title("Camera (In)")]
[HutongGames.PlayMaker.Tooltip("Specific camera or main camera for 'None'.")]
public FsmGameObject camera;
[HutongGames.PlayMaker.Title("Specific Isometric Z (In)")]
[HutongGames.PlayMaker.Tooltip("Specific Isometric Z or 0.0f for 'None'")]
public FsmFloat specificIsometricZ;
[UIHint(UIHint.Variable)]
[HutongGames.PlayMaker.Title("Store Tile Position (Out)")]
public FsmVector3 storeVector;
[UIHint(UIHint.Variable)]
[HutongGames.PlayMaker.Title("Store Tile Position X (Out)")]
public FsmFloat storeX;
[UIHint(UIHint.Variable)]
[HutongGames.PlayMaker.Title("Store Tile Position Y (Out)")]
public FsmFloat storeY;
[UIHint(UIHint.Variable)]
[HutongGames.PlayMaker.Title("Store Tile Position Z (Out)")]
public FsmFloat storeZ;
[HutongGames.PlayMaker.Tooltip("Repeat every frame.")]
public bool everyFrame;
public override void Reset() {
gameObject = null;
camera = null;
specificIsometricZ = 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 = isoWorld.MouseIsoTilePosition(
camera.IsNone ? Camera.main : camera.Value.GetComponent<Camera>(),
specificIsometricZ.IsNone ? 0.0f : specificIsometricZ.Value);
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: 52e132a4a0d844bbd84f8b1fbd61aa12
timeCreated: 1450288016
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -35,6 +35,7 @@ namespace IsoTools.PlayMaker.Actions {
[HutongGames.PlayMaker.Title("Start Depth (Out)")] [HutongGames.PlayMaker.Title("Start Depth (Out)")]
public FsmFloat startDepth; public FsmFloat startDepth;
[HutongGames.PlayMaker.Tooltip("Repeat every frame.")]
public bool everyFrame; public bool everyFrame;
public override void Reset() { public override void Reset() {