mirror of
https://github.com/BlackMATov/unity-iso-tools.git
synced 2025-12-15 01:12:05 +07:00
New PlayMaker actions: GetSize, SetSize
This commit is contained in:
@@ -52,8 +52,10 @@
|
|||||||
<Compile Include="Assets\IsoTools\Examples\Scripts\IsoEchoListener.cs" />
|
<Compile Include="Assets\IsoTools\Examples\Scripts\IsoEchoListener.cs" />
|
||||||
<Compile Include="Assets\IsoTools\Examples\Scripts\PlayerController.cs" />
|
<Compile Include="Assets\IsoTools\Examples\Scripts\PlayerController.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\IsoGetTilePosition.cs" />
|
<Compile Include="Assets\IsoTools\PlayMaker\Actions\IsoGetTilePosition.cs" />
|
||||||
<Compile Include="Assets\IsoTools\PlayMaker\Actions\IsoSetPosition.cs" />
|
<Compile Include="Assets\IsoTools\PlayMaker\Actions\IsoSetPosition.cs" />
|
||||||
|
<Compile Include="Assets\IsoTools\PlayMaker\Actions\IsoSetSize.cs" />
|
||||||
<Compile Include="Assets\IsoTools\PlayMaker\Actions\IsoSetTilePosition.cs" />
|
<Compile Include="Assets\IsoTools\PlayMaker\Actions\IsoSetTilePosition.cs" />
|
||||||
<Compile Include="Assets\IsoTools\PlayMaker\Actions\IsoTranslate.cs" />
|
<Compile Include="Assets\IsoTools\PlayMaker\Actions\IsoTranslate.cs" />
|
||||||
<Compile Include="Assets\IsoTools\Scripts\IsoBoxCollider.cs" />
|
<Compile Include="Assets\IsoTools\Scripts\IsoBoxCollider.cs" />
|
||||||
|
|||||||
57
Assets/IsoTools/PlayMaker/Actions/IsoGetSize.cs
Normal file
57
Assets/IsoTools/PlayMaker/Actions/IsoGetSize.cs
Normal file
@@ -0,0 +1,57 @@
|
|||||||
|
using UnityEngine;
|
||||||
|
using HutongGames.PlayMaker;
|
||||||
|
|
||||||
|
namespace IsoTools.PlayMaker.Actions {
|
||||||
|
[ActionCategory("IsoTools")]
|
||||||
|
[HutongGames.PlayMaker.Tooltip("Gets the Size of a IsoObject and stores it in a Vector3 Variable or each Axis in a Float Variable")]
|
||||||
|
public class IsoGetSize : FsmStateAction {
|
||||||
|
[RequiredField]
|
||||||
|
public FsmOwnerDefault gameObject;
|
||||||
|
|
||||||
|
[UIHint(UIHint.Variable)]
|
||||||
|
public FsmVector3 vector;
|
||||||
|
|
||||||
|
[UIHint(UIHint.Variable)]
|
||||||
|
public FsmFloat x;
|
||||||
|
|
||||||
|
[UIHint(UIHint.Variable)]
|
||||||
|
public FsmFloat y;
|
||||||
|
|
||||||
|
[UIHint(UIHint.Variable)]
|
||||||
|
public FsmFloat z;
|
||||||
|
|
||||||
|
public bool everyFrame;
|
||||||
|
|
||||||
|
public override void Reset() {
|
||||||
|
gameObject = null;
|
||||||
|
vector = null;
|
||||||
|
x = null;
|
||||||
|
y = null;
|
||||||
|
z = null;
|
||||||
|
everyFrame = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void OnEnter() {
|
||||||
|
DoGetSize();
|
||||||
|
if ( !everyFrame ) {
|
||||||
|
Finish();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void OnUpdate() {
|
||||||
|
DoGetSize();
|
||||||
|
}
|
||||||
|
|
||||||
|
void DoGetSize() {
|
||||||
|
var go = Fsm.GetOwnerDefaultTarget(gameObject);
|
||||||
|
var iso_object = go ? go.GetComponent<IsoObject>() : null;
|
||||||
|
if ( iso_object ) {
|
||||||
|
var size = iso_object.size;
|
||||||
|
vector.Value = size;
|
||||||
|
x.Value = size.x;
|
||||||
|
y.Value = size.y;
|
||||||
|
z.Value = size.z;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} // IsoTools.PlayMaker.Actions
|
||||||
12
Assets/IsoTools/PlayMaker/Actions/IsoGetSize.cs.meta
Normal file
12
Assets/IsoTools/PlayMaker/Actions/IsoGetSize.cs.meta
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 786db15115e7f4363b18ae4aadcf2e3b
|
||||||
|
timeCreated: 1450014652
|
||||||
|
licenseType: Free
|
||||||
|
MonoImporter:
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -6,21 +6,16 @@ namespace IsoTools.PlayMaker.Actions {
|
|||||||
[HutongGames.PlayMaker.Tooltip("Sets the Position of a IsoObject. To leave any axis unchanged, set variable to 'None'.")]
|
[HutongGames.PlayMaker.Tooltip("Sets the Position of a IsoObject. To leave any axis unchanged, set variable to 'None'.")]
|
||||||
public class IsoSetPosition : FsmStateAction {
|
public class IsoSetPosition : FsmStateAction {
|
||||||
[RequiredField]
|
[RequiredField]
|
||||||
[HutongGames.PlayMaker.Tooltip("The GameObject to position.")]
|
|
||||||
public FsmOwnerDefault gameObject;
|
public FsmOwnerDefault gameObject;
|
||||||
|
|
||||||
[UIHint(UIHint.Variable)]
|
[UIHint(UIHint.Variable)]
|
||||||
[HutongGames.PlayMaker.Tooltip("Use a stored Vector3 position, and/or set individual axis below.")]
|
|
||||||
public FsmVector3 vector;
|
public FsmVector3 vector;
|
||||||
|
|
||||||
public FsmFloat x;
|
public FsmFloat x;
|
||||||
public FsmFloat y;
|
public FsmFloat y;
|
||||||
public FsmFloat z;
|
public FsmFloat z;
|
||||||
|
|
||||||
[HutongGames.PlayMaker.Tooltip("Repeat every frame.")]
|
|
||||||
public bool everyFrame;
|
public bool everyFrame;
|
||||||
|
|
||||||
[HutongGames.PlayMaker.Tooltip("Perform in LateUpdate. This is useful if you want to override the position of objects that are animated or otherwise positioned in Update.")]
|
|
||||||
public bool lateUpdate;
|
public bool lateUpdate;
|
||||||
|
|
||||||
public override void Reset() {
|
public override void Reset() {
|
||||||
|
|||||||
75
Assets/IsoTools/PlayMaker/Actions/IsoSetSize.cs
Normal file
75
Assets/IsoTools/PlayMaker/Actions/IsoSetSize.cs
Normal file
@@ -0,0 +1,75 @@
|
|||||||
|
using UnityEngine;
|
||||||
|
using HutongGames.PlayMaker;
|
||||||
|
|
||||||
|
namespace IsoTools.PlayMaker.Actions {
|
||||||
|
[ActionCategory("IsoTools")]
|
||||||
|
[HutongGames.PlayMaker.Tooltip("Sets the Size of a IsoObject. To leave any axis unchanged, set variable to 'None'.")]
|
||||||
|
public class IsoSetSize : FsmStateAction {
|
||||||
|
[RequiredField]
|
||||||
|
public FsmOwnerDefault gameObject;
|
||||||
|
|
||||||
|
[UIHint(UIHint.Variable)]
|
||||||
|
public FsmVector3 vector;
|
||||||
|
|
||||||
|
public FsmFloat x;
|
||||||
|
public FsmFloat y;
|
||||||
|
public FsmFloat z;
|
||||||
|
|
||||||
|
public bool everyFrame;
|
||||||
|
public bool lateUpdate;
|
||||||
|
|
||||||
|
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;
|
||||||
|
lateUpdate = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void OnEnter() {
|
||||||
|
if ( !everyFrame && !lateUpdate ) {
|
||||||
|
DoSetSize();
|
||||||
|
Finish();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void OnUpdate() {
|
||||||
|
if ( !lateUpdate ) {
|
||||||
|
DoSetSize();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void OnLateUpdate() {
|
||||||
|
if ( lateUpdate ) {
|
||||||
|
DoSetSize();
|
||||||
|
}
|
||||||
|
if ( !everyFrame ) {
|
||||||
|
Finish();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void DoSetSize() {
|
||||||
|
var go = Fsm.GetOwnerDefaultTarget(gameObject);
|
||||||
|
var iso_object = go ? go.GetComponent<IsoObject>() : null;
|
||||||
|
if ( iso_object ) {
|
||||||
|
var size = vector.IsNone
|
||||||
|
? iso_object.size
|
||||||
|
: vector.Value;
|
||||||
|
|
||||||
|
if ( !x.IsNone ) {
|
||||||
|
size.x = x.Value;
|
||||||
|
}
|
||||||
|
if ( !y.IsNone ) {
|
||||||
|
size.y = y.Value;
|
||||||
|
}
|
||||||
|
if ( !z.IsNone ) {
|
||||||
|
size.z = z.Value;
|
||||||
|
}
|
||||||
|
|
||||||
|
iso_object.size = size;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} // IsoTools.PlayMaker.Actions
|
||||||
12
Assets/IsoTools/PlayMaker/Actions/IsoSetSize.cs.meta
Normal file
12
Assets/IsoTools/PlayMaker/Actions/IsoSetSize.cs.meta
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 9692e258041de4188a3b9b796750b7a0
|
||||||
|
timeCreated: 1450014664
|
||||||
|
licenseType: Free
|
||||||
|
MonoImporter:
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -6,21 +6,16 @@ namespace IsoTools.PlayMaker.Actions {
|
|||||||
[HutongGames.PlayMaker.Tooltip("Sets the TilePosition of a IsoObject. To leave any axis unchanged, set variable to 'None'.")]
|
[HutongGames.PlayMaker.Tooltip("Sets the TilePosition of a IsoObject. To leave any axis unchanged, set variable to 'None'.")]
|
||||||
public class IsoSetTilePosition : FsmStateAction {
|
public class IsoSetTilePosition : FsmStateAction {
|
||||||
[RequiredField]
|
[RequiredField]
|
||||||
[HutongGames.PlayMaker.Tooltip("The GameObject to position.")]
|
|
||||||
public FsmOwnerDefault gameObject;
|
public FsmOwnerDefault gameObject;
|
||||||
|
|
||||||
[UIHint(UIHint.Variable)]
|
[UIHint(UIHint.Variable)]
|
||||||
[HutongGames.PlayMaker.Tooltip("Use a stored Vector3 position, and/or set individual axis below.")]
|
|
||||||
public FsmVector3 vector;
|
public FsmVector3 vector;
|
||||||
|
|
||||||
public FsmFloat x;
|
public FsmFloat x;
|
||||||
public FsmFloat y;
|
public FsmFloat y;
|
||||||
public FsmFloat z;
|
public FsmFloat z;
|
||||||
|
|
||||||
[HutongGames.PlayMaker.Tooltip("Repeat every frame.")]
|
|
||||||
public bool everyFrame;
|
public bool everyFrame;
|
||||||
|
|
||||||
[HutongGames.PlayMaker.Tooltip("Perform in LateUpdate. This is useful if you want to override the position of objects that are animated or otherwise positioned in Update.")]
|
|
||||||
public bool lateUpdate;
|
public bool lateUpdate;
|
||||||
|
|
||||||
public override void Reset() {
|
public override void Reset() {
|
||||||
@@ -35,45 +30,45 @@ namespace IsoTools.PlayMaker.Actions {
|
|||||||
|
|
||||||
public override void OnEnter() {
|
public override void OnEnter() {
|
||||||
if ( !everyFrame && !lateUpdate ) {
|
if ( !everyFrame && !lateUpdate ) {
|
||||||
DoSetPosition();
|
DoSetTilePosition();
|
||||||
Finish();
|
Finish();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void OnUpdate() {
|
public override void OnUpdate() {
|
||||||
if ( !lateUpdate ) {
|
if ( !lateUpdate ) {
|
||||||
DoSetPosition();
|
DoSetTilePosition();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void OnLateUpdate() {
|
public override void OnLateUpdate() {
|
||||||
if ( lateUpdate ) {
|
if ( lateUpdate ) {
|
||||||
DoSetPosition();
|
DoSetTilePosition();
|
||||||
}
|
}
|
||||||
if ( !everyFrame ) {
|
if ( !everyFrame ) {
|
||||||
Finish();
|
Finish();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DoSetPosition() {
|
void DoSetTilePosition() {
|
||||||
var go = Fsm.GetOwnerDefaultTarget(gameObject);
|
var go = Fsm.GetOwnerDefaultTarget(gameObject);
|
||||||
var iso_object = go ? go.GetComponent<IsoObject>() : null;
|
var iso_object = go ? go.GetComponent<IsoObject>() : null;
|
||||||
if ( iso_object ) {
|
if ( iso_object ) {
|
||||||
var position = vector.IsNone
|
var tile_position = vector.IsNone
|
||||||
? iso_object.tilePosition
|
? iso_object.tilePosition
|
||||||
: vector.Value;
|
: vector.Value;
|
||||||
|
|
||||||
if ( !x.IsNone ) {
|
if ( !x.IsNone ) {
|
||||||
position.x = x.Value;
|
tile_position.x = x.Value;
|
||||||
}
|
}
|
||||||
if ( !y.IsNone ) {
|
if ( !y.IsNone ) {
|
||||||
position.y = y.Value;
|
tile_position.y = y.Value;
|
||||||
}
|
}
|
||||||
if ( !z.IsNone ) {
|
if ( !z.IsNone ) {
|
||||||
position.z = z.Value;
|
tile_position.z = z.Value;
|
||||||
}
|
}
|
||||||
|
|
||||||
iso_object.tilePosition = position;
|
iso_object.tilePosition = tile_position;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,32 +6,18 @@ namespace IsoTools.PlayMaker.Actions {
|
|||||||
[HutongGames.PlayMaker.Tooltip("Translates a IsoObject. Use a Vector3 variable and/or XYZ components. To leave any axis unchanged, set variable to 'None'.")]
|
[HutongGames.PlayMaker.Tooltip("Translates a IsoObject. Use a Vector3 variable and/or XYZ components. To leave any axis unchanged, set variable to 'None'.")]
|
||||||
public class IsoTranslate : FsmStateAction {
|
public class IsoTranslate : FsmStateAction {
|
||||||
[RequiredField]
|
[RequiredField]
|
||||||
[HutongGames.PlayMaker.Tooltip("The game object to translate.")]
|
|
||||||
public FsmOwnerDefault gameObject;
|
public FsmOwnerDefault gameObject;
|
||||||
|
|
||||||
[UIHint(UIHint.Variable)]
|
[UIHint(UIHint.Variable)]
|
||||||
[HutongGames.PlayMaker.Tooltip("A translation vector. NOTE: You can override individual axis below.")]
|
|
||||||
public FsmVector3 vector;
|
public FsmVector3 vector;
|
||||||
|
|
||||||
[HutongGames.PlayMaker.Tooltip("Translation along x axis.")]
|
|
||||||
public FsmFloat x;
|
public FsmFloat x;
|
||||||
|
|
||||||
[HutongGames.PlayMaker.Tooltip("Translation along y axis.")]
|
|
||||||
public FsmFloat y;
|
public FsmFloat y;
|
||||||
|
|
||||||
[HutongGames.PlayMaker.Tooltip("Translation along z axis.")]
|
|
||||||
public FsmFloat z;
|
public FsmFloat z;
|
||||||
|
|
||||||
[HutongGames.PlayMaker.Tooltip("Translate over one second")]
|
|
||||||
public bool perSecond;
|
public bool perSecond;
|
||||||
|
|
||||||
[HutongGames.PlayMaker.Tooltip("Repeat every frame.")]
|
|
||||||
public bool everyFrame;
|
public bool everyFrame;
|
||||||
|
|
||||||
[HutongGames.PlayMaker.Tooltip("Perform the translate in LateUpdate. This is useful if you want to override the position of objects that are animated or otherwise positioned in Update.")]
|
|
||||||
public bool lateUpdate;
|
public bool lateUpdate;
|
||||||
|
|
||||||
[HutongGames.PlayMaker.Tooltip("Perform the translate in FixedUpdate. This is useful when working with rigid bodies and physics.")]
|
|
||||||
public bool fixedUpdate;
|
public bool fixedUpdate;
|
||||||
|
|
||||||
public override void Reset() {
|
public override void Reset() {
|
||||||
|
|||||||
Reference in New Issue
Block a user