diff --git a/Assembly-CSharp.csproj b/Assembly-CSharp.csproj index 22a4008..1d719fe 100644 --- a/Assembly-CSharp.csproj +++ b/Assembly-CSharp.csproj @@ -51,6 +51,7 @@ + diff --git a/Assets/IsoTools/Examples/Scenes/Scene07.unity b/Assets/IsoTools/Examples/Scenes/Scene07.unity index 71402d4..7633b9e 100644 --- a/Assets/IsoTools/Examples/Scenes/Scene07.unity +++ b/Assets/IsoTools/Examples/Scenes/Scene07.unity @@ -85,6 +85,39 @@ NavMeshSettings: cellSize: 0.16666667 manualCellSize: 0 m_NavMeshData: {fileID: 0} +--- !u!1 &275865224 stripped +GameObject: + m_PrefabParentObject: {fileID: 153404, guid: d10e5320df9f84d4186bda0ba98db9ff, type: 2} + m_PrefabInternal: {fileID: 1818074318} +--- !u!114 &275865225 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 275865224} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: b256250c588ee4e4590a3e58eaa69b1d, type: 3} + m_Name: + m_EditorClassIdentifier: + _material: {fileID: 0} + _isTrigger: 0 + _size: {x: 3, y: 3, z: 0} + _offset: {x: 1.5, y: 1.5, z: 0} +--- !u!114 &275865226 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 275865224} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 4febe544112bb4678bdd59fa963c802d, type: 3} + m_Name: + m_EditorClassIdentifier: + _isKinematic: 1 + _interpolation: 0 + _collisionDetectionMode: 0 --- !u!1001 &426942029 Prefab: m_ObjectHideFlags: 0 @@ -140,6 +173,10 @@ Prefab: propertyPath: m_Name value: Floor_3x3 (2) objectReference: {fileID: 0} + - target: {fileID: 153404, guid: d10e5320df9f84d4186bda0ba98db9ff, type: 2} + propertyPath: m_TagString + value: Floor + objectReference: {fileID: 0} m_RemovedComponents: [] m_ParentPrefab: {fileID: 100100000, guid: d10e5320df9f84d4186bda0ba98db9ff, type: 2} m_IsPrefabParent: 0 @@ -281,6 +318,39 @@ Light: m_ShadowRadius: 0 m_ShadowAngle: 0 m_AreaSize: {x: 1, y: 1} +--- !u!1 &666120332 stripped +GameObject: + m_PrefabParentObject: {fileID: 153404, guid: d10e5320df9f84d4186bda0ba98db9ff, type: 2} + m_PrefabInternal: {fileID: 1408623929} +--- !u!114 &666120333 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 666120332} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: b256250c588ee4e4590a3e58eaa69b1d, type: 3} + m_Name: + m_EditorClassIdentifier: + _material: {fileID: 0} + _isTrigger: 0 + _size: {x: 3, y: 3, z: 0} + _offset: {x: 1.5, y: 1.5, z: 0} +--- !u!114 &666120334 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 666120332} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 4febe544112bb4678bdd59fa963c802d, type: 3} + m_Name: + m_EditorClassIdentifier: + _isKinematic: 1 + _interpolation: 0 + _collisionDetectionMode: 0 --- !u!1 &672353206 GameObject: m_ObjectHideFlags: 0 @@ -1334,7 +1404,7 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: _material: {fileID: 0} - _isTrigger: 1 + _isTrigger: 0 _size: {x: 1, y: 1, z: 1} _offset: {x: 0.5, y: 0.5, z: 0.5} --- !u!114 &672353212 @@ -1348,6 +1418,72 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 4febe544112bb4678bdd59fa963c802d, type: 3} m_Name: m_EditorClassIdentifier: + _isKinematic: 0 + _interpolation: 0 + _collisionDetectionMode: 0 +--- !u!1 &897069798 stripped +GameObject: + m_PrefabParentObject: {fileID: 153404, guid: d10e5320df9f84d4186bda0ba98db9ff, type: 2} + m_PrefabInternal: {fileID: 426942029} +--- !u!114 &897069799 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 897069798} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: b256250c588ee4e4590a3e58eaa69b1d, type: 3} + m_Name: + m_EditorClassIdentifier: + _material: {fileID: 0} + _isTrigger: 0 + _size: {x: 3, y: 3, z: 0} + _offset: {x: 1.5, y: 1.5, z: 0} +--- !u!114 &897069800 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 897069798} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 4febe544112bb4678bdd59fa963c802d, type: 3} + m_Name: + m_EditorClassIdentifier: + _isKinematic: 1 + _interpolation: 0 + _collisionDetectionMode: 0 +--- !u!1 &1086478991 stripped +GameObject: + m_PrefabParentObject: {fileID: 153404, guid: d10e5320df9f84d4186bda0ba98db9ff, type: 2} + m_PrefabInternal: {fileID: 1364277118} +--- !u!114 &1086478992 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1086478991} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: b256250c588ee4e4590a3e58eaa69b1d, type: 3} + m_Name: + m_EditorClassIdentifier: + _material: {fileID: 0} + _isTrigger: 0 + _size: {x: 3, y: 3, z: 0} + _offset: {x: 1.5, y: 1.5, z: 0} +--- !u!114 &1086478993 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1086478991} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 4febe544112bb4678bdd59fa963c802d, type: 3} + m_Name: + m_EditorClassIdentifier: _isKinematic: 1 _interpolation: 0 _collisionDetectionMode: 0 @@ -1406,6 +1542,10 @@ Prefab: propertyPath: m_Name value: Floor_3x3 (3) objectReference: {fileID: 0} + - target: {fileID: 153404, guid: d10e5320df9f84d4186bda0ba98db9ff, type: 2} + propertyPath: m_TagString + value: Floor + objectReference: {fileID: 0} m_RemovedComponents: [] m_ParentPrefab: {fileID: 100100000, guid: d10e5320df9f84d4186bda0ba98db9ff, type: 2} m_IsPrefabParent: 0 @@ -1460,6 +1600,10 @@ Prefab: propertyPath: _position.z value: 0 objectReference: {fileID: 0} + - target: {fileID: 153404, guid: d10e5320df9f84d4186bda0ba98db9ff, type: 2} + propertyPath: m_TagString + value: Floor + objectReference: {fileID: 0} m_RemovedComponents: [] m_ParentPrefab: {fileID: 100100000, guid: d10e5320df9f84d4186bda0ba98db9ff, type: 2} m_IsPrefabParent: 0 @@ -1495,7 +1639,7 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: _material: {fileID: 0} - _isTrigger: 1 + _isTrigger: 0 _size: {x: 1, y: 1, z: 1} _offset: {x: 0.5, y: 0.5, z: 0.5} --- !u!114 &1708422618 @@ -1591,14 +1735,22 @@ MonoBehaviour: actionData: actionNames: - IsoTools.PlayMaker.Events.IsoTriggerEvent + - IsoTools.PlayMaker.Events.IsoCollisionEvent customNames: - - actionEnabled: 01 - actionIsOpen: 01 - actionStartIndex: 00000000 - actionHashCodes: 8802cd00 + - + actionEnabled: 0101 + actionIsOpen: 0101 + actionStartIndex: 0000000005000000 + actionHashCodes: 8802cd006a86ae01 unityObjectParams: [] fsmGameObjectParams: + - useVariable: 1 + name: + tooltip: + showInInspector: 0 + networkSync: 0 + value: {fileID: 0} - useVariable: 1 name: tooltip: @@ -1606,6 +1758,14 @@ MonoBehaviour: networkSync: 0 value: {fileID: 0} fsmOwnerDefaultParams: + - ownerOption: 0 + gameObject: + useVariable: 0 + name: + tooltip: + showInInspector: 0 + networkSync: 0 + value: {fileID: 0} - ownerOption: 0 gameObject: useVariable: 0 @@ -1621,6 +1781,12 @@ MonoBehaviour: fsmPropertyParams: [] layoutOptionParams: [] fsmStringParams: + - useVariable: 0 + name: + tooltip: + showInInspector: 0 + networkSync: 0 + value: Untagged - useVariable: 0 name: tooltip: @@ -1631,7 +1797,13 @@ MonoBehaviour: fsmVarParams: [] fsmArrayParams: [] fsmEnumParams: [] - fsmFloatParams: [] + fsmFloatParams: + - useVariable: 1 + name: + tooltip: + showInInspector: 0 + networkSync: 0 + value: 0 fsmIntParams: [] fsmBoolParams: [] fsmVector2Params: [] @@ -1641,20 +1813,27 @@ MonoBehaviour: fsmQuaternionParams: [] stringParams: - TO_UP - byteData: 00000000 + - TO_UP + byteData: 0000000000000000 arrayParamSizes: arrayParamTypes: [] customTypeSizes: customTypeNames: [] - paramDataType: 1400000007000000120000001700000013000000 + paramDataType: 140000000700000012000000170000001300000014000000070000001200000017000000130000000f000000 paramName: - gameObject - triggerType - collideTag - sendEvent - storeIsoCollider - paramDataPos: 0000000000000000000000000000000000000000 - paramByteDataSize: 0000000004000000000000000000000000000000 + - gameObject + - collisionType + - collideTag + - sendEvent + - storeIsoCollider + - storeForce + paramDataPos: 0000000000000000000000000000000000000000010000000400000001000000010000000100000000000000 + paramByteDataSize: 0000000004000000000000000000000000000000000000000400000000000000000000000000000000000000 - name: up description: colorIndex: 0 @@ -1678,13 +1857,13 @@ MonoBehaviour: colorIndex: 0 actionData: actionNames: - - IsoTools.PlayMaker.Actions.IsoTranslate + - IsoTools.PlayMaker.Actions.IsoAddForce customNames: - actionEnabled: 01 actionIsOpen: 01 actionStartIndex: 00000000 - actionHashCodes: 8ef87600 + actionHashCodes: febdb401 unityObjectParams: [] fsmGameObjectParams: [] fsmOwnerDefaultParams: @@ -1725,11 +1904,17 @@ MonoBehaviour: tooltip: showInInspector: 0 networkSync: 0 - value: 0.2 + value: 13 fsmIntParams: [] fsmBoolParams: [] fsmVector2Params: [] fsmVector3Params: + - useVariable: 1 + name: + tooltip: + showInInspector: 0 + networkSync: 0 + value: {x: 0, y: 0, z: 0} - useVariable: 1 name: tooltip: @@ -1740,24 +1925,24 @@ MonoBehaviour: fsmRectParams: [] fsmQuaternionParams: [] stringParams: [] - byteData: 00000000 + byteData: 000000000100000000 arrayParamSizes: arrayParamTypes: [] customTypeSizes: customTypeNames: [] - paramDataType: 140000001c0000000f0000000f0000000f00000001000000010000000100000001000000 + paramDataType: 140000001c0000001c0000000f0000000f0000000f000000070000000700000001000000 paramName: - gameObject + - atPosition - vector - x - y - z - - perSecond + - space + - forceMode - everyFrame - - lateUpdate - - fixedUpdate - paramDataPos: 000000000000000000000000010000000200000000000000010000000200000003000000 - paramByteDataSize: 000000000000000000000000000000000000000001000000010000000100000001000000 + paramDataPos: 000000000000000001000000000000000100000002000000000000000400000008000000 + paramByteDataSize: 000000000000000000000000000000000000000000000000040000000400000001000000 events: - name: FINISHED isSystemEvent: 1 @@ -1829,7 +2014,7 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 4febe544112bb4678bdd59fa963c802d, type: 3} m_Name: m_EditorClassIdentifier: - _isKinematic: 1 + _isKinematic: 0 _interpolation: 0 _collisionDetectionMode: 0 --- !u!1 &1761473855 @@ -1934,6 +2119,10 @@ Prefab: propertyPath: m_Name value: Floor_3x3 (1) objectReference: {fileID: 0} + - target: {fileID: 153404, guid: d10e5320df9f84d4186bda0ba98db9ff, type: 2} + propertyPath: m_TagString + value: Floor + objectReference: {fileID: 0} m_RemovedComponents: [] m_ParentPrefab: {fileID: 100100000, guid: d10e5320df9f84d4186bda0ba98db9ff, type: 2} m_IsPrefabParent: 0 diff --git a/Assets/IsoTools/PlayMaker/Actions/IsoAddForce.cs b/Assets/IsoTools/PlayMaker/Actions/IsoAddForce.cs new file mode 100644 index 0000000..4244398 --- /dev/null +++ b/Assets/IsoTools/PlayMaker/Actions/IsoAddForce.cs @@ -0,0 +1,99 @@ +using UnityEngine; +using HutongGames.PlayMaker; +using IsoTools.PlayMaker.Internal; + +namespace IsoTools.PlayMaker.Actions { + [ActionCategory("IsoTools")] + [HutongGames.PlayMaker.Tooltip( + "Adds a force to a IsoRigidbody. " + + "Use Vector3 variable and/or Float variables for each axis.")] + public class IsoAddForce : IsoComponentAction { + [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 \ No newline at end of file diff --git a/Assets/IsoTools/PlayMaker/Actions/IsoAddForce.cs.meta b/Assets/IsoTools/PlayMaker/Actions/IsoAddForce.cs.meta new file mode 100644 index 0000000..798aeaf --- /dev/null +++ b/Assets/IsoTools/PlayMaker/Actions/IsoAddForce.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: f982e9e34e40d48b4a0645425b0d6c3a +timeCreated: 1450614193 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/ProjectSettings/TagManager.asset b/ProjectSettings/TagManager.asset index e903991..67b3fc1 100644 --- a/ProjectSettings/TagManager.asset +++ b/ProjectSettings/TagManager.asset @@ -2,42 +2,43 @@ %TAG !u! tag:unity3d.com,2011: --- !u!78 &1 TagManager: + serializedVersion: 2 tags: + - Floor + layers: + - Default + - TransparentFX + - Ignore Raycast + - + - Water + - UI + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - - Builtin Layer 0: Default - Builtin Layer 1: TransparentFX - Builtin Layer 2: Ignore Raycast - Builtin Layer 3: - Builtin Layer 4: Water - Builtin Layer 5: UI - Builtin Layer 6: - Builtin Layer 7: - User Layer 8: - User Layer 9: - User Layer 10: - User Layer 11: - User Layer 12: - User Layer 13: - User Layer 14: - User Layer 15: - User Layer 16: - User Layer 17: - User Layer 18: - User Layer 19: - User Layer 20: - User Layer 21: - User Layer 22: - User Layer 23: - User Layer 24: - User Layer 25: - User Layer 26: - User Layer 27: - User Layer 28: - User Layer 29: - User Layer 30: - User Layer 31: m_SortingLayers: - name: Default - userID: 0 uniqueID: 0 locked: 0