mirror of
https://github.com/BlackMATov/unity-iso-tools.git
synced 2025-12-14 17:09:31 +07:00
TouchIndex to FingerId for touch positions. New names for playmaker variables. New actions: GetTouchIsoPosition and GetTouchIsoTilePosition
This commit is contained in:
@@ -102,7 +102,7 @@ Prefab:
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 453404, guid: d10e5320df9f84d4186bda0ba98db9ff, type: 2}
|
||||
propertyPath: m_LocalPosition.z
|
||||
value: 1.4000001
|
||||
value: 1.3000001
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 453404, guid: d10e5320df9f84d4186bda0ba98db9ff, type: 2}
|
||||
propertyPath: m_LocalRotation.x
|
||||
@@ -445,8 +445,8 @@ MonoBehaviour:
|
||||
- IsoTools.PlayMaker.Actions.IsoGetSize
|
||||
- IsoTools.PlayMaker.Actions.IsoGetMode
|
||||
- HutongGames.PlayMaker.Actions.Wait
|
||||
- IsoTools.PlayMaker.Actions.IsoConvertScreenToIso
|
||||
- IsoTools.PlayMaker.Actions.IsoConvertIsoToScreen
|
||||
- IsoTools.PlayMaker.Actions.IsoConvertIsometricToScreen
|
||||
- IsoTools.PlayMaker.Actions.IsoConvertScreenToIsometric
|
||||
- PlayMaker.ConditionalExpression.ConditionalExpression
|
||||
customNames:
|
||||
-
|
||||
@@ -597,12 +597,12 @@ MonoBehaviour:
|
||||
showInInspector: 0
|
||||
networkSync: 0
|
||||
value: 1
|
||||
- useVariable: 1
|
||||
- useVariable: 0
|
||||
name:
|
||||
tooltip:
|
||||
showInInspector: 0
|
||||
networkSync: 0
|
||||
value: 1
|
||||
value: 0
|
||||
fsmIntParams: []
|
||||
fsmBoolParams:
|
||||
- useVariable: 1
|
||||
@@ -696,13 +696,13 @@ MonoBehaviour:
|
||||
- finishEvent
|
||||
- realTime
|
||||
- gameObject
|
||||
- fromIsometricVector
|
||||
- toScreenVector
|
||||
- isometricVector
|
||||
- storeScreenVector
|
||||
- everyFrame
|
||||
- gameObject
|
||||
- fromScreenVector
|
||||
- screenVector
|
||||
- specificIsometricZ
|
||||
- toIsometricVector
|
||||
- storeIsometricVector
|
||||
- everyFrame
|
||||
- expression
|
||||
- isTrueEvent
|
||||
@@ -1108,7 +1108,7 @@ Prefab:
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 453404, guid: d10e5320df9f84d4186bda0ba98db9ff, type: 2}
|
||||
propertyPath: m_LocalPosition.z
|
||||
value: 1.3000001
|
||||
value: 1.4000001
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 453404, guid: d10e5320df9f84d4186bda0ba98db9ff, type: 2}
|
||||
propertyPath: m_LocalRotation.x
|
||||
@@ -1166,7 +1166,7 @@ Prefab:
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 453404, guid: d10e5320df9f84d4186bda0ba98db9ff, type: 2}
|
||||
propertyPath: m_LocalPosition.z
|
||||
value: 1.2
|
||||
value: 1.1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 453404, guid: d10e5320df9f84d4186bda0ba98db9ff, type: 2}
|
||||
propertyPath: m_LocalRotation.x
|
||||
@@ -1325,7 +1325,7 @@ Prefab:
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 453404, guid: d10e5320df9f84d4186bda0ba98db9ff, type: 2}
|
||||
propertyPath: m_LocalPosition.z
|
||||
value: 1.1
|
||||
value: 1.2
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 453404, guid: d10e5320df9f84d4186bda0ba98db9ff, type: 2}
|
||||
propertyPath: m_LocalRotation.x
|
||||
|
||||
@@ -1,53 +0,0 @@
|
||||
using UnityEngine;
|
||||
using HutongGames.PlayMaker;
|
||||
|
||||
namespace IsoTools.PlayMaker.Actions {
|
||||
[ActionCategory("IsoTools")]
|
||||
[HutongGames.PlayMaker.Tooltip(
|
||||
"Convert Isometric Vector3 Variable to ScreenSpace Vector2 Variable")]
|
||||
public class IsoConvertScreenToIso : IsoComponentAction<IsoWorld> {
|
||||
[RequiredField]
|
||||
[CheckForComponent(typeof(IsoWorld))]
|
||||
[HutongGames.PlayMaker.Tooltip("The IsoWorld for convertation.")]
|
||||
public FsmOwnerDefault gameObject;
|
||||
|
||||
[RequiredField]
|
||||
[UIHint(UIHint.Variable)]
|
||||
[HutongGames.PlayMaker.Tooltip("The Isometric Vector3 variable to convert to a ScreenSpace Vector2.")]
|
||||
public FsmVector3 fromIsometricVector;
|
||||
|
||||
[RequiredField]
|
||||
[UIHint(UIHint.Variable)]
|
||||
[HutongGames.PlayMaker.Tooltip("Store the result in a ScreenSpace Vector2 variable.")]
|
||||
public FsmVector2 toScreenVector;
|
||||
|
||||
[HutongGames.PlayMaker.Tooltip("Repeat every frame.")]
|
||||
public bool everyFrame;
|
||||
|
||||
public override void Reset() {
|
||||
gameObject = null;
|
||||
fromIsometricVector = null;
|
||||
toScreenVector = 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) ) {
|
||||
toScreenVector.Value =
|
||||
isoWorld.IsoToScreen(fromIsometricVector.Value);
|
||||
}
|
||||
}
|
||||
}
|
||||
} // IsoTools.PlayMaker.Actions
|
||||
@@ -0,0 +1,65 @@
|
||||
using UnityEngine;
|
||||
using HutongGames.PlayMaker;
|
||||
|
||||
namespace IsoTools.PlayMaker.Actions {
|
||||
[ActionCategory("IsoTools")]
|
||||
[HutongGames.PlayMaker.Tooltip(
|
||||
"Convert Isometric Vector3 Variable to ScreenSpace Vector2 Variable")]
|
||||
public class IsoConvertIsometricToScreen : IsoComponentAction<IsoWorld> {
|
||||
[RequiredField]
|
||||
[CheckForComponent(typeof(IsoWorld))]
|
||||
[HutongGames.PlayMaker.Title("IsoWorld (In)")]
|
||||
[HutongGames.PlayMaker.Tooltip("The IsoWorld for convertation.")]
|
||||
public FsmOwnerDefault gameObject;
|
||||
|
||||
[RequiredField]
|
||||
[UIHint(UIHint.Variable)]
|
||||
[HutongGames.PlayMaker.Title("Isometric Vector (In)")]
|
||||
public FsmVector3 isometricVector;
|
||||
|
||||
[UIHint(UIHint.Variable)]
|
||||
[HutongGames.PlayMaker.Title("Store Screen Vector (Out)")]
|
||||
public FsmVector2 storeScreenVector;
|
||||
|
||||
[UIHint(UIHint.Variable)]
|
||||
[HutongGames.PlayMaker.Title("Store Screen X (Out)")]
|
||||
public FsmFloat storeScreenX;
|
||||
|
||||
[UIHint(UIHint.Variable)]
|
||||
[HutongGames.PlayMaker.Title("Store Screen Y (Out)")]
|
||||
public FsmFloat storeScreenY;
|
||||
|
||||
[HutongGames.PlayMaker.Tooltip("Repeat every frame.")]
|
||||
public bool everyFrame;
|
||||
|
||||
public override void Reset() {
|
||||
gameObject = null;
|
||||
isometricVector = null;
|
||||
storeScreenVector = null;
|
||||
storeScreenX = null;
|
||||
storeScreenY = 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.IsoToScreen(isometricVector.Value);
|
||||
storeScreenVector.Value = value;
|
||||
storeScreenX.Value = value.x;
|
||||
storeScreenY.Value = value.y;
|
||||
}
|
||||
}
|
||||
}
|
||||
} // IsoTools.PlayMaker.Actions
|
||||
@@ -1,58 +0,0 @@
|
||||
using UnityEngine;
|
||||
using HutongGames.PlayMaker;
|
||||
|
||||
namespace IsoTools.PlayMaker.Actions {
|
||||
[ActionCategory("IsoTools")]
|
||||
[HutongGames.PlayMaker.Tooltip(
|
||||
"Convert ScreenSpace Vector2 Variable to Isometric Vector3 Variable")]
|
||||
public class IsoConvertIsoToScreen : IsoComponentAction<IsoWorld> {
|
||||
[RequiredField]
|
||||
[CheckForComponent(typeof(IsoWorld))]
|
||||
[HutongGames.PlayMaker.Tooltip("The IsoWorld for convertation.")]
|
||||
public FsmOwnerDefault gameObject;
|
||||
|
||||
[RequiredField]
|
||||
[UIHint(UIHint.Variable)]
|
||||
[HutongGames.PlayMaker.Tooltip("The ScreenSpace Vector2 variable to convert to a Isometric Vector3.")]
|
||||
public FsmVector2 fromScreenVector;
|
||||
|
||||
[HutongGames.PlayMaker.Tooltip("Specific Isometric Z.")]
|
||||
public FsmFloat specificIsometricZ;
|
||||
|
||||
[RequiredField]
|
||||
[UIHint(UIHint.Variable)]
|
||||
[HutongGames.PlayMaker.Tooltip("Store the result in a Isometric Vector3 variable.")]
|
||||
public FsmVector3 toIsometricVector;
|
||||
|
||||
[HutongGames.PlayMaker.Tooltip("Repeat every frame.")]
|
||||
public bool everyFrame;
|
||||
|
||||
public override void Reset() {
|
||||
gameObject = null;
|
||||
fromScreenVector = null;
|
||||
specificIsometricZ = 0.0f;
|
||||
toIsometricVector = 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) ) {
|
||||
toIsometricVector.Value = isoWorld.ScreenToIso(
|
||||
fromScreenVector.Value,
|
||||
specificIsometricZ.IsNone ? 0.0f : specificIsometricZ.Value);
|
||||
}
|
||||
}
|
||||
}
|
||||
} // IsoTools.PlayMaker.Actions
|
||||
@@ -0,0 +1,78 @@
|
||||
using UnityEngine;
|
||||
using HutongGames.PlayMaker;
|
||||
|
||||
namespace IsoTools.PlayMaker.Actions {
|
||||
[ActionCategory("IsoTools")]
|
||||
[HutongGames.PlayMaker.Tooltip(
|
||||
"Convert ScreenSpace Vector2 Variable to Isometric Vector3 Variable")]
|
||||
public class IsoConvertScreenToIsometric : IsoComponentAction<IsoWorld> {
|
||||
[RequiredField]
|
||||
[CheckForComponent(typeof(IsoWorld))]
|
||||
[HutongGames.PlayMaker.Title("IsoWorld (In)")]
|
||||
[HutongGames.PlayMaker.Tooltip("The IsoWorld for convertation.")]
|
||||
public FsmOwnerDefault gameObject;
|
||||
|
||||
[RequiredField]
|
||||
[UIHint(UIHint.Variable)]
|
||||
[HutongGames.PlayMaker.Title("Screen Vector (In)")]
|
||||
public FsmVector2 screenVector;
|
||||
|
||||
[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 Isometric Vector (Out)")]
|
||||
public FsmVector3 storeIsometricVector;
|
||||
|
||||
[UIHint(UIHint.Variable)]
|
||||
[HutongGames.PlayMaker.Title("Store Isometric X (Out)")]
|
||||
public FsmFloat storeIsometricX;
|
||||
|
||||
[UIHint(UIHint.Variable)]
|
||||
[HutongGames.PlayMaker.Title("Store Isometric Y (Out)")]
|
||||
public FsmFloat storeIsometricY;
|
||||
|
||||
[UIHint(UIHint.Variable)]
|
||||
[HutongGames.PlayMaker.Title("Store Isometric Z (Out)")]
|
||||
public FsmFloat storeIsometricZ;
|
||||
|
||||
[HutongGames.PlayMaker.Tooltip("Repeat every frame.")]
|
||||
public bool everyFrame;
|
||||
|
||||
public override void Reset() {
|
||||
gameObject = null;
|
||||
screenVector = null;
|
||||
specificIsometricZ = 0.0f;
|
||||
storeIsometricVector = null;
|
||||
storeIsometricX = null;
|
||||
storeIsometricY = null;
|
||||
storeIsometricZ = 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 = specificIsometricZ.IsNone
|
||||
? isoWorld.ScreenToIso(screenVector.Value)
|
||||
: isoWorld.ScreenToIso(screenVector.Value, specificIsometricZ.Value);
|
||||
storeIsometricVector.Value = value;
|
||||
storeIsometricX.Value = value.x;
|
||||
storeIsometricY.Value = value.y;
|
||||
storeIsometricZ.Value = value.z;
|
||||
}
|
||||
}
|
||||
}
|
||||
} // IsoTools.PlayMaker.Actions
|
||||
@@ -8,16 +8,18 @@ namespace IsoTools.PlayMaker.Actions {
|
||||
public class IsoGetMode : IsoComponentAction<IsoObject> {
|
||||
[RequiredField]
|
||||
[CheckForComponent(typeof(IsoObject))]
|
||||
[HutongGames.PlayMaker.Title("IsoObject (In)")]
|
||||
public FsmOwnerDefault gameObject;
|
||||
|
||||
[RequiredField]
|
||||
[ObjectType(typeof(IsoObject.Mode))]
|
||||
[UIHint(UIHint.Variable)]
|
||||
public FsmEnum mode;
|
||||
[HutongGames.PlayMaker.Title("Store Mode (Out)")]
|
||||
public FsmEnum storeMode;
|
||||
|
||||
public override void Reset() {
|
||||
gameObject = null;
|
||||
mode = null;
|
||||
storeMode = null;
|
||||
}
|
||||
|
||||
public override void OnEnter() {
|
||||
@@ -28,7 +30,7 @@ namespace IsoTools.PlayMaker.Actions {
|
||||
void DoAction() {
|
||||
var go = Fsm.GetOwnerDefaultTarget(gameObject);
|
||||
if ( UpdateCache(go) ) {
|
||||
mode.Value = isoObject.mode;
|
||||
storeMode.Value = isoObject.mode;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,29 +9,35 @@ namespace IsoTools.PlayMaker.Actions {
|
||||
public class IsoGetPosition : IsoComponentAction<IsoObject> {
|
||||
[RequiredField]
|
||||
[CheckForComponent(typeof(IsoObject))]
|
||||
[HutongGames.PlayMaker.Title("IsoObject (In)")]
|
||||
public FsmOwnerDefault gameObject;
|
||||
|
||||
[UIHint(UIHint.Variable)]
|
||||
public FsmVector3 vector;
|
||||
[HutongGames.PlayMaker.Title("Store Position Vector (Out)")]
|
||||
public FsmVector3 storeVector;
|
||||
|
||||
[UIHint(UIHint.Variable)]
|
||||
public FsmFloat x;
|
||||
[HutongGames.PlayMaker.Title("Store Position X (Out)")]
|
||||
public FsmFloat storeX;
|
||||
|
||||
[UIHint(UIHint.Variable)]
|
||||
public FsmFloat y;
|
||||
[HutongGames.PlayMaker.Title("Store Position Y (Out)")]
|
||||
public FsmFloat storeY;
|
||||
|
||||
[UIHint(UIHint.Variable)]
|
||||
public FsmFloat z;
|
||||
[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;
|
||||
vector = null;
|
||||
x = null;
|
||||
y = null;
|
||||
z = null;
|
||||
everyFrame = false;
|
||||
gameObject = null;
|
||||
storeVector = null;
|
||||
storeX = null;
|
||||
storeY = null;
|
||||
storeZ = null;
|
||||
everyFrame = false;
|
||||
}
|
||||
|
||||
public override void OnEnter() {
|
||||
@@ -48,11 +54,11 @@ namespace IsoTools.PlayMaker.Actions {
|
||||
void DoAction() {
|
||||
var go = Fsm.GetOwnerDefaultTarget(gameObject);
|
||||
if ( UpdateCache(go) ) {
|
||||
var value = isoObject.position;
|
||||
vector.Value = value;
|
||||
x.Value = value.x;
|
||||
y.Value = value.y;
|
||||
z.Value = value.z;
|
||||
var value = isoObject.position;
|
||||
storeVector.Value = value;
|
||||
storeX.Value = value.x;
|
||||
storeY.Value = value.y;
|
||||
storeZ.Value = value.z;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,29 +9,35 @@ namespace IsoTools.PlayMaker.Actions {
|
||||
public class IsoGetSize : IsoComponentAction<IsoObject> {
|
||||
[RequiredField]
|
||||
[CheckForComponent(typeof(IsoObject))]
|
||||
[HutongGames.PlayMaker.Title("IsoObject (In)")]
|
||||
public FsmOwnerDefault gameObject;
|
||||
|
||||
[UIHint(UIHint.Variable)]
|
||||
public FsmVector3 vector;
|
||||
[HutongGames.PlayMaker.Title("Store Size Vector (Out)")]
|
||||
public FsmVector3 storeVector;
|
||||
|
||||
[UIHint(UIHint.Variable)]
|
||||
public FsmFloat x;
|
||||
[HutongGames.PlayMaker.Title("Store Size X (Out)")]
|
||||
public FsmFloat storeX;
|
||||
|
||||
[UIHint(UIHint.Variable)]
|
||||
public FsmFloat y;
|
||||
[HutongGames.PlayMaker.Title("Store Size Y (Out)")]
|
||||
public FsmFloat storeY;
|
||||
|
||||
[UIHint(UIHint.Variable)]
|
||||
public FsmFloat z;
|
||||
[HutongGames.PlayMaker.Title("Store Size Z (Out)")]
|
||||
public FsmFloat storeZ;
|
||||
|
||||
[HutongGames.PlayMaker.Tooltip("Repeat every frame.")]
|
||||
public bool everyFrame;
|
||||
|
||||
public override void Reset() {
|
||||
gameObject = null;
|
||||
vector = null;
|
||||
x = null;
|
||||
y = null;
|
||||
z = null;
|
||||
everyFrame = false;
|
||||
gameObject = null;
|
||||
storeVector = null;
|
||||
storeX = null;
|
||||
storeY = null;
|
||||
storeZ = null;
|
||||
everyFrame = false;
|
||||
}
|
||||
|
||||
public override void OnEnter() {
|
||||
@@ -48,11 +54,11 @@ namespace IsoTools.PlayMaker.Actions {
|
||||
void DoAction() {
|
||||
var go = Fsm.GetOwnerDefaultTarget(gameObject);
|
||||
if ( UpdateCache(go) ) {
|
||||
var value = isoObject.size;
|
||||
vector.Value = value;
|
||||
x.Value = value.x;
|
||||
y.Value = value.y;
|
||||
z.Value = value.z;
|
||||
var value = isoObject.size;
|
||||
storeVector.Value = value;
|
||||
storeX.Value = value.x;
|
||||
storeY.Value = value.y;
|
||||
storeZ.Value = value.z;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
65
Assets/IsoTools/PlayMaker/Actions/IsoGetTilePosition.cs
Normal file
65
Assets/IsoTools/PlayMaker/Actions/IsoGetTilePosition.cs
Normal file
@@ -0,0 +1,65 @@
|
||||
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 : IsoComponentAction<IsoObject> {
|
||||
[RequiredField]
|
||||
[CheckForComponent(typeof(IsoObject))]
|
||||
[HutongGames.PlayMaker.Title("IsoObject (In)")]
|
||||
public FsmOwnerDefault gameObject;
|
||||
|
||||
[UIHint(UIHint.Variable)]
|
||||
[HutongGames.PlayMaker.Title("Store Tile Position Vector (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;
|
||||
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 = isoObject.tilePosition;
|
||||
storeVector.Value = value;
|
||||
storeX.Value = value.x;
|
||||
storeY.Value = value.y;
|
||||
storeZ.Value = value.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: a4c5cff4e06894f2aae07daa307c76d9
|
||||
timeCreated: 1450207773
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
83
Assets/IsoTools/PlayMaker/Actions/IsoGetTouchIsoPosition.cs
Normal file
83
Assets/IsoTools/PlayMaker/Actions/IsoGetTouchIsoPosition.cs
Normal file
@@ -0,0 +1,83 @@
|
||||
using UnityEngine;
|
||||
using HutongGames.PlayMaker;
|
||||
|
||||
namespace IsoTools.PlayMaker.Actions {
|
||||
[ActionCategory("IsoTools")]
|
||||
[HutongGames.PlayMaker.Tooltip(
|
||||
"Gets a touch isometric position.")]
|
||||
public class IsoGetTouchIsoPosition : IsoComponentAction<IsoWorld> {
|
||||
[RequiredField]
|
||||
[CheckForComponent(typeof(IsoWorld))]
|
||||
[HutongGames.PlayMaker.Title("IsoWorld (In)")]
|
||||
public FsmOwnerDefault gameObject;
|
||||
|
||||
[RequiredField]
|
||||
[HutongGames.PlayMaker.Title("Finger Id (In)")]
|
||||
public FsmInt fingerId;
|
||||
|
||||
[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;
|
||||
fingerId = 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.TouchIsoPosition(
|
||||
fingerId.Value,
|
||||
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
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 88c45e14a4cd040f992be5868786242f
|
||||
timeCreated: 1450196704
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,83 @@
|
||||
using UnityEngine;
|
||||
using HutongGames.PlayMaker;
|
||||
|
||||
namespace IsoTools.PlayMaker.Actions {
|
||||
[ActionCategory("IsoTools")]
|
||||
[HutongGames.PlayMaker.Tooltip(
|
||||
"Gets a touch isometric tile position.")]
|
||||
public class IsoGetTouchIsoTilePosition : IsoComponentAction<IsoWorld> {
|
||||
[RequiredField]
|
||||
[CheckForComponent(typeof(IsoWorld))]
|
||||
[HutongGames.PlayMaker.Title("IsoWorld (In)")]
|
||||
public FsmOwnerDefault gameObject;
|
||||
|
||||
[RequiredField]
|
||||
[HutongGames.PlayMaker.Title("Finger Id (In)")]
|
||||
public FsmInt fingerId;
|
||||
|
||||
[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;
|
||||
fingerId = 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.TouchIsoTilePosition(
|
||||
fingerId.Value,
|
||||
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
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 91eb63755433a4241b6cdf806e27a493
|
||||
timeCreated: 1450196722
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -8,24 +8,31 @@ namespace IsoTools.PlayMaker.Actions {
|
||||
public class IsoGetWorldProps : IsoComponentAction<IsoWorld> {
|
||||
[RequiredField]
|
||||
[CheckForComponent(typeof(IsoWorld))]
|
||||
[HutongGames.PlayMaker.Title("IsoWorld (In)")]
|
||||
public FsmOwnerDefault gameObject;
|
||||
|
||||
[UIHint(UIHint.Variable)]
|
||||
[HutongGames.PlayMaker.Title("Tile Size (Out)")]
|
||||
public FsmFloat tileSize;
|
||||
|
||||
[UIHint(UIHint.Variable)]
|
||||
[HutongGames.PlayMaker.Title("Tile Ratio (Out)")]
|
||||
public FsmFloat tileRatio;
|
||||
|
||||
[UIHint(UIHint.Variable)]
|
||||
[HutongGames.PlayMaker.Title("Tile Angle (Out)")]
|
||||
public FsmFloat tileAngle;
|
||||
|
||||
[UIHint(UIHint.Variable)]
|
||||
[HutongGames.PlayMaker.Title("Tile Height (Out)")]
|
||||
public FsmFloat tileHeight;
|
||||
|
||||
[UIHint(UIHint.Variable)]
|
||||
[HutongGames.PlayMaker.Title("Step Depth (Out)")]
|
||||
public FsmFloat stepDepth;
|
||||
|
||||
[UIHint(UIHint.Variable)]
|
||||
[HutongGames.PlayMaker.Title("Start Depth (Out)")]
|
||||
public FsmFloat startDepth;
|
||||
|
||||
public bool everyFrame;
|
||||
|
||||
@@ -10,17 +10,24 @@ namespace IsoTools.PlayMaker.Actions {
|
||||
public class IsoResize : IsoComponentAction<IsoObject> {
|
||||
[RequiredField]
|
||||
[CheckForComponent(typeof(IsoObject))]
|
||||
[HutongGames.PlayMaker.Title("IsoObject (In)")]
|
||||
[HutongGames.PlayMaker.Tooltip("The IsoObject to resize.")]
|
||||
public FsmOwnerDefault gameObject;
|
||||
|
||||
[UIHint(UIHint.Variable)]
|
||||
[HutongGames.PlayMaker.Title("Vector (In)")]
|
||||
[HutongGames.PlayMaker.Tooltip(
|
||||
"Use a stored resize Vector3, " +
|
||||
"and/or set individual axis below.")]
|
||||
public FsmVector3 vector;
|
||||
|
||||
[HutongGames.PlayMaker.Title("X (In)")]
|
||||
public FsmFloat x;
|
||||
|
||||
[HutongGames.PlayMaker.Title("Y (In)")]
|
||||
public FsmFloat y;
|
||||
|
||||
[HutongGames.PlayMaker.Title("Z (In)")]
|
||||
public FsmFloat z;
|
||||
|
||||
[HutongGames.PlayMaker.Tooltip("Resize over one second")]
|
||||
|
||||
@@ -8,11 +8,12 @@ namespace IsoTools.PlayMaker.Actions {
|
||||
public class IsoSetMode : IsoComponentAction<IsoObject> {
|
||||
[RequiredField]
|
||||
[CheckForComponent(typeof(IsoObject))]
|
||||
[HutongGames.PlayMaker.Tooltip("The IsoObject to mode.")]
|
||||
[HutongGames.PlayMaker.Title("IsoObject (In)")]
|
||||
public FsmOwnerDefault gameObject;
|
||||
|
||||
[RequiredField]
|
||||
[ObjectType(typeof(IsoObject.Mode))]
|
||||
[HutongGames.PlayMaker.Title("Mode (In)")]
|
||||
public FsmEnum mode;
|
||||
|
||||
public override void Reset() {
|
||||
|
||||
@@ -8,14 +8,25 @@ namespace IsoTools.PlayMaker.Actions {
|
||||
public class IsoSetWorldProps : IsoComponentAction<IsoWorld> {
|
||||
[RequiredField]
|
||||
[CheckForComponent(typeof(IsoWorld))]
|
||||
[HutongGames.PlayMaker.Tooltip("The IsoWorld to props.")]
|
||||
[HutongGames.PlayMaker.Title("IsoWorld (In)")]
|
||||
public FsmOwnerDefault gameObject;
|
||||
|
||||
[HutongGames.PlayMaker.Title("Tile Size (In)")]
|
||||
public FsmFloat tileSize;
|
||||
|
||||
[HutongGames.PlayMaker.Title("Tile Ratio (In)")]
|
||||
public FsmFloat tileRatio;
|
||||
|
||||
[HutongGames.PlayMaker.Title("Tile Angle (In)")]
|
||||
public FsmFloat tileAngle;
|
||||
|
||||
[HutongGames.PlayMaker.Title("Tile Height (In)")]
|
||||
public FsmFloat tileHeight;
|
||||
|
||||
[HutongGames.PlayMaker.Title("Step Depth (In)")]
|
||||
public FsmFloat stepDepth;
|
||||
|
||||
[HutongGames.PlayMaker.Title("Start Depth (In)")]
|
||||
public FsmFloat startDepth;
|
||||
|
||||
public override void Reset() {
|
||||
|
||||
@@ -10,17 +10,24 @@ namespace IsoTools.PlayMaker.Actions {
|
||||
public class IsoTranslate : IsoComponentAction<IsoObject> {
|
||||
[RequiredField]
|
||||
[CheckForComponent(typeof(IsoObject))]
|
||||
[HutongGames.PlayMaker.Title("IsoObject (In)")]
|
||||
[HutongGames.PlayMaker.Tooltip("The IsoObject to translate.")]
|
||||
public FsmOwnerDefault gameObject;
|
||||
|
||||
[UIHint(UIHint.Variable)]
|
||||
[HutongGames.PlayMaker.Title("Vector (In)")]
|
||||
[HutongGames.PlayMaker.Tooltip(
|
||||
"Use a stored translation Vector3, " +
|
||||
"and/or set individual axis below.")]
|
||||
public FsmVector3 vector;
|
||||
|
||||
[HutongGames.PlayMaker.Title("X (In)")]
|
||||
public FsmFloat x;
|
||||
|
||||
[HutongGames.PlayMaker.Title("Y (In)")]
|
||||
public FsmFloat y;
|
||||
|
||||
[HutongGames.PlayMaker.Title("Z (In)")]
|
||||
public FsmFloat z;
|
||||
|
||||
[HutongGames.PlayMaker.Tooltip("Translate over one second")]
|
||||
|
||||
@@ -165,34 +165,37 @@ namespace IsoTools {
|
||||
//
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
public Vector3 TouchIsoPosition(int touch_index) {
|
||||
return TouchIsoPosition(touch_index, 0.0f);
|
||||
public Vector3 TouchIsoPosition(int finger_id) {
|
||||
return TouchIsoPosition(finger_id, 0.0f);
|
||||
}
|
||||
|
||||
public Vector3 TouchIsoPosition(int touch_index, float iso_z) {
|
||||
public Vector3 TouchIsoPosition(int finger_id, float iso_z) {
|
||||
if ( !Camera.main ) {
|
||||
Debug.LogError("Main camera not found!", this);
|
||||
return Vector3.zero;
|
||||
}
|
||||
return TouchIsoPosition(touch_index, Camera.main, iso_z);
|
||||
return TouchIsoPosition(finger_id, Camera.main, iso_z);
|
||||
}
|
||||
|
||||
public Vector3 TouchIsoPosition(int touch_index, Camera camera) {
|
||||
return TouchIsoPosition(touch_index, camera, 0.0f);
|
||||
public Vector3 TouchIsoPosition(int finger_id, Camera camera) {
|
||||
return TouchIsoPosition(finger_id, camera, 0.0f);
|
||||
}
|
||||
|
||||
public Vector3 TouchIsoPosition(int touch_index, Camera camera, float iso_z) {
|
||||
if ( touch_index < 0 || touch_index >= Input.touchCount ) {
|
||||
Debug.LogError("Touch index argument is incorrect!", this);
|
||||
return Vector3.zero;
|
||||
}
|
||||
public Vector3 TouchIsoPosition(int finger_id, Camera camera, float iso_z) {
|
||||
if ( !camera ) {
|
||||
Debug.LogError("Camera argument is incorrect!", this);
|
||||
return Vector3.zero;
|
||||
}
|
||||
return ScreenToIso(
|
||||
camera.ScreenToWorldPoint(Input.GetTouch(touch_index).position),
|
||||
iso_z);
|
||||
for ( var i = 0; i < Input.touchCount; ++i ) {
|
||||
var touch = Input.GetTouch(i);
|
||||
if ( touch.fingerId == finger_id ) {
|
||||
return ScreenToIso(
|
||||
camera.ScreenToWorldPoint(touch.position),
|
||||
iso_z);
|
||||
}
|
||||
}
|
||||
Debug.LogError("Touch finger id argument is incorrect!", this);
|
||||
return Vector3.zero;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
@@ -201,20 +204,20 @@ namespace IsoTools {
|
||||
//
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
public Vector3 TouchIsoTilePosition(int touch_index) {
|
||||
return IsoUtils.Vec3Floor(TouchIsoPosition(touch_index));
|
||||
public Vector3 TouchIsoTilePosition(int finger_id) {
|
||||
return IsoUtils.Vec3Floor(TouchIsoPosition(finger_id));
|
||||
}
|
||||
|
||||
public Vector3 TouchIsoTilePosition(int touch_index, float iso_z) {
|
||||
return IsoUtils.Vec3Floor(TouchIsoPosition(touch_index, iso_z));
|
||||
public Vector3 TouchIsoTilePosition(int finger_id, float iso_z) {
|
||||
return IsoUtils.Vec3Floor(TouchIsoPosition(finger_id, iso_z));
|
||||
}
|
||||
|
||||
public Vector3 TouchIsoTilePosition(int touch_index, Camera camera) {
|
||||
return IsoUtils.Vec3Floor(TouchIsoPosition(touch_index, camera));
|
||||
public Vector3 TouchIsoTilePosition(int finger_id, Camera camera) {
|
||||
return IsoUtils.Vec3Floor(TouchIsoPosition(finger_id, camera));
|
||||
}
|
||||
|
||||
public Vector3 TouchIsoTilePosition(int touch_index, Camera camera, float iso_z) {
|
||||
return IsoUtils.Vec3Floor(TouchIsoPosition(touch_index, camera, iso_z));
|
||||
public Vector3 TouchIsoTilePosition(int finger_id, Camera camera, float iso_z) {
|
||||
return IsoUtils.Vec3Floor(TouchIsoPosition(finger_id, camera, iso_z));
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user