mirror of
https://github.com/BlackMATov/unity-iso-tools.git
synced 2025-12-16 14:09:00 +07:00
New PlayMaker actions: ConvertIsoToScreen and ConvertScreenToIso
This commit is contained in:
@@ -445,6 +445,8 @@ MonoBehaviour:
|
||||
- IsoTools.PlayMaker.Actions.IsoGetSize
|
||||
- IsoTools.PlayMaker.Actions.IsoGetMode
|
||||
- HutongGames.PlayMaker.Actions.Wait
|
||||
- IsoTools.PlayMaker.Actions.IsoConvertScreenToIso
|
||||
- IsoTools.PlayMaker.Actions.IsoConvertIsoToScreen
|
||||
- PlayMaker.ConditionalExpression.ConditionalExpression
|
||||
customNames:
|
||||
-
|
||||
@@ -453,10 +455,12 @@ MonoBehaviour:
|
||||
-
|
||||
-
|
||||
-
|
||||
actionEnabled: 010101010101
|
||||
actionIsOpen: 000000010100
|
||||
actionStartIndex: 00000000090000000f00000015000000170000001a000000
|
||||
actionHashCodes: 8ef876007ebd02027ebd0202672cde0348c01101490c8701
|
||||
-
|
||||
-
|
||||
actionEnabled: 0101010101010101
|
||||
actionIsOpen: 0000000101010100
|
||||
actionStartIndex: 00000000090000000f00000015000000170000001a0000001e00000023000000
|
||||
actionHashCodes: 8ef876007ebd02027ebd0202672cde0348c0110184d171054627a803490c8701
|
||||
unityObjectParams: []
|
||||
fsmGameObjectParams: []
|
||||
fsmOwnerDefaultParams:
|
||||
@@ -492,6 +496,22 @@ MonoBehaviour:
|
||||
showInInspector: 0
|
||||
networkSync: 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}
|
||||
animationCurveParams: []
|
||||
functionCallParams: []
|
||||
fsmTemplateControlParams: []
|
||||
@@ -577,6 +597,12 @@ MonoBehaviour:
|
||||
showInInspector: 0
|
||||
networkSync: 0
|
||||
value: 1
|
||||
- useVariable: 1
|
||||
name:
|
||||
tooltip:
|
||||
showInInspector: 0
|
||||
networkSync: 0
|
||||
value: 1
|
||||
fsmIntParams: []
|
||||
fsmBoolParams:
|
||||
- useVariable: 1
|
||||
@@ -585,7 +611,19 @@ MonoBehaviour:
|
||||
showInInspector: 0
|
||||
networkSync: 0
|
||||
value: 0
|
||||
fsmVector2Params: []
|
||||
fsmVector2Params:
|
||||
- useVariable: 1
|
||||
name: screen_pos
|
||||
tooltip:
|
||||
showInInspector: 1
|
||||
networkSync: 0
|
||||
value: {x: 0, y: 0}
|
||||
- useVariable: 1
|
||||
name: screen_pos
|
||||
tooltip:
|
||||
showInInspector: 1
|
||||
networkSync: 0
|
||||
value: {x: 0, y: 0}
|
||||
fsmVector3Params:
|
||||
- useVariable: 1
|
||||
name:
|
||||
@@ -605,6 +643,18 @@ MonoBehaviour:
|
||||
showInInspector: 1
|
||||
networkSync: 0
|
||||
value: {x: 0, y: 0, z: 0}
|
||||
- useVariable: 1
|
||||
name: iso_position
|
||||
tooltip:
|
||||
showInInspector: 1
|
||||
networkSync: 0
|
||||
value: {x: 0, y: 0, z: 0}
|
||||
- useVariable: 1
|
||||
name: iso_position2
|
||||
tooltip:
|
||||
showInInspector: 1
|
||||
networkSync: 0
|
||||
value: {x: 0, y: 0, z: 0}
|
||||
fsmColorParams: []
|
||||
fsmRectParams: []
|
||||
fsmQuaternionParams: []
|
||||
@@ -612,12 +662,12 @@ MonoBehaviour:
|
||||
- FINISHED
|
||||
- TO_RESET_POSITION
|
||||
-
|
||||
byteData: 000000000000010000
|
||||
byteData: 0000000000000100000000
|
||||
arrayParamSizes:
|
||||
arrayParamTypes: []
|
||||
customTypeSizes:
|
||||
customTypeNames: []
|
||||
paramDataType: 140000001c0000000f0000000f0000000f00000001000000010000000100000001000000140000001c0000000f0000000f0000000f00000001000000140000001c0000000f0000000f0000000f00000001000000140000002a0000000f0000001700000001000000120000001700000017000000010000000100000011000000
|
||||
paramDataType: 140000001c0000000f0000000f0000000f00000001000000010000000100000001000000140000001c0000000f0000000f0000000f00000001000000140000001c0000000f0000000f0000000f00000001000000140000002a0000000f0000001700000001000000140000001c000000250000000100000014000000250000000f0000001c00000001000000120000001700000017000000010000000100000011000000
|
||||
paramName:
|
||||
- gameObject
|
||||
- vector
|
||||
@@ -645,14 +695,23 @@ MonoBehaviour:
|
||||
- time
|
||||
- finishEvent
|
||||
- realTime
|
||||
- gameObject
|
||||
- fromIsometricVector
|
||||
- toScreenVector
|
||||
- everyFrame
|
||||
- gameObject
|
||||
- fromScreenVector
|
||||
- specificIsometricZ
|
||||
- toIsometricVector
|
||||
- everyFrame
|
||||
- expression
|
||||
- isTrueEvent
|
||||
- isFalseEvent
|
||||
- everyFrame
|
||||
- rawResult
|
||||
- storeResult
|
||||
paramDataPos: 0000000000000000000000000100000002000000000000000100000002000000030000000100000001000000030000000400000005000000040000000200000002000000060000000700000008000000050000000300000000000000090000000000000006000000000000000100000002000000070000000800000000000000
|
||||
paramByteDataSize: 0000000000000000000000000000000000000000010000000100000001000000010000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000010000000000000000000000000000000000000001000000000000000000000000000000010000000100000000000000
|
||||
paramDataPos: 00000000000000000000000001000000020000000000000001000000020000000300000001000000010000000300000004000000050000000400000002000000020000000600000007000000080000000500000003000000000000000900000000000000060000000400000003000000000000000700000005000000010000000a0000000400000008000000000000000100000002000000090000000a00000000000000
|
||||
paramByteDataSize: 0000000000000000000000000000000000000000010000000100000001000000010000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000010000000000000000000000000000000000000001000000000000000000000000000000010000000000000000000000000000000000000001000000000000000000000000000000010000000100000000000000
|
||||
- name: State 3
|
||||
description:
|
||||
colorIndex: 0
|
||||
@@ -962,7 +1021,13 @@ MonoBehaviour:
|
||||
intVariables: []
|
||||
boolVariables: []
|
||||
stringVariables: []
|
||||
vector2Variables: []
|
||||
vector2Variables:
|
||||
- useVariable: 1
|
||||
name: screen_pos
|
||||
tooltip:
|
||||
showInInspector: 1
|
||||
networkSync: 0
|
||||
value: {x: 0, y: 0}
|
||||
vector3Variables:
|
||||
- useVariable: 1
|
||||
name: iso_position
|
||||
@@ -970,6 +1035,12 @@ MonoBehaviour:
|
||||
showInInspector: 1
|
||||
networkSync: 0
|
||||
value: {x: 0, y: 0, z: 0}
|
||||
- useVariable: 1
|
||||
name: iso_position2
|
||||
tooltip:
|
||||
showInInspector: 1
|
||||
networkSync: 0
|
||||
value: {x: 0, y: 0, z: 0}
|
||||
- useVariable: 1
|
||||
name: iso_size
|
||||
tooltip:
|
||||
@@ -994,7 +1065,7 @@ MonoBehaviour:
|
||||
intValue: 0
|
||||
categories:
|
||||
-
|
||||
variableCategoryIDs: 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
variableCategoryIDs: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
description:
|
||||
docUrl:
|
||||
showStateLabel: 1
|
||||
|
||||
53
Assets/IsoTools/PlayMaker/Actions/IsoConvertIsoToScreen.cs
Normal file
53
Assets/IsoTools/PlayMaker/Actions/IsoConvertIsoToScreen.cs
Normal file
@@ -0,0 +1,53 @@
|
||||
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,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2b59e8593133b453bb434f86de86993a
|
||||
timeCreated: 1450193215
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
58
Assets/IsoTools/PlayMaker/Actions/IsoConvertScreenToIso.cs
Normal file
58
Assets/IsoTools/PlayMaker/Actions/IsoConvertScreenToIso.cs
Normal file
@@ -0,0 +1,58 @@
|
||||
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,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 693a3d4871bd64c19a94cce4a562f96a
|
||||
timeCreated: 1450193231
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -33,7 +33,7 @@ namespace IsoTools.PlayMaker.Actions {
|
||||
return ErrorVarClampMsg("TileSize", IsoWorld.MinTileSize, IsoWorld.MaxTileSize);
|
||||
}
|
||||
if ( !tileRatio.IsNone && IsErrorVarClamp(tileRatio.Value, IsoWorld.MinTileRatio, IsoWorld.MaxTileRatio) ) {
|
||||
return ErrorVarClampMsg("TileRation", IsoWorld.MinTileRatio, IsoWorld.MaxTileRatio);
|
||||
return ErrorVarClampMsg("TileRatio", IsoWorld.MinTileRatio, IsoWorld.MaxTileRatio);
|
||||
}
|
||||
if ( !tileAngle.IsNone && IsErrorVarClamp(tileAngle.Value, IsoWorld.MinTileAngle, IsoWorld.MaxTileAngle)) {
|
||||
return ErrorVarClampMsg("TileAngle", IsoWorld.MinTileAngle, IsoWorld.MaxTileAngle);
|
||||
|
||||
Reference in New Issue
Block a user