PlayMaker and Tiled to Addons folder. CHANGELOG and README to Docs folder.

This commit is contained in:
2016-10-22 17:21:00 +07:00
parent 890e54f1b0
commit f51d88e355
124 changed files with 540 additions and 710 deletions

View File

@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: a3264192dd6f94e708ddbcd72bf32a61
folderAsset: yes
timeCreated: 1477130201
licenseType: Free
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 8a23c47afc2e94d18abf9f1cb58fb612
folderAsset: yes
timeCreated: 1449997824
licenseType: Free
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,80 @@
#if PLAYMAKER
using UnityEngine;
using HutongGames.PlayMaker;
using IsoTools.PlayMaker.Internal;
namespace IsoTools.PlayMaker.Actions {
[ActionCategory("IsoTools.Physics")]
[HutongGames.PlayMaker.Tooltip(
"Applies a force to a IsoRigidbody that simulates explosion effects. " +
"The explosion force will fall off linearly with distance.")]
public class IsoAddExplosionForce : IsoComponentAction<IsoRigidbody> {
[RequiredField]
[CheckForComponent(typeof(IsoRigidbody))]
[HutongGames.PlayMaker.Tooltip(
"The IsoRigidbody to add the explosion force to.")]
public FsmOwnerDefault gameObject;
[RequiredField]
[HutongGames.PlayMaker.Tooltip(
"The center of the explosion.")]
public FsmVector3 center;
[RequiredField]
[HutongGames.PlayMaker.Tooltip(
"The strength of the explosion.")]
public FsmFloat force;
[RequiredField]
[HutongGames.PlayMaker.Tooltip(
"The radius of the explosion.")]
public FsmFloat radius;
[HutongGames.PlayMaker.Tooltip(
"Applies the force as if it was applied from beneath the object.")]
public FsmFloat upwardsModifier;
[HutongGames.PlayMaker.Tooltip(
"The type of force to apply.")]
public ForceMode forceMode;
[HutongGames.PlayMaker.Tooltip(
"Repeat every frame.")]
public bool everyFrame;
public override void Reset() {
gameObject = null;
center = null;
force = null;
radius = null;
upwardsModifier = 0.0f;
forceMode = ForceMode.Force;
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) ) {
isoRigidbody.AddExplosionForce(
force.Value, center.Value, radius.Value,
upwardsModifier.Value, forceMode);
}
}
}
} // IsoTools.PlayMaker.Actions
#endif

View File

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

View File

@@ -0,0 +1,101 @@
#if PLAYMAKER
using UnityEngine;
using HutongGames.PlayMaker;
using IsoTools.PlayMaker.Internal;
namespace IsoTools.PlayMaker.Actions {
[ActionCategory("IsoTools.Physics")]
[HutongGames.PlayMaker.Tooltip(
"Adds a force to a IsoRigidbody. " +
"Use Vector3 variable and/or Float variables for each axis.")]
public class IsoAddForce : IsoComponentAction<IsoRigidbody> {
[RequiredField]
[CheckForComponent(typeof(IsoRigidbody))]
[HutongGames.PlayMaker.Tooltip(
"The IsoRigidbody to apply the force to.")]
public FsmOwnerDefault gameObject;
[UIHint(UIHint.Variable)]
[HutongGames.PlayMaker.Tooltip(
"Optionally apply the force at a position on the object.")]
public FsmVector3 atPosition;
[UIHint(UIHint.Variable)]
[HutongGames.PlayMaker.Tooltip(
"A Vector3 force to add. " +
"Optionally override any axis with the X, Y, Z parameters.")]
public FsmVector3 vector;
[HutongGames.PlayMaker.Tooltip(
"Force along the X axis. To leave unchanged, set to 'None'.")]
public FsmFloat x;
[HutongGames.PlayMaker.Tooltip(
"Force along the Y axis. To leave unchanged, set to 'None'.")]
public FsmFloat y;
[HutongGames.PlayMaker.Tooltip(
"Force along the Z axis. To leave unchanged, set to 'None'.")]
public FsmFloat z;
[HutongGames.PlayMaker.Tooltip(
"Apply the force in world or local space.")]
public Space space;
[HutongGames.PlayMaker.Tooltip(
"The type of force to apply.")]
public ForceMode forceMode;
[HutongGames.PlayMaker.Tooltip(
"Repeat every frame.")]
public bool everyFrame;
public override void Reset() {
gameObject = null;
atPosition = new FsmVector3{UseVariable = true};
vector = null;
x = new FsmFloat{UseVariable = true};
y = new FsmFloat{UseVariable = true};
z = new FsmFloat{UseVariable = true};
space = Space.World;
forceMode = ForceMode.Force;
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 ? Vector3.zero : vector.Value;
if ( !x.IsNone ) { value.x = x.Value; }
if ( !y.IsNone ) { value.y = y.Value; }
if ( !z.IsNone ) { value.z = z.Value; }
if ( space == Space.World ) {
if ( atPosition.IsNone ) {
isoRigidbody.AddForce(value, forceMode);
} else {
isoRigidbody.AddForceAtPosition(
value, atPosition.Value, forceMode);
}
} else {
isoRigidbody.AddRelativeForce(value, forceMode);
}
}
}
}
} // IsoTools.PlayMaker.Actions
#endif

View File

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

View File

@@ -0,0 +1,68 @@
#if PLAYMAKER
using UnityEngine;
using HutongGames.PlayMaker;
using IsoTools.PlayMaker.Internal;
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
#endif

View File

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

View File

@@ -0,0 +1,81 @@
#if PLAYMAKER
using UnityEngine;
using HutongGames.PlayMaker;
using IsoTools.PlayMaker.Internal;
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
#endif

View File

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

View File

@@ -0,0 +1,46 @@
#if PLAYMAKER
using UnityEngine;
using HutongGames.PlayMaker;
using IsoTools.PlayMaker.Internal;
namespace IsoTools.PlayMaker.Actions {
[ActionCategory("IsoTools.Physics")]
[HutongGames.PlayMaker.Tooltip(
"Gets the Drag of a IsoRigidbody and stores it in a Float Variable.")]
public class IsoGetDrag : IsoComponentAction<IsoRigidbody> {
[RequiredField]
[CheckForComponent(typeof(IsoRigidbody))]
public FsmOwnerDefault gameObject;
[RequiredField]
[UIHint(UIHint.Variable)]
public FsmFloat storeResult;
public bool everyFrame;
public override void Reset() {
gameObject = null;
storeResult = 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) ) {
storeResult.Value = isoRigidbody.drag;
}
}
}
} // IsoTools.PlayMaker.Actions
#endif

View File

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

View File

@@ -0,0 +1,46 @@
#if PLAYMAKER
using UnityEngine;
using HutongGames.PlayMaker;
using IsoTools.PlayMaker.Internal;
namespace IsoTools.PlayMaker.Actions {
[ActionCategory("IsoTools.Physics")]
[HutongGames.PlayMaker.Tooltip(
"Gets the Mass of a IsoRigidbody and stores it in a Float Variable.")]
public class IsoGetMass : IsoComponentAction<IsoRigidbody> {
[RequiredField]
[CheckForComponent(typeof(IsoRigidbody))]
public FsmOwnerDefault gameObject;
[RequiredField]
[UIHint(UIHint.Variable)]
public FsmFloat storeResult;
public bool everyFrame;
public override void Reset() {
gameObject = null;
storeResult = 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) ) {
storeResult.Value = isoRigidbody.mass;
}
}
}
} // IsoTools.PlayMaker.Actions
#endif

View File

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

View File

@@ -0,0 +1,40 @@
#if PLAYMAKER
using UnityEngine;
using HutongGames.PlayMaker;
using IsoTools.PlayMaker.Internal;
namespace IsoTools.PlayMaker.Actions {
[ActionCategory("IsoTools")]
[HutongGames.PlayMaker.Tooltip(
"Gets the Mode of a IsoObject and stores it in a Enum Variable")]
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)]
[HutongGames.PlayMaker.Title("Store Mode (Out)")]
public FsmEnum storeMode;
public override void Reset() {
gameObject = null;
storeMode = null;
}
public override void OnEnter() {
DoAction();
Finish();
}
void DoAction() {
var go = Fsm.GetOwnerDefaultTarget(gameObject);
if ( UpdateCache(go) ) {
storeMode.Value = isoObject.mode;
}
}
}
} // IsoTools.PlayMaker.Actions
#endif

View File

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

View File

@@ -0,0 +1,80 @@
#if PLAYMAKER
using UnityEngine;
using HutongGames.PlayMaker;
using IsoTools.PlayMaker.Internal;
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
#endif

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,80 @@
#if PLAYMAKER
using UnityEngine;
using HutongGames.PlayMaker;
using IsoTools.PlayMaker.Internal;
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
#endif

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

@@ -0,0 +1,68 @@
#if PLAYMAKER
using UnityEngine;
using HutongGames.PlayMaker;
using IsoTools.PlayMaker.Internal;
namespace IsoTools.PlayMaker.Actions {
[ActionCategory("IsoTools")]
[HutongGames.PlayMaker.Tooltip(
"Gets the Position of a IsoObject and stores it " +
"in a Vector3 Variable or each Axis in a Float Variable")]
public class IsoGetPosition : IsoComponentAction<IsoObject> {
[RequiredField]
[CheckForComponent(typeof(IsoObject))]
[HutongGames.PlayMaker.Title("IsoObject (In)")]
public FsmOwnerDefault gameObject;
[UIHint(UIHint.Variable)]
[HutongGames.PlayMaker.Title("Store Position Vector (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;
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.position;
storeVector.Value = value;
storeX.Value = value.x;
storeY.Value = value.y;
storeZ.Value = value.z;
}
}
}
} // IsoTools.PlayMaker.Actions
#endif

View File

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

View File

@@ -0,0 +1,68 @@
#if PLAYMAKER
using UnityEngine;
using HutongGames.PlayMaker;
using IsoTools.PlayMaker.Internal;
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 : IsoComponentAction<IsoObject> {
[RequiredField]
[CheckForComponent(typeof(IsoObject))]
[HutongGames.PlayMaker.Title("IsoObject (In)")]
public FsmOwnerDefault gameObject;
[UIHint(UIHint.Variable)]
[HutongGames.PlayMaker.Title("Store Size Vector (Out)")]
public FsmVector3 storeVector;
[UIHint(UIHint.Variable)]
[HutongGames.PlayMaker.Title("Store Size X (Out)")]
public FsmFloat storeX;
[UIHint(UIHint.Variable)]
[HutongGames.PlayMaker.Title("Store Size Y (Out)")]
public FsmFloat storeY;
[UIHint(UIHint.Variable)]
[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;
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.size;
storeVector.Value = value;
storeX.Value = value.x;
storeY.Value = value.y;
storeZ.Value = value.z;
}
}
}
} // IsoTools.PlayMaker.Actions
#endif

View 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:

View File

@@ -0,0 +1,46 @@
#if PLAYMAKER
using UnityEngine;
using HutongGames.PlayMaker;
using IsoTools.PlayMaker.Internal;
namespace IsoTools.PlayMaker.Actions {
[ActionCategory("IsoTools.Physics")]
[HutongGames.PlayMaker.Tooltip(
"Gets the Speed of a IsoRigidbody and stores it in a Float Variable.")]
public class IsoGetSpeed : IsoComponentAction<IsoRigidbody> {
[RequiredField]
[CheckForComponent(typeof(IsoRigidbody))]
public FsmOwnerDefault gameObject;
[RequiredField]
[UIHint(UIHint.Variable)]
public FsmFloat storeResult;
public bool everyFrame;
public override void Reset() {
gameObject = null;
storeResult = 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) ) {
storeResult.Value = isoRigidbody.velocity.magnitude;
}
}
}
} // IsoTools.PlayMaker.Actions
#endif

View File

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

View File

@@ -0,0 +1,68 @@
#if PLAYMAKER
using UnityEngine;
using HutongGames.PlayMaker;
using IsoTools.PlayMaker.Internal;
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
#endif

View 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:

View File

@@ -0,0 +1,86 @@
#if PLAYMAKER
using UnityEngine;
using HutongGames.PlayMaker;
using IsoTools.PlayMaker.Internal;
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
#endif

View File

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

View File

@@ -0,0 +1,86 @@
#if PLAYMAKER
using UnityEngine;
using HutongGames.PlayMaker;
using IsoTools.PlayMaker.Internal;
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
#endif

View File

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

View File

@@ -0,0 +1,62 @@
#if PLAYMAKER
using UnityEngine;
using HutongGames.PlayMaker;
using IsoTools.PlayMaker.Internal;
namespace IsoTools.PlayMaker.Actions {
[ActionCategory("IsoTools.Physics")]
[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
#endif

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,78 @@
#if PLAYMAKER
using UnityEngine;
using HutongGames.PlayMaker;
using IsoTools.PlayMaker.Internal;
namespace IsoTools.PlayMaker.Actions {
[ActionCategory("IsoTools")]
[HutongGames.PlayMaker.Tooltip(
"Gets an options of a IsoWorld.")]
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;
[HutongGames.PlayMaker.Tooltip("Repeat every frame.")]
public bool everyFrame;
public override void Reset() {
gameObject = null;
tileSize = null;
tileRatio = null;
tileAngle = null;
tileHeight = null;
stepDepth = null;
startDepth = 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) ) {
tileSize.Value = isoWorld.tileSize;
tileRatio.Value = isoWorld.tileRatio;
tileAngle.Value = isoWorld.tileAngle;
tileHeight.Value = isoWorld.tileHeight;
stepDepth.Value = isoWorld.stepDepth;
startDepth.Value = isoWorld.startDepth;
}
}
}
} // IsoTools.PlayMaker.Actions
#endif

View File

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

View File

@@ -0,0 +1,52 @@
#if PLAYMAKER
using UnityEngine;
using HutongGames.PlayMaker;
using IsoTools.PlayMaker.Internal;
namespace IsoTools.PlayMaker.Actions {
[ActionCategory("IsoTools.Physics")]
[HutongGames.PlayMaker.Tooltip(
"Tests if a IsoRigidbody is kinematic.")]
public class IsoIsKinematic : IsoComponentAction<IsoRigidbody> {
[RequiredField]
[CheckForComponent(typeof(IsoRigidbody))]
public FsmOwnerDefault gameObject;
public FsmEvent trueEvent;
public FsmEvent falseEvent;
[UIHint(UIHint.Variable)]
public FsmBool storeResult;
public bool everyFrame;
public override void Reset() {
gameObject = null;
trueEvent = null;
falseEvent = null;
storeResult = 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.isKinematic;
storeResult.Value = value;
Fsm.Event(value ? trueEvent : falseEvent);
}
}
}
} // IsoTools.PlayMaker.Actions
#endif

View File

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

View File

@@ -0,0 +1,52 @@
#if PLAYMAKER
using UnityEngine;
using HutongGames.PlayMaker;
using IsoTools.PlayMaker.Internal;
namespace IsoTools.PlayMaker.Actions {
[ActionCategory("IsoTools.Physics")]
[HutongGames.PlayMaker.Tooltip(
"Tests if a IsoRigidbody is sleeping.")]
public class IsoIsSleeping : IsoComponentAction<IsoRigidbody> {
[RequiredField]
[CheckForComponent(typeof(IsoRigidbody))]
public FsmOwnerDefault gameObject;
public FsmEvent trueEvent;
public FsmEvent falseEvent;
[UIHint(UIHint.Variable)]
public FsmBool storeResult;
public bool everyFrame;
public override void Reset() {
gameObject = null;
trueEvent = null;
falseEvent = null;
storeResult = 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.IsSleeping();
storeResult.Value = value;
Fsm.Event(value ? trueEvent : falseEvent);
}
}
}
} // IsoTools.PlayMaker.Actions
#endif

View File

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

View File

@@ -0,0 +1,52 @@
#if PLAYMAKER
using UnityEngine;
using HutongGames.PlayMaker;
using IsoTools.PlayMaker.Internal;
namespace IsoTools.PlayMaker.Actions {
[ActionCategory("IsoTools.Physics")]
[HutongGames.PlayMaker.Tooltip(
"Tests if a IsoRigidbody use gravity.")]
public class IsoIsUseGravity : IsoComponentAction<IsoRigidbody> {
[RequiredField]
[CheckForComponent(typeof(IsoRigidbody))]
public FsmOwnerDefault gameObject;
public FsmEvent trueEvent;
public FsmEvent falseEvent;
[UIHint(UIHint.Variable)]
public FsmBool storeResult;
public bool everyFrame;
public override void Reset() {
gameObject = null;
trueEvent = null;
falseEvent = null;
storeResult = 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.useGravity;
storeResult.Value = value;
Fsm.Event(value ? trueEvent : falseEvent);
}
}
}
} // IsoTools.PlayMaker.Actions
#endif

View File

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

View File

@@ -0,0 +1,107 @@
#if PLAYMAKER
using UnityEngine;
using HutongGames.PlayMaker;
using IsoTools.PlayMaker.Internal;
namespace IsoTools.PlayMaker.Actions {
[ActionCategory("IsoTools")]
[HutongGames.PlayMaker.Tooltip(
"Resizes a IsoObject. " +
"Use a Vector3 variable and/or XYZ components. " +
"To leave any axis unchanged, set variable to 'None'.")]
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")]
public bool perSecond;
[HutongGames.PlayMaker.Tooltip("Repeat every frame.")]
public bool everyFrame;
[HutongGames.PlayMaker.Tooltip("Perform the resize in LateUpdate.")]
public bool lateUpdate;
[HutongGames.PlayMaker.Tooltip("Perform the resize in FixedUpdate.")]
public bool fixedUpdate;
public override void Reset() {
gameObject = null;
vector = null;
x = new FsmFloat{UseVariable = true};
y = new FsmFloat{UseVariable = true};
z = new FsmFloat{UseVariable = true};
perSecond = true;
everyFrame = true;
lateUpdate = false;
fixedUpdate = false;
}
public override void OnPreprocess() {
Fsm.HandleFixedUpdate = true;
}
public override void OnEnter() {
if ( !everyFrame && !lateUpdate && !fixedUpdate ) {
DoAction();
Finish();
}
}
public override void OnUpdate() {
if ( !lateUpdate && !fixedUpdate ) {
DoAction();
}
}
public override void OnLateUpdate() {
if ( lateUpdate ) {
DoAction();
}
if ( !everyFrame ) {
Finish();
}
}
public override void OnFixedUpdate() {
if ( fixedUpdate ) {
DoAction();
}
if ( !everyFrame ) {
Finish();
}
}
void DoAction() {
var go = Fsm.GetOwnerDefaultTarget(gameObject);
if ( UpdateCache(go) ) {
var value = vector.IsNone ? Vector3.zero : vector.Value;
if ( !x.IsNone ) { value.x = x.Value; }
if ( !y.IsNone ) { value.y = y.Value; }
if ( !z.IsNone ) { value.z = z.Value; }
isoObject.size +=
perSecond ? value * Time.deltaTime : value;
}
}
}
} // IsoTools.PlayMaker.Actions
#endif

View File

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

View File

@@ -0,0 +1,45 @@
#if PLAYMAKER
using UnityEngine;
using HutongGames.PlayMaker;
using IsoTools.PlayMaker.Internal;
namespace IsoTools.PlayMaker.Actions {
[ActionCategory("IsoTools.Physics")]
[HutongGames.PlayMaker.Tooltip(
"Sets the Drag of a IsoRigidbody.")]
public class IsoSetDrag : IsoComponentAction<IsoRigidbody> {
[RequiredField]
[CheckForComponent(typeof(IsoRigidbody))]
public FsmOwnerDefault gameObject;
[RequiredField]
public FsmFloat drag;
public bool everyFrame;
public override void Reset() {
gameObject = null;
drag = 1.0f;
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) ) {
isoRigidbody.drag = drag.Value;
}
}
}
} // IsoTools.PlayMaker.Actions
#endif

View File

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

View File

@@ -0,0 +1,36 @@
#if PLAYMAKER
using UnityEngine;
using HutongGames.PlayMaker;
using IsoTools.PlayMaker.Internal;
namespace IsoTools.PlayMaker.Actions {
[ActionCategory("IsoTools.Physics")]
[HutongGames.PlayMaker.Tooltip(
"Sets the IsKinematic of a IsoRigidbody.")]
public class IsoSetIsKinematic : IsoComponentAction<IsoRigidbody> {
[RequiredField]
[CheckForComponent(typeof(IsoRigidbody))]
public FsmOwnerDefault gameObject;
[RequiredField]
public FsmBool isKinematic;
public override void Reset() {
gameObject = null;
isKinematic = true;
}
public override void OnEnter() {
DoAction();
Finish();
}
void DoAction() {
var go = Fsm.GetOwnerDefaultTarget(gameObject);
if ( UpdateCache(go) ) {
isoRigidbody.isKinematic = isKinematic.Value;
}
}
}
} // IsoTools.PlayMaker.Actions
#endif

View File

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

View File

@@ -0,0 +1,45 @@
#if PLAYMAKER
using UnityEngine;
using HutongGames.PlayMaker;
using IsoTools.PlayMaker.Internal;
namespace IsoTools.PlayMaker.Actions {
[ActionCategory("IsoTools.Physics")]
[HutongGames.PlayMaker.Tooltip(
"Sets the Mass of a IsoRigidbody.")]
public class IsoSetMass : IsoComponentAction<IsoRigidbody> {
[RequiredField]
[CheckForComponent(typeof(IsoRigidbody))]
public FsmOwnerDefault gameObject;
[RequiredField]
public FsmFloat mass;
public bool everyFrame;
public override void Reset() {
gameObject = null;
mass = 1.0f;
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) ) {
isoRigidbody.mass = mass.Value;
}
}
}
} // IsoTools.PlayMaker.Actions
#endif

View File

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

View File

@@ -0,0 +1,39 @@
#if PLAYMAKER
using UnityEngine;
using HutongGames.PlayMaker;
using IsoTools.PlayMaker.Internal;
namespace IsoTools.PlayMaker.Actions {
[ActionCategory("IsoTools")]
[HutongGames.PlayMaker.Tooltip(
"Sets the Mode of a IsoObject.")]
public class IsoSetMode : IsoComponentAction<IsoObject> {
[RequiredField]
[CheckForComponent(typeof(IsoObject))]
[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() {
gameObject = null;
mode = IsoObject.Mode.Mode2d;
}
public override void OnEnter() {
DoAction();
Finish();
}
void DoAction() {
var go = Fsm.GetOwnerDefaultTarget(gameObject);
if ( UpdateCache(go) ) {
isoObject.mode = (IsoObject.Mode)mode.Value;
}
}
}
} // IsoTools.PlayMaker.Actions
#endif

View File

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

View File

@@ -0,0 +1,94 @@
#if PLAYMAKER
using UnityEngine;
using HutongGames.PlayMaker;
using IsoTools.PlayMaker.Internal;
namespace IsoTools.PlayMaker.Actions {
[ActionCategory("IsoTools")]
[HutongGames.PlayMaker.Tooltip(
"Sets the Position of a IsoObject. " +
"To leave any axis unchanged, set variable to 'None'.")]
public class IsoSetPosition : IsoComponentAction<IsoObject> {
[RequiredField]
[CheckForComponent(typeof(IsoObject))]
[HutongGames.PlayMaker.Tooltip("The IsoObject to position.")]
public FsmOwnerDefault gameObject;
[UIHint(UIHint.Variable)]
[HutongGames.PlayMaker.Tooltip(
"Use a stored Vector3 position, " +
"and/or set individual axis below.")]
public FsmVector3 vector;
public FsmFloat x;
public FsmFloat y;
public FsmFloat z;
[HutongGames.PlayMaker.Tooltip("Repeat every frame.")]
public bool everyFrame;
[HutongGames.PlayMaker.Tooltip("Perform in LateUpdate.")]
public bool lateUpdate;
[HutongGames.PlayMaker.Tooltip("Perform in FixedUpdate.")]
public bool fixedUpdate;
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;
fixedUpdate = false;
}
public override void OnPreprocess() {
Fsm.HandleFixedUpdate = true;
}
public override void OnEnter() {
if ( !everyFrame && !lateUpdate && !fixedUpdate ) {
DoAction();
Finish();
}
}
public override void OnUpdate() {
if ( !lateUpdate && !fixedUpdate ) {
DoAction();
}
}
public override void OnLateUpdate() {
if ( lateUpdate ) {
DoAction();
}
if ( !everyFrame ) {
Finish();
}
}
public override void OnFixedUpdate() {
if ( fixedUpdate ) {
DoAction();
}
if ( !everyFrame ) {
Finish();
}
}
void DoAction() {
var go = Fsm.GetOwnerDefaultTarget(gameObject);
if ( UpdateCache(go) ) {
var value = vector.IsNone ? isoObject.position : vector.Value;
if ( !x.IsNone ) { value.x = x.Value; }
if ( !y.IsNone ) { value.y = y.Value; }
if ( !z.IsNone ) { value.z = z.Value; }
isoObject.position = value;
}
}
}
} // IsoTools.PlayMaker.Actions
#endif

View File

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

View File

@@ -0,0 +1,94 @@
#if PLAYMAKER
using UnityEngine;
using HutongGames.PlayMaker;
using IsoTools.PlayMaker.Internal;
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 : IsoComponentAction<IsoObject> {
[RequiredField]
[CheckForComponent(typeof(IsoObject))]
[HutongGames.PlayMaker.Tooltip("The IsoObject to size.")]
public FsmOwnerDefault gameObject;
[UIHint(UIHint.Variable)]
[HutongGames.PlayMaker.Tooltip(
"Use a stored Vector3 size, " +
"and/or set individual axis below.")]
public FsmVector3 vector;
public FsmFloat x;
public FsmFloat y;
public FsmFloat z;
[HutongGames.PlayMaker.Tooltip("Repeat every frame.")]
public bool everyFrame;
[HutongGames.PlayMaker.Tooltip("Perform in LateUpdate.")]
public bool lateUpdate;
[HutongGames.PlayMaker.Tooltip("Perform in FixedUpdate.")]
public bool fixedUpdate;
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;
fixedUpdate = false;
}
public override void OnPreprocess() {
Fsm.HandleFixedUpdate = true;
}
public override void OnEnter() {
if ( !everyFrame && !lateUpdate && !fixedUpdate ) {
DoAction();
Finish();
}
}
public override void OnUpdate() {
if ( !lateUpdate && !fixedUpdate ) {
DoAction();
}
}
public override void OnLateUpdate() {
if ( lateUpdate ) {
DoAction();
}
if ( !everyFrame ) {
Finish();
}
}
public override void OnFixedUpdate() {
if ( fixedUpdate ) {
DoAction();
}
if ( !everyFrame ) {
Finish();
}
}
void DoAction() {
var go = Fsm.GetOwnerDefaultTarget(gameObject);
if ( UpdateCache(go) ) {
var value = vector.IsNone ? isoObject.size : vector.Value;
if ( !x.IsNone ) { value.x = x.Value; }
if ( !y.IsNone ) { value.y = y.Value; }
if ( !z.IsNone ) { value.z = z.Value; }
isoObject.size = value;
}
}
}
} // IsoTools.PlayMaker.Actions
#endif

View 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:

View File

@@ -0,0 +1,36 @@
#if PLAYMAKER
using UnityEngine;
using HutongGames.PlayMaker;
using IsoTools.PlayMaker.Internal;
namespace IsoTools.PlayMaker.Actions {
[ActionCategory("IsoTools.Physics")]
[HutongGames.PlayMaker.Tooltip(
"Sets the UseGravity of a IsoRigidbody.")]
public class IsoSetUseGravity : IsoComponentAction<IsoRigidbody> {
[RequiredField]
[CheckForComponent(typeof(IsoRigidbody))]
public FsmOwnerDefault gameObject;
[RequiredField]
public FsmBool useGravity;
public override void Reset() {
gameObject = null;
useGravity = true;
}
public override void OnEnter() {
DoAction();
Finish();
}
void DoAction() {
var go = Fsm.GetOwnerDefaultTarget(gameObject);
if ( UpdateCache(go) ) {
isoRigidbody.useGravity = useGravity.Value;
}
}
}
} // IsoTools.PlayMaker.Actions
#endif

View File

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

View File

@@ -0,0 +1,61 @@
#if PLAYMAKER
using UnityEngine;
using HutongGames.PlayMaker;
using IsoTools.PlayMaker.Internal;
namespace IsoTools.PlayMaker.Actions {
[ActionCategory("IsoTools.Physics")]
[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
#endif

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:

View File

@@ -0,0 +1,84 @@
#if PLAYMAKER
using UnityEngine;
using HutongGames.PlayMaker;
using IsoTools.PlayMaker.Internal;
namespace IsoTools.PlayMaker.Actions {
[ActionCategory("IsoTools")]
[HutongGames.PlayMaker.Tooltip(
"Sets an options of a IsoWorld.")]
public class IsoSetWorldProps : IsoComponentAction<IsoWorld> {
[RequiredField]
[CheckForComponent(typeof(IsoWorld))]
[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() {
gameObject = null;
tileSize = new FsmFloat{UseVariable = true};
tileRatio = new FsmFloat{UseVariable = true};
tileAngle = new FsmFloat{UseVariable = true};
tileHeight = new FsmFloat{UseVariable = true};
stepDepth = new FsmFloat{UseVariable = true};
startDepth = new FsmFloat{UseVariable = true};
}
public override string ErrorCheck() {
if ( !tileSize.IsNone && IsErrorVarClamp(tileSize.Value, IsoWorld.MinTileSize, IsoWorld.MaxTileSize) ) {
return ErrorVarClampMsg("TileSize", IsoWorld.MinTileSize, IsoWorld.MaxTileSize);
}
if ( !tileRatio.IsNone && IsErrorVarClamp(tileRatio.Value, 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);
}
if ( !tileHeight.IsNone && IsErrorVarClamp(tileHeight.Value, IsoWorld.MinTileHeight, IsoWorld.MaxTileHeight) ) {
return ErrorVarClampMsg("TileHeight", IsoWorld.MinTileHeight, IsoWorld.MaxTileHeight);
}
if ( !stepDepth.IsNone && IsErrorVarClamp(stepDepth.Value, IsoWorld.MinStepDepth, IsoWorld.MaxStepDepth) ) {
return ErrorVarClampMsg("StepDepth", IsoWorld.MinStepDepth, IsoWorld.MaxStepDepth);
}
if ( !startDepth.IsNone && IsErrorVarClamp(startDepth.Value, IsoWorld.MinStartDepth, IsoWorld.MaxStartDepth) ) {
return ErrorVarClampMsg("StartDepth", IsoWorld.MinStartDepth, IsoWorld.MaxStartDepth);
}
return "";
}
public override void OnEnter() {
DoAction();
Finish();
}
void DoAction() {
var go = Fsm.GetOwnerDefaultTarget(gameObject);
if ( UpdateCache(go) ) {
if ( !tileSize .IsNone ) { isoWorld.tileSize = tileSize .Value; }
if ( !tileRatio .IsNone ) { isoWorld.tileRatio = tileRatio .Value; }
if ( !tileAngle .IsNone ) { isoWorld.tileAngle = tileAngle .Value; }
if ( !tileHeight.IsNone ) { isoWorld.tileHeight = tileHeight.Value; }
if ( !stepDepth .IsNone ) { isoWorld.stepDepth = stepDepth .Value; }
if ( !startDepth.IsNone ) { isoWorld.startDepth = startDepth.Value; }
}
}
}
} // IsoTools.PlayMaker.Actions
#endif

View File

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

View File

@@ -0,0 +1,32 @@
#if PLAYMAKER
using UnityEngine;
using HutongGames.PlayMaker;
using IsoTools.PlayMaker.Internal;
namespace IsoTools.PlayMaker.Actions {
[ActionCategory("IsoTools.Physics")]
[HutongGames.PlayMaker.Tooltip(
"Force a IsoRigidbody to Sleep.")]
public class IsoSleep : IsoComponentAction<IsoRigidbody> {
[RequiredField]
[CheckForComponent(typeof(IsoRigidbody))]
public FsmOwnerDefault gameObject;
public override void Reset() {
gameObject = null;
}
public override void OnEnter() {
DoAction();
Finish();
}
void DoAction() {
var go = Fsm.GetOwnerDefaultTarget(gameObject);
if ( UpdateCache(go) ) {
isoRigidbody.Sleep();
}
}
}
} // IsoTools.PlayMaker.Actions
#endif

View File

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

View File

@@ -0,0 +1,107 @@
#if PLAYMAKER
using UnityEngine;
using HutongGames.PlayMaker;
using IsoTools.PlayMaker.Internal;
namespace IsoTools.PlayMaker.Actions {
[ActionCategory("IsoTools")]
[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 : 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")]
public bool perSecond;
[HutongGames.PlayMaker.Tooltip("Repeat every frame.")]
public bool everyFrame;
[HutongGames.PlayMaker.Tooltip("Perform the translate in LateUpdate.")]
public bool lateUpdate;
[HutongGames.PlayMaker.Tooltip("Perform the translate in FixedUpdate.")]
public bool fixedUpdate;
public override void Reset() {
gameObject = null;
vector = null;
x = new FsmFloat{UseVariable = true};
y = new FsmFloat{UseVariable = true};
z = new FsmFloat{UseVariable = true};
perSecond = true;
everyFrame = true;
lateUpdate = false;
fixedUpdate = false;
}
public override void OnPreprocess() {
Fsm.HandleFixedUpdate = true;
}
public override void OnEnter() {
if ( !everyFrame && !lateUpdate && !fixedUpdate ) {
DoAction();
Finish();
}
}
public override void OnUpdate() {
if ( !lateUpdate && !fixedUpdate ) {
DoAction();
}
}
public override void OnLateUpdate() {
if ( lateUpdate ) {
DoAction();
}
if ( !everyFrame ) {
Finish();
}
}
public override void OnFixedUpdate() {
if ( fixedUpdate ) {
DoAction();
}
if ( !everyFrame ) {
Finish();
}
}
void DoAction() {
var go = Fsm.GetOwnerDefaultTarget(gameObject);
if ( UpdateCache(go) ) {
var value = vector.IsNone ? Vector3.zero : vector.Value;
if ( !x.IsNone ) { value.x = x.Value; }
if ( !y.IsNone ) { value.y = y.Value; }
if ( !z.IsNone ) { value.z = z.Value; }
isoObject.position +=
perSecond ? value * Time.deltaTime : value;
}
}
}
} // IsoTools.PlayMaker.Actions
#endif

View File

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

View File

@@ -0,0 +1,32 @@
#if PLAYMAKER
using UnityEngine;
using HutongGames.PlayMaker;
using IsoTools.PlayMaker.Internal;
namespace IsoTools.PlayMaker.Actions {
[ActionCategory("IsoTools.Physics")]
[HutongGames.PlayMaker.Tooltip(
"Force a IsoRigidbody to WakeUp.")]
public class IsoWakeUp : IsoComponentAction<IsoRigidbody> {
[RequiredField]
[CheckForComponent(typeof(IsoRigidbody))]
public FsmOwnerDefault gameObject;
public override void Reset() {
gameObject = null;
}
public override void OnEnter() {
DoAction();
Finish();
}
void DoAction() {
var go = Fsm.GetOwnerDefaultTarget(gameObject);
if ( UpdateCache(go) ) {
isoRigidbody.WakeUp();
}
}
}
} // IsoTools.PlayMaker.Actions
#endif

View File

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

View File

@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: a4729de6bf87e4d60a76f269eb903bc6
folderAsset: yes
timeCreated: 1450606069
licenseType: Free
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,93 @@
#if PLAYMAKER
using UnityEngine;
using HutongGames.PlayMaker;
using IsoTools.PlayMaker.Internal;
namespace IsoTools.PlayMaker.Events {
public enum IsoCollisionType {
IsoCollisionEnter,
IsoCollisionExit
}
[ActionCategory("IsoTools.Physics")]
[HutongGames.PlayMaker.Tooltip(
"Detect physics collision events.")]
public class IsoCollisionEvent : IsoComponentAction<IsoObject> {
[RequiredField]
[CheckForComponent(typeof(IsoObject))]
[HutongGames.PlayMaker.Title("IsoObject (In)")]
public FsmOwnerDefault gameObject;
[RequiredField]
[HutongGames.PlayMaker.Title("Collision Type (In)")]
public IsoCollisionType collisionType;
[RequiredField]
[UIHint(UIHint.Tag)]
[HutongGames.PlayMaker.Title("Collide Tag (In)")]
public FsmString collideTag;
[HutongGames.PlayMaker.Title("Send Event (In)")]
public FsmEvent sendEvent;
[UIHint(UIHint.Variable)]
[HutongGames.PlayMaker.Title("Store Iso Collider (Out)")]
public FsmGameObject storeIsoCollider;
[UIHint(UIHint.Variable)]
[HutongGames.PlayMaker.Title("Store Force (Out)")]
public FsmFloat storeForce;
IsoFSMEvents isoFSMEvents = null;
public override void Reset() {
gameObject = null;
collisionType = IsoCollisionType.IsoCollisionEnter;
collideTag = "Untagged";
sendEvent = null;
storeIsoCollider = null;
storeForce = null;
}
public override void OnEnter() {
var go = Fsm.GetOwnerDefaultTarget(gameObject);
if ( go ) {
isoFSMEvents = go.AddComponent<IsoFSMEvents>();
isoFSMEvents.Init(this);
}
}
public override void OnExit() {
var go = Fsm.GetOwnerDefaultTarget(gameObject);
if ( go ) {
if ( isoFSMEvents ) {
GameObject.Destroy(isoFSMEvents);
isoFSMEvents = null;
}
}
}
public override void DoIsoCollisionEnter(IsoCollision collision) {
if ( collisionType == IsoCollisionType.IsoCollisionEnter ) {
DoAction(collision);
}
}
public override void DoIsoCollisionExit(IsoCollision collision) {
if ( collisionType == IsoCollisionType.IsoCollisionExit ) {
DoAction(collision);
}
}
void DoAction(IsoCollision collision) {
var go = Fsm.GetOwnerDefaultTarget(gameObject);
if ( UpdateCache(go) ) {
if ( collision.collider.gameObject.tag == collideTag.Value ) {
storeIsoCollider.Value = collision.collider.gameObject;
storeForce.Value = collision.relativeVelocity.magnitude;
Fsm.Event(sendEvent);
}
}
}
}
} // IsoTools.PlayMaker.Actions
#endif

View File

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

View File

@@ -0,0 +1,87 @@
#if PLAYMAKER
using UnityEngine;
using HutongGames.PlayMaker;
using IsoTools.PlayMaker.Internal;
namespace IsoTools.PlayMaker.Events {
public enum IsoTriggerType {
IsoTriggerEnter,
IsoTriggerExit
}
[ActionCategory("IsoTools.Physics")]
[HutongGames.PlayMaker.Tooltip(
"Detect physics trigger events.")]
public class IsoTriggerEvent : IsoComponentAction<IsoObject> {
[RequiredField]
[CheckForComponent(typeof(IsoObject))]
[HutongGames.PlayMaker.Title("IsoObject (In)")]
public FsmOwnerDefault gameObject;
[RequiredField]
[HutongGames.PlayMaker.Title("Trigger Type (In)")]
public IsoTriggerType triggerType;
[RequiredField]
[UIHint(UIHint.Tag)]
[HutongGames.PlayMaker.Title("Collide Tag (In)")]
public FsmString collideTag;
[HutongGames.PlayMaker.Title("Send Event (In)")]
public FsmEvent sendEvent;
[UIHint(UIHint.Variable)]
[HutongGames.PlayMaker.Title("Store Iso Collider (Out)")]
public FsmGameObject storeIsoCollider;
IsoFSMEvents isoFSMEvents = null;
public override void Reset() {
gameObject = null;
triggerType = IsoTriggerType.IsoTriggerEnter;
collideTag = "Untagged";
sendEvent = null;
storeIsoCollider = null;
}
public override void OnEnter() {
var go = Fsm.GetOwnerDefaultTarget(gameObject);
if ( go ) {
isoFSMEvents = go.AddComponent<IsoFSMEvents>();
isoFSMEvents.Init(this);
}
}
public override void OnExit() {
var go = Fsm.GetOwnerDefaultTarget(gameObject);
if ( go ) {
if ( isoFSMEvents ) {
GameObject.Destroy(isoFSMEvents);
isoFSMEvents = null;
}
}
}
public override void DoIsoTriggerEnter(IsoCollider collider) {
if ( triggerType == IsoTriggerType.IsoTriggerEnter ) {
DoAction(collider);
}
}
public override void DoIsoTriggerExit(IsoCollider collider) {
if ( triggerType == IsoTriggerType.IsoTriggerExit ) {
DoAction(collider);
}
}
void DoAction(IsoCollider collider) {
var go = Fsm.GetOwnerDefaultTarget(gameObject);
if ( UpdateCache(go) ) {
if ( collider.gameObject.tag == collideTag.Value ) {
storeIsoCollider.Value = collider.gameObject;
Fsm.Event(sendEvent);
}
}
}
}
} // IsoTools.PlayMaker.Actions
#endif

View File

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

View File

@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 97ae31775318b4db8ae3e82a85135302
folderAsset: yes
timeCreated: 1450605779
licenseType: Free
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,67 @@
#if PLAYMAKER
using UnityEngine;
using HutongGames.PlayMaker;
namespace IsoTools.PlayMaker.Internal {
public abstract class IsoComponentAction<T> : FsmStateAction where T : Component {
T _cachedComponent;
GameObject _cachedGameObject;
public virtual void DoIsoTriggerEnter(IsoCollider collider) {}
public virtual void DoIsoTriggerExit (IsoCollider collider) {}
public virtual void DoIsoCollisionEnter(IsoCollision collision) {}
public virtual void DoIsoCollisionExit (IsoCollision collision) {}
protected IsoWorld isoWorld {
get { return _cachedComponent as IsoWorld; }
}
protected IsoObject isoObject {
get { return _cachedComponent as IsoObject; }
}
protected IsoRigidbody isoRigidbody {
get { return _cachedComponent as IsoRigidbody; }
}
protected IsoCollider isoCollider {
get { return _cachedComponent as IsoCollider; }
}
protected IsoBoxCollider isoBoxCollider {
get { return _cachedComponent as IsoBoxCollider; }
}
protected IsoSphereCollider isoSphereCollider {
get { return _cachedComponent as IsoSphereCollider; }
}
protected bool UpdateCache(GameObject go) {
if ( go ) {
if ( _cachedComponent == null || _cachedGameObject != go ) {
_cachedComponent = go.GetComponent<T>();
_cachedGameObject = go;
if ( !_cachedComponent ) {
LogWarning("Missing component: " + typeof(T).FullName + " on: " + go.name);
}
}
} else {
_cachedComponent = null;
_cachedGameObject = null;
}
return _cachedComponent != null;
}
protected bool IsErrorVarClamp(float v, float min, float max) {
return v < min || v > max;
}
protected string ErrorVarClampMsg(string name, float min, float max) {
return string.Format(
"{0} must be greater than {1} and less than {2}",
name, min, max);
}
}
} // IsoTools.PlayMaker.Actions
#endif

View File

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

View File

@@ -0,0 +1,44 @@
#if PLAYMAKER
using UnityEngine;
using HutongGames.PlayMaker;
namespace IsoTools.PlayMaker.Internal {
public class IsoFSMEvents : MonoBehaviour {
IsoComponentAction<IsoObject> _action = null;
bool _started = false;
public void Init(IsoComponentAction<IsoObject> action) {
_action = action;
}
void Start() {
Debug.Assert(_action != null, "logic error", this);
_started = true;
}
void OnIsoTriggerEnter(IsoCollider collider) {
if ( _action != null && _started ) {
_action.DoIsoTriggerEnter(collider);
}
}
void OnIsoTriggerExit(IsoCollider collider) {
if ( _action != null && _started ) {
_action.DoIsoTriggerExit(collider);
}
}
void OnIsoCollisionEnter(IsoCollision collision) {
if ( _action != null && _started ) {
_action.DoIsoCollisionEnter(collision);
}
}
void OnIsoCollisionExit(IsoCollision collision) {
if ( _action != null && _started ) {
_action.DoIsoCollisionExit(collision);
}
}
}
}
#endif

View File

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

View File

@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 9cba32081dae94248987da65f874c467
folderAsset: yes
timeCreated: 1477130201
licenseType: Free
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 95500b2c162ee45889fff8e8de30bdc5
folderAsset: yes
timeCreated: 1453182058
licenseType: Free
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 9c2fbdd96ea4a4c8797c486bbc633541
folderAsset: yes
timeCreated: 1454257185
licenseType: Free
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 7b6bd76df16f04c1aadbdf1c8812c49a
timeCreated: 1461262024
licenseType: Free
NativeFormatImporter:
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

After

Width:  |  Height:  |  Size: 102 KiB

View File

@@ -0,0 +1,370 @@
fileFormatVersion: 2
guid: 221bc03dca62748f284639c0b399875b
timeCreated: 1477130208
licenseType: Free
TextureImporter:
fileIDToRecycleName:
21300000: isometric_grass_and_water_1
21300002: isometric_grass_and_water_2
21300004: isometric_grass_and_water_3
21300006: isometric_grass_and_water_4
21300008: isometric_grass_and_water_5
21300010: isometric_grass_and_water_6
21300012: isometric_grass_and_water_7
21300014: isometric_grass_and_water_8
21300016: isometric_grass_and_water_9
21300018: isometric_grass_and_water_10
21300020: isometric_grass_and_water_11
21300022: isometric_grass_and_water_12
21300024: isometric_grass_and_water_13
21300026: isometric_grass_and_water_14
21300028: isometric_grass_and_water_15
21300030: isometric_grass_and_water_16
21300032: isometric_grass_and_water_17
21300034: isometric_grass_and_water_18
21300036: isometric_grass_and_water_19
21300038: isometric_grass_and_water_20
21300040: isometric_grass_and_water_21
21300042: isometric_grass_and_water_22
21300044: isometric_grass_and_water_23
21300046: isometric_grass_and_water_24
serializedVersion: 2
mipmaps:
mipMapMode: 0
enableMipMap: 1
linearTexture: 0
correctGamma: 0
fadeOut: 0
borderMipMap: 0
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
grayScaleToAlpha: 0
generateCubemap: 0
cubemapConvolution: 0
cubemapConvolutionSteps: 7
cubemapConvolutionExponent: 1.5
seamlessCubemap: 0
textureFormat: -1
maxTextureSize: 2048
textureSettings:
filterMode: -1
aniso: 16
mipBias: -1
wrapMode: 1
nPOTScale: 0
lightmap: 0
rGBM: 0
compressionQuality: 50
allowsAlphaSplitting: 0
spriteMode: 2
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spritePixelsToUnits: 100
alphaIsTransparency: 1
textureType: 8
buildTargetSettings: []
spriteSheet:
serializedVersion: 2
sprites:
- serializedVersion: 2
name: isometric_grass_and_water_1
rect:
serializedVersion: 2
x: 0
y: 320
width: 64
height: 64
alignment: 0
pivot: {x: 0, y: 0}
border: {x: 0, y: 0, z: 0, w: 0}
outline: []
- serializedVersion: 2
name: isometric_grass_and_water_2
rect:
serializedVersion: 2
x: 64
y: 320
width: 64
height: 64
alignment: 0
pivot: {x: 0, y: 0}
border: {x: 0, y: 0, z: 0, w: 0}
outline: []
- serializedVersion: 2
name: isometric_grass_and_water_3
rect:
serializedVersion: 2
x: 128
y: 320
width: 64
height: 64
alignment: 0
pivot: {x: 0, y: 0}
border: {x: 0, y: 0, z: 0, w: 0}
outline: []
- serializedVersion: 2
name: isometric_grass_and_water_4
rect:
serializedVersion: 2
x: 192
y: 320
width: 64
height: 64
alignment: 0
pivot: {x: 0, y: 0}
border: {x: 0, y: 0, z: 0, w: 0}
outline: []
- serializedVersion: 2
name: isometric_grass_and_water_5
rect:
serializedVersion: 2
x: 0
y: 256
width: 64
height: 64
alignment: 0
pivot: {x: 0, y: 0}
border: {x: 0, y: 0, z: 0, w: 0}
outline: []
- serializedVersion: 2
name: isometric_grass_and_water_6
rect:
serializedVersion: 2
x: 64
y: 256
width: 64
height: 64
alignment: 0
pivot: {x: 0, y: 0}
border: {x: 0, y: 0, z: 0, w: 0}
outline: []
- serializedVersion: 2
name: isometric_grass_and_water_7
rect:
serializedVersion: 2
x: 128
y: 256
width: 64
height: 64
alignment: 0
pivot: {x: 0, y: 0}
border: {x: 0, y: 0, z: 0, w: 0}
outline: []
- serializedVersion: 2
name: isometric_grass_and_water_8
rect:
serializedVersion: 2
x: 192
y: 256
width: 64
height: 64
alignment: 0
pivot: {x: 0, y: 0}
border: {x: 0, y: 0, z: 0, w: 0}
outline: []
- serializedVersion: 2
name: isometric_grass_and_water_9
rect:
serializedVersion: 2
x: 0
y: 192
width: 64
height: 64
alignment: 0
pivot: {x: 0, y: 0}
border: {x: 0, y: 0, z: 0, w: 0}
outline: []
- serializedVersion: 2
name: isometric_grass_and_water_10
rect:
serializedVersion: 2
x: 64
y: 192
width: 64
height: 64
alignment: 0
pivot: {x: 0, y: 0}
border: {x: 0, y: 0, z: 0, w: 0}
outline: []
- serializedVersion: 2
name: isometric_grass_and_water_11
rect:
serializedVersion: 2
x: 128
y: 192
width: 64
height: 64
alignment: 0
pivot: {x: 0, y: 0}
border: {x: 0, y: 0, z: 0, w: 0}
outline: []
- serializedVersion: 2
name: isometric_grass_and_water_12
rect:
serializedVersion: 2
x: 192
y: 192
width: 64
height: 64
alignment: 0
pivot: {x: 0, y: 0}
border: {x: 0, y: 0, z: 0, w: 0}
outline: []
- serializedVersion: 2
name: isometric_grass_and_water_13
rect:
serializedVersion: 2
x: 0
y: 128
width: 64
height: 64
alignment: 0
pivot: {x: 0, y: 0}
border: {x: 0, y: 0, z: 0, w: 0}
outline: []
- serializedVersion: 2
name: isometric_grass_and_water_14
rect:
serializedVersion: 2
x: 64
y: 128
width: 64
height: 64
alignment: 0
pivot: {x: 0, y: 0}
border: {x: 0, y: 0, z: 0, w: 0}
outline: []
- serializedVersion: 2
name: isometric_grass_and_water_15
rect:
serializedVersion: 2
x: 128
y: 128
width: 64
height: 64
alignment: 0
pivot: {x: 0, y: 0}
border: {x: 0, y: 0, z: 0, w: 0}
outline: []
- serializedVersion: 2
name: isometric_grass_and_water_16
rect:
serializedVersion: 2
x: 192
y: 128
width: 64
height: 64
alignment: 0
pivot: {x: 0, y: 0}
border: {x: 0, y: 0, z: 0, w: 0}
outline: []
- serializedVersion: 2
name: isometric_grass_and_water_17
rect:
serializedVersion: 2
x: 0
y: 64
width: 64
height: 64
alignment: 0
pivot: {x: 0, y: 0}
border: {x: 0, y: 0, z: 0, w: 0}
outline: []
- serializedVersion: 2
name: isometric_grass_and_water_18
rect:
serializedVersion: 2
x: 64
y: 64
width: 64
height: 64
alignment: 0
pivot: {x: 0, y: 0}
border: {x: 0, y: 0, z: 0, w: 0}
outline: []
- serializedVersion: 2
name: isometric_grass_and_water_19
rect:
serializedVersion: 2
x: 128
y: 64
width: 64
height: 64
alignment: 0
pivot: {x: 0, y: 0}
border: {x: 0, y: 0, z: 0, w: 0}
outline: []
- serializedVersion: 2
name: isometric_grass_and_water_20
rect:
serializedVersion: 2
x: 192
y: 64
width: 64
height: 64
alignment: 0
pivot: {x: 0, y: 0}
border: {x: 0, y: 0, z: 0, w: 0}
outline: []
- serializedVersion: 2
name: isometric_grass_and_water_21
rect:
serializedVersion: 2
x: 0
y: 0
width: 64
height: 64
alignment: 0
pivot: {x: 0, y: 0}
border: {x: 0, y: 0, z: 0, w: 0}
outline: []
- serializedVersion: 2
name: isometric_grass_and_water_22
rect:
serializedVersion: 2
x: 64
y: 0
width: 64
height: 64
alignment: 0
pivot: {x: 0, y: 0}
border: {x: 0, y: 0, z: 0, w: 0}
outline: []
- serializedVersion: 2
name: isometric_grass_and_water_23
rect:
serializedVersion: 2
x: 128
y: 0
width: 64
height: 64
alignment: 0
pivot: {x: 0, y: 0}
border: {x: 0, y: 0, z: 0, w: 0}
outline: []
- serializedVersion: 2
name: isometric_grass_and_water_24
rect:
serializedVersion: 2
x: 192
y: 0
width: 64
height: 64
alignment: 0
pivot: {x: 0, y: 0}
border: {x: 0, y: 0, z: 0, w: 0}
outline: []
outline: []
spritePackingTag:
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 16b40ea9c34624e40bfb804614c5ae92
timeCreated: 1454257185
licenseType: Free
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 0727e91b8e19c4622b2fb287b71ec633
folderAsset: yes
timeCreated: 1454257201
licenseType: Free
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,370 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!29 &1
SceneSettings:
m_ObjectHideFlags: 0
m_PVSData:
m_PVSObjectsArray: []
m_PVSPortalsArray: []
m_OcclusionBakeSettings:
smallestOccluder: 5
smallestHole: 0.25
backfaceThreshold: 100
--- !u!104 &2
RenderSettings:
m_ObjectHideFlags: 0
serializedVersion: 6
m_Fog: 0
m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1}
m_FogMode: 3
m_FogDensity: 0.01
m_LinearFogStart: 0
m_LinearFogEnd: 300
m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1}
m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1}
m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1}
m_AmbientIntensity: 1
m_AmbientMode: 3
m_SkyboxMaterial: {fileID: 0}
m_HaloStrength: 0.5
m_FlareStrength: 1
m_FlareFadeSpeed: 3
m_HaloTexture: {fileID: 0}
m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0}
m_DefaultReflectionMode: 0
m_DefaultReflectionResolution: 128
m_ReflectionBounces: 1
m_ReflectionIntensity: 1
m_CustomReflection: {fileID: 0}
m_Sun: {fileID: 0}
--- !u!157 &3
LightmapSettings:
m_ObjectHideFlags: 0
serializedVersion: 6
m_GIWorkflowMode: 1
m_LightmapsMode: 1
m_GISettings:
serializedVersion: 2
m_BounceScale: 1
m_IndirectOutputScale: 1
m_AlbedoBoost: 1
m_TemporalCoherenceThreshold: 1
m_EnvironmentLightingMode: 0
m_EnableBakedLightmaps: 0
m_EnableRealtimeLightmaps: 0
m_LightmapEditorSettings:
serializedVersion: 3
m_Resolution: 2
m_BakeResolution: 40
m_TextureWidth: 1024
m_TextureHeight: 1024
m_AOMaxDistance: 1
m_Padding: 2
m_CompAOExponent: 0
m_LightmapParameters: {fileID: 0}
m_TextureCompression: 1
m_FinalGather: 0
m_FinalGatherRayCount: 1024
m_ReflectionCompression: 2
m_LightingDataAsset: {fileID: 0}
m_RuntimeCPUUsage: 25
--- !u!196 &4
NavMeshSettings:
serializedVersion: 2
m_ObjectHideFlags: 0
m_BuildSettings:
serializedVersion: 2
agentRadius: 0.5
agentHeight: 2
agentSlope: 45
agentClimb: 0.4
ledgeDropHeight: 0
maxJumpAcrossDistance: 0
accuratePlacement: 0
minRegionArea: 2
cellSize: 0.16666667
manualCellSize: 0
m_NavMeshData: {fileID: 0}
--- !u!1 &234184844
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 4
m_Component:
- 4: {fileID: 234184849}
- 20: {fileID: 234184848}
- 92: {fileID: 234184847}
- 124: {fileID: 234184846}
- 81: {fileID: 234184845}
- 114: {fileID: 234184850}
m_Layer: 0
m_Name: Main Camera
m_TagString: MainCamera
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!81 &234184845
AudioListener:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 234184844}
m_Enabled: 1
--- !u!124 &234184846
Behaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 234184844}
m_Enabled: 1
--- !u!92 &234184847
Behaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 234184844}
m_Enabled: 1
--- !u!20 &234184848
Camera:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 234184844}
m_Enabled: 1
serializedVersion: 2
m_ClearFlags: 1
m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0.019607844}
m_NormalizedViewPortRect:
serializedVersion: 2
x: 0
y: 0
width: 1
height: 1
near clip plane: -0.3
far clip plane: 1000
field of view: 60
orthographic: 1
orthographic size: 8.5
m_Depth: -1
m_CullingMask:
serializedVersion: 2
m_Bits: 4294967295
m_RenderingPath: -1
m_TargetTexture: {fileID: 0}
m_TargetDisplay: 0
m_TargetEye: 3
m_HDR: 0
m_OcclusionCulling: 1
m_StereoConvergence: 10
m_StereoSeparation: 0.022
m_StereoMirrorMode: 0
--- !u!4 &234184849
Transform:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 234184844}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 8, z: -10}
m_LocalScale: {x: 1, y: 1, z: 1}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 0
--- !u!114 &234184850
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 234184844}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 3f01619d3802e814f86f9e6bb965349a, type: 3}
m_Name:
m_EditorClassIdentifier:
_tileSize: 0.32
_tileRatio: 0.5
_tileAngle: 45
_tileHeight: 0.32
_stepDepth: 0.1
_startDepth: 1
--- !u!1 &893357292
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 4
m_Component:
- 4: {fileID: 893357293}
- 114: {fileID: 893357296}
- 33: {fileID: 893357295}
- 23: {fileID: 893357294}
m_Layer: 0
m_Name: isometric_grass_and_water
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &893357293
Transform:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 893357292}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_Children: []
m_Father: {fileID: 2118130509}
m_RootOrder: 0
--- !u!23 &893357294
MeshRenderer:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 893357292}
m_Enabled: 1
m_CastShadows: 0
m_ReceiveShadows: 0
m_Materials:
- {fileID: 2114272, guid: 7b6bd76df16f04c1aadbdf1c8812c49a, type: 2}
m_SubsetIndices:
m_StaticBatchRoot: {fileID: 0}
m_UseLightProbes: 0
m_ReflectionProbeUsage: 0
m_ProbeAnchor: {fileID: 0}
m_ScaleInLightmap: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingOrder: 0
--- !u!33 &893357295
MeshFilter:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 893357292}
m_Mesh: {fileID: 4317108, guid: 7b6bd76df16f04c1aadbdf1c8812c49a, type: 2}
--- !u!114 &893357296
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 893357292}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 771457a2414954117b1fbe3a1178f023, type: 3}
m_Name:
m_EditorClassIdentifier:
Asset: {fileID: 11400000, guid: 7b6bd76df16f04c1aadbdf1c8812c49a, type: 2}
--- !u!1 &1663641587
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 4
m_Component:
- 4: {fileID: 1663641590}
- 114: {fileID: 1663641589}
- 114: {fileID: 1663641588}
m_Layer: 0
m_Name: isometric_grass_and_water
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &1663641588
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1663641587}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 65223c9354c874240a67280485a6b300, type: 3}
m_Name:
m_EditorClassIdentifier:
Asset: {fileID: 11400000, guid: 7b6bd76df16f04c1aadbdf1c8812c49a, type: 2}
_isShowGrid: 0
--- !u!114 &1663641589
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1663641587}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 9a9c584f9a39449438abc7ba59a68778, type: 3}
m_Name:
m_EditorClassIdentifier:
_size: {x: 50, y: 50, z: 0}
_position: {x: 0, y: 0, z: 0}
_mode: 1
_cacheRenderers: 0
_isShowBounds: 0
--- !u!4 &1663641590
Transform:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1663641587}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 1}
m_LocalScale: {x: 1, y: 1, z: 1}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_Children:
- {fileID: 2118130509}
m_Father: {fileID: 0}
m_RootOrder: 1
--- !u!1 &2118130508
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 4
m_Component:
- 4: {fileID: 2118130509}
- 114: {fileID: 2118130510}
m_Layer: 0
m_Name: Tile Layer 1
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &2118130509
Transform:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 2118130508}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_Children:
- {fileID: 893357293}
m_Father: {fileID: 1663641590}
m_RootOrder: 0
--- !u!114 &2118130510
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 2118130508}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 2683a35aa9e5c4d7786be4a908523bbb, type: 3}
m_Name:
m_EditorClassIdentifier:
Asset: {fileID: 11400000, guid: 7b6bd76df16f04c1aadbdf1c8812c49a, type: 2}

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 384a2c7f237584c12accf98a1e3dccec
timeCreated: 1453400363
licenseType: Free
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 4af79c76da8fe4ee1b2a0cd711fb04a4
folderAsset: yes
timeCreated: 1453217672
licenseType: Free
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 9e14fd592ac9a4690a5b6a34edb31898
folderAsset: yes
timeCreated: 1453182090
licenseType: Free
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,131 @@
using UnityEngine;
using UnityEngine.Rendering;
using UnityEditor;
using IsoTools.Internal;
using System;
namespace IsoTools.Tiled.Internal {
[CustomEditor(typeof(TiledMapAsset))]
class TiledMapAssetEditor : Editor {
TiledMapAsset _asset = null;
// ------------------------------------------------------------------------
//
// Functions
//
// ------------------------------------------------------------------------
void CreateTiledMapOnScene() {
var map_go = new GameObject(_asset.Name);
try {
CreateTiledMap(map_go);
} catch ( Exception e ) {
Debug.LogErrorFormat("Create tiled map error: {0}", e.Message);
DestroyImmediate(map_go, true);
}
Undo.RegisterCreatedObjectUndo(map_go, "Create Tiled Map");
}
void CreateTiledMap(GameObject map_go) {
var map_data = _asset.Data;
var iso_object = map_go.AddComponent<IsoObject>();
iso_object.mode = IsoObject.Mode.Mode3d;
iso_object.position = Vector3.zero;
iso_object.size = IsoUtils.Vec3FromXY(map_data.Height, map_data.Width);
var tiled_map = map_go.AddComponent<TiledMap>();
tiled_map.Asset = _asset;
tiled_map.Properties = new TiledMapProperties(map_data.Properties);
for ( int i = map_data.Layers.Count - 1; i >= 0; --i ) {
CreateTiledLayer(tiled_map, i);
}
}
void CreateTiledLayer(TiledMap map, int layer_index) {
var layer_data = _asset.Data.Layers[layer_index];
var layer_go = new GameObject(layer_data.Name);
layer_go.transform.SetParent(map.transform, false);
layer_go.transform.localPosition = IsoUtils.Vec3FromXY(
layer_data.OffsetX / _asset.PixelsPerUnit,
-layer_data.OffsetY / _asset.PixelsPerUnit);
layer_go.transform.localPosition = IsoUtils.Vec3ChangeZ(
layer_go.transform.localPosition, - layer_index * _asset.LayersDepthStep);
layer_go.SetActive(layer_data.Visible);
var tiled_layer = layer_go.AddComponent<TiledMapLayer>();
tiled_layer.Asset = _asset;
tiled_layer.Properties = new TiledMapProperties(layer_data.Properties);
for ( int i = 0, e = _asset.Data.Tilesets.Count; i < e; ++i ) {
CreateTiledTileset(tiled_layer, layer_index, i);
}
}
void CreateTiledTileset(TiledMapLayer layer, int layer_index, int tileset_index) {
var tileset_data = _asset.Data.Tilesets[tileset_index];
var tileset_go = new GameObject(tileset_data.Name);
tileset_go.transform.SetParent(layer.transform, false);
var tiled_tileset = tileset_go.AddComponent<TiledMapTileset>();
tiled_tileset.Asset = _asset;
tiled_tileset.Properties = new TiledMapProperties(tileset_data.Properties);
CreateTiledTilesetMesh(tiled_tileset, tileset_index, layer_index);
}
void CreateTiledTilesetMesh(TiledMapTileset tileset, int tileset_index, int layer_index) {
var mesh_filter = tileset.gameObject.AddComponent<MeshFilter>();
mesh_filter.mesh = GetTilesetMesh(tileset_index, layer_index);
var mesh_renderer = tileset.gameObject.AddComponent<MeshRenderer>();
mesh_renderer.sharedMaterial = GetTilesetMaterial(tileset_index);
mesh_renderer.useLightProbes = false;
mesh_renderer.receiveShadows = false;
mesh_renderer.shadowCastingMode = ShadowCastingMode.Off;
mesh_renderer.reflectionProbeUsage = ReflectionProbeUsage.Off;
}
Mesh GetTilesetMesh(int tileset_index, int layer_index) {
var mesh_name = string.Format("mesh_{0}_{1}", tileset_index, layer_index);
var subassets = AssetDatabase.LoadAllAssetsAtPath(AssetDatabase.GetAssetPath(_asset));
foreach ( var subasset in subassets ) {
if ( subasset.name == mesh_name && subasset is Mesh ) {
return subasset as Mesh;
}
}
throw new UnityException(string.Format(
"not found tileset mesh ({0})",
mesh_name));
}
Material GetTilesetMaterial(int tileset_index) {
var material_name = string.Format("material_{0}", tileset_index);
var subassets = AssetDatabase.LoadAllAssetsAtPath(AssetDatabase.GetAssetPath(_asset));
foreach ( var subasset in subassets ) {
if ( subasset.name == material_name && subasset is Material ) {
return subasset as Material;
}
}
throw new UnityException(string.Format(
"not found tileset material ({0})",
material_name));
}
// ------------------------------------------------------------------------
//
// Messages
//
// ------------------------------------------------------------------------
void OnEnable() {
_asset = target as TiledMapAsset;
}
public override void OnInspectorGUI() {
DrawDefaultInspector();
if ( GUILayout.Button("Create tiled map on scene") ) {
CreateTiledMapOnScene();
}
}
}
}

View File

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

View File

@@ -0,0 +1,184 @@
using UnityEngine;
using UnityEditor;
using IsoTools.Internal;
using System;
using System.IO;
using System.Linq;
using System.Collections.Generic;
namespace IsoTools.Tiled.Internal {
public class TiledMapAssetPostprocessor : AssetPostprocessor {
static void OnPostprocessAllAssets(
string[] imported_assets, string[] deleted_assets,
string[] moved_assets, string[] moved_from_asset_paths)
{
var asset_paths = imported_assets
.Where(p => Path.GetExtension(p).ToLower().Equals(".asset"));
foreach ( var asset_path in asset_paths ) {
var asset = AssetDatabase.LoadAssetAtPath<TiledMapAsset>(asset_path);
if ( asset ) {
TiledMapAssetProcess(asset_path, asset);
}
}
}
static void TiledMapAssetProcess(string asset_path, TiledMapAsset asset) {
try {
GenerateLayerMeshes(asset);
} catch ( Exception e ) {
Debug.LogErrorFormat(
"Postprocess tiled map asset error: {0}",
e.Message);
AssetDatabase.DeleteAsset(asset_path);
AssetDatabase.SaveAssets();
}
}
static void GenerateLayerMeshes(TiledMapAsset asset) {
var dirty = false;
for ( int i = 0; i < asset.Data.Layers.Count; ++i ) {
for ( int j = 0; j < asset.Data.Tilesets.Count; ++j ) {
var mesh_name = string.Format("mesh_{0}_{1}", j, i);
if ( !HasSubAsset(asset, mesh_name) ) {
var mesh = GenerateTilesetMesh(asset, j, i);
mesh.name = mesh_name;
AssetDatabase.AddObjectToAsset(mesh, asset);
dirty = true;
}
}
}
for ( int j = 0; j < asset.Data.Tilesets.Count; ++j ) {
var material_name = string.Format("material_{0}", j);
if ( !HasSubAsset(asset, material_name) ) {
var material = GenerateTilesetMaterial(asset, j);
material.name = material_name;
AssetDatabase.AddObjectToAsset(material, asset);
dirty = true;
}
}
if ( dirty ) {
EditorUtility.SetDirty(asset);
AssetDatabase.SaveAssets();
}
}
static bool HasSubAsset(TiledMapAsset asset, string subasset_name) {
var subassets = AssetDatabase.LoadAllAssetsAtPath(
AssetDatabase.GetAssetPath(asset));
return subassets.Any(p => p.name == subasset_name);
}
static Mesh GenerateTilesetMesh(TiledMapAsset asset, int tileset_index, int layer_index) {
var vertices = new List<Vector3>();
var triangles = new List<int>();
var uvs = new List<Vector2>();
for ( var tile_y = 0; tile_y < asset.Data.Height; ++tile_y ) {
for ( var tile_x = 0; tile_x < asset.Data.Width; ++tile_x ) {
var tile_gid = asset.Data
.Layers[layer_index]
.Tiles[tile_y * asset.Data.Width + tile_x];
if ( tile_gid > 0 && CheckTileGidByTileset(asset, tile_gid, tileset_index) ) {
var tile_iso_pos = new Vector2(
-tile_y + asset.Data.Height - 1,
-tile_x + asset.Data.Width - 1);
var tile_screen_pos = TiledIsoToScreen(asset, tile_iso_pos);
var tile_sprite = GetTileSprite(asset, tile_gid, tileset_index);
var tile_width = tile_sprite.rect.width / asset.PixelsPerUnit;
var tile_height = tile_sprite.rect.height / asset.PixelsPerUnit;
var tileset_data = asset.Data.Tilesets[tileset_index];
var tileset_offset_x = tileset_data.TileOffsetX / asset.PixelsPerUnit;
var tileset_offset_y = (tileset_data.TileHeight * 0.5f - tileset_data.TileOffsetY) / asset.PixelsPerUnit;
var vertex_pos =
IsoUtils.Vec3FromVec2(tile_screen_pos) -
IsoUtils.Vec3FromXY(tile_width, tile_height) * 0.5f +
IsoUtils.Vec3FromXY(tileset_offset_x, tileset_offset_y);
vertices.Add(vertex_pos);
vertices.Add(vertex_pos + IsoUtils.Vec3FromX (tile_width));
vertices.Add(vertex_pos + IsoUtils.Vec3FromXY(tile_width, tile_height));
vertices.Add(vertex_pos + IsoUtils.Vec3FromY (tile_height));
triangles.Add(vertices.Count - 4 + 2);
triangles.Add(vertices.Count - 4 + 1);
triangles.Add(vertices.Count - 4 + 0);
triangles.Add(vertices.Count - 4 + 0);
triangles.Add(vertices.Count - 4 + 3);
triangles.Add(vertices.Count - 4 + 2);
var tex_size = new Vector2(tile_sprite.texture.width, tile_sprite.texture.height);
uvs.Add(new Vector2(tile_sprite.rect.xMin / tex_size.x, tile_sprite.rect.yMin / tex_size.y));
uvs.Add(new Vector2(tile_sprite.rect.xMax / tex_size.x, tile_sprite.rect.yMin / tex_size.y));
uvs.Add(new Vector2(tile_sprite.rect.xMax / tex_size.x, tile_sprite.rect.yMax / tex_size.y));
uvs.Add(new Vector2(tile_sprite.rect.xMin / tex_size.x, tile_sprite.rect.yMax / tex_size.y));
}
}
}
var mesh = new Mesh();
mesh.vertices = vertices.ToArray();
mesh.triangles = triangles.ToArray();
mesh.uv = uvs.ToArray();
mesh.RecalculateNormals();
return mesh;
}
static Material GenerateTilesetMaterial(TiledMapAsset asset, int tileset_index) {
var shader = Shader.Find("Sprites/Default");
if ( !shader ) {
throw new UnityException("'Sprites/Default' shader not found");
}
var material = new Material(shader);
material.SetTexture("_MainTex", GetTilesetTexture(asset, tileset_index));
return material;
}
static Vector2 TiledIsoToScreen(TiledMapAsset asset, Vector2 iso_pnt) {
return new Vector2(
(iso_pnt.x - iso_pnt.y) * asset.Data.TileWidth * 0.5f / asset.PixelsPerUnit,
(iso_pnt.x + iso_pnt.y) * asset.Data.TileHeight * 0.5f / asset.PixelsPerUnit);
}
static bool CheckTileGidByTileset(TiledMapAsset asset, int tile_gid, int tileset_index) {
var tileset_data = asset.Data.Tilesets[tileset_index];
return
tile_gid >= tileset_data.FirstGid &&
tile_gid < tileset_data.FirstGid + tileset_data.TileCount;
}
static Sprite GetTileSprite(TiledMapAsset asset, int tile_gid, int tileset_index) {
var tileset_data = asset.Data.Tilesets[tileset_index];
var tile_sprite_name = string.Format(
"{0}_{1}",
Path.GetFileNameWithoutExtension(tileset_data.ImageSource),
tile_gid);
var tileset_assets = AssetDatabase.LoadAllAssetsAtPath(Path.Combine(
Path.GetDirectoryName(AssetDatabase.GetAssetPath(asset)),
tileset_data.ImageSource));
var tile_sprite = tileset_assets
.Where(p => p is Sprite && p.name == tile_sprite_name)
.Select(p => p as Sprite)
.FirstOrDefault();
if ( !tile_sprite ) {
throw new UnityException(string.Format(
"sprite ({0}) for tile ({1}) not found",
tile_sprite_name, tile_gid));
}
return tile_sprite;
}
static Texture2D GetTilesetTexture(TiledMapAsset asset, int tileset_index) {
var tileset_data = asset.Data.Tilesets[tileset_index];
var tileset_texture_path = Path.Combine(
Path.GetDirectoryName(AssetDatabase.GetAssetPath(asset)),
tileset_data.ImageSource);
var texture = AssetDatabase.LoadAssetAtPath<Texture2D>(tileset_texture_path);
if ( !texture ) {
throw new UnityException(string.Format(
"texture ({0}) for tileset ({1}) not found",
tileset_texture_path, tileset_index));
}
return texture;
}
}
}

View File

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

View File

@@ -0,0 +1,20 @@
using UnityEngine;
using UnityEditor;
namespace IsoTools.Tiled.Internal {
[CustomEditor(typeof(TiledMap)), CanEditMultipleObjects]
class TiledMapMapEditor : Editor {
TiledMap _map = null;
void OnEnable() {
_map = target as TiledMap;
}
public override void OnInspectorGUI() {
DrawDefaultInspector();
if ( _map && _map.Properties != null ) {
_map.Properties.OnInspectorGUI("Map properties");
}
}
}
}

View File

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

View File

@@ -0,0 +1,20 @@
using UnityEngine;
using UnityEditor;
namespace IsoTools.Tiled.Internal {
[CustomEditor(typeof(TiledMapLayer)), CanEditMultipleObjects]
class TiledMapLayerEditor : Editor {
TiledMapLayer _layer = null;
void OnEnable() {
_layer = target as TiledMapLayer;
}
public override void OnInspectorGUI() {
DrawDefaultInspector();
if ( _layer && _layer.Properties != null ) {
_layer.Properties.OnInspectorGUI("Layer properties");
}
}
}
}

View File

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

Some files were not shown because too many files have changed in this diff Show More