diff --git a/Assets/Examples/iTween/iTween.unity b/Assets/Examples/iTween/iTween.unity index 3da43487..3ffd11f9 100644 --- a/Assets/Examples/iTween/iTween.unity +++ b/Assets/Examples/iTween/iTween.unity @@ -158,6 +158,145 @@ Transform: m_Children: [] m_Father: {fileID: 0} m_RootOrder: 0 +--- !u!1 &470391086 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 4: {fileID: 470391092} + - 212: {fileID: 470391091} + - 114: {fileID: 470391090} + - 114: {fileID: 470391089} + - 114: {fileID: 470391088} + - 114: {fileID: 470391087} + m_Layer: 0 + m_Name: Mushroom4 + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &470391087 +MonoBehaviour: + m_ObjectHideFlags: 2 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 470391086} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 598f181ee459641a9b0a5849fbc3240c, type: 3} + m_Name: + m_EditorClassIdentifier: + errorMessage: + indentLevel: 0 + targetObject: + targetType: 0 + otherGameObject: {fileID: 0} + tweenName: + duration: 3 + easeType: 2 + loopType: 2 + waitUntilFinished: 1 + offset: {x: 7, y: 0, z: 0} + space: 1 +--- !u!114 &470391088 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 470391086} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: d2f6487d21a03404cb21b245f0242e79, type: 3} + m_Name: + m_EditorClassIdentifier: + parentSequence: {fileID: 470391089} +--- !u!114 &470391089 +MonoBehaviour: + m_ObjectHideFlags: 2 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 470391086} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 3d3d73aef2cfc4f51abf34ac00241f60, type: 3} + m_Name: + m_EditorClassIdentifier: + nodeRect: + serializedVersion: 2 + x: 342 + y: 122 + width: 120 + height: 30 + sequenceName: Do Tween + eventHandler: {fileID: 470391088} + commandList: + - {fileID: 470391087} +--- !u!114 &470391090 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 470391086} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 7a334fe2ffb574b3583ff3b18b4792d3, type: 3} + m_Name: + m_EditorClassIdentifier: + scrollPos: {x: 0, y: 0} + variablesScrollPos: {x: 0, y: 0} + variablesExpanded: 1 + zoom: 1 + scrollViewRect: + serializedVersion: 2 + x: -350 + y: -350 + width: 1212 + height: 902 + selectedSequence: {fileID: 470391089} + selectedCommands: + - {fileID: 470391087} + variables: [] + runSlowInEditor: 1 + runSlowDuration: .25 + colorCommands: 1 + hideComponents: 1 +--- !u!212 &470391091 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 470391086} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_LightmapIndex: 255 + m_LightmapTilingOffset: {x: 1, y: 1, z: 0, w: 0} + m_Materials: + - {fileID: 10754, guid: 0000000000000000e000000000000000, type: 0} + m_SubsetIndices: + m_StaticBatchRoot: {fileID: 0} + m_UseLightProbes: 0 + m_LightProbeAnchor: {fileID: 0} + m_ScaleInLightmap: 1 + m_SortingLayerID: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: ea8f56c43254d41728f5ac4e8299b6c9, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} +--- !u!4 &470391092 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 470391086} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: -3.61409998, y: -1.94229996, z: 0} + m_LocalScale: {x: .456456065, y: .456456065, z: .456456065} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 5 --- !u!1 &497781871 GameObject: m_ObjectHideFlags: 0 @@ -200,7 +339,7 @@ Transform: m_LocalScale: {x: 1, y: 1, z: 1} m_Children: [] m_Father: {fileID: 0} - m_RootOrder: 5 + m_RootOrder: 6 --- !u!1 &868138990 GameObject: m_ObjectHideFlags: 0 @@ -253,7 +392,9 @@ MonoBehaviour: m_EditorClassIdentifier: errorMessage: indentLevel: 0 - target: {fileID: 1090256565} + targetObject: + targetType: 1 + otherGameObject: {fileID: 1090256565} tweenName: MoveIt duration: 1 easeType: 2 @@ -275,7 +416,7 @@ MonoBehaviour: m_EditorClassIdentifier: nodeRect: serializedVersion: 2 - x: 162 + x: 161 y: 214 width: 120 height: 30 @@ -324,7 +465,7 @@ MonoBehaviour: y: -350 width: 1050 height: 1284 - selectedSequence: {fileID: 868138992} + selectedSequence: {fileID: 0} selectedCommands: [] variables: [] runSlowInEditor: 1 @@ -374,7 +515,9 @@ MonoBehaviour: m_EditorClassIdentifier: errorMessage: indentLevel: 0 - target: {fileID: 1621124268} + targetObject: + targetType: 1 + otherGameObject: {fileID: 1621124268} tweenName: duration: 1 easeType: 2 @@ -396,7 +539,9 @@ MonoBehaviour: m_EditorClassIdentifier: errorMessage: indentLevel: 0 - target: {fileID: 1621124268} + targetObject: + targetType: 1 + otherGameObject: {fileID: 1621124268} tweenName: duration: .5 easeType: 2 @@ -416,7 +561,9 @@ MonoBehaviour: m_EditorClassIdentifier: errorMessage: indentLevel: 0 - target: {fileID: 1090256565} + targetObject: + targetType: 1 + otherGameObject: {fileID: 1090256565} tweenName: duration: .5 easeType: 2 @@ -437,13 +584,15 @@ MonoBehaviour: m_EditorClassIdentifier: errorMessage: indentLevel: 0 - target: {fileID: 1621124268} + targetObject: + targetType: 1 + otherGameObject: {fileID: 1621124268} tweenName: duration: 1 easeType: 2 loopType: 0 waitUntilFinished: 1 - toTransform: {fileID: 1090256567} + toTransform: {fileID: 1955612100} toRotation: {x: 0, y: 0, z: 0} isLocal: 0 --- !u!114 &868139000 @@ -459,7 +608,9 @@ MonoBehaviour: m_EditorClassIdentifier: errorMessage: indentLevel: 0 - target: {fileID: 1090256565} + targetObject: + targetType: 1 + otherGameObject: {fileID: 1955612099} tweenName: duration: 1 easeType: 2 @@ -481,7 +632,9 @@ MonoBehaviour: m_EditorClassIdentifier: errorMessage: indentLevel: 0 - target: {fileID: 1090256565} + targetObject: + targetType: 1 + otherGameObject: {fileID: 1621124268} tweenName: duration: 1 easeType: 2 @@ -502,7 +655,9 @@ MonoBehaviour: m_EditorClassIdentifier: errorMessage: indentLevel: 0 - target: {fileID: 1621124268} + targetObject: + targetType: 1 + otherGameObject: {fileID: 1090256565} tweenName: duration: 1 easeType: 2 @@ -523,7 +678,9 @@ MonoBehaviour: m_EditorClassIdentifier: errorMessage: indentLevel: 0 - target: {fileID: 1090256565} + targetObject: + targetType: 1 + otherGameObject: {fileID: 1955612099} tweenName: duration: 1 easeType: 2 @@ -544,7 +701,9 @@ MonoBehaviour: m_EditorClassIdentifier: errorMessage: indentLevel: 0 - target: {fileID: 1621124268} + targetObject: + targetType: 1 + otherGameObject: {fileID: 1621124268} tweenName: duration: 1 easeType: 2 @@ -566,7 +725,9 @@ MonoBehaviour: m_EditorClassIdentifier: errorMessage: indentLevel: 0 - target: {fileID: 1090256565} + targetObject: + targetType: 1 + otherGameObject: {fileID: 1090256565} tweenName: duration: 1 easeType: 2 @@ -588,13 +749,15 @@ MonoBehaviour: m_EditorClassIdentifier: errorMessage: indentLevel: 0 - target: {fileID: 1621124268} + targetObject: + targetType: 1 + otherGameObject: {fileID: 1955612099} tweenName: duration: 1 easeType: 2 loopType: 0 waitUntilFinished: 1 - fromTransform: {fileID: 1955612100} + fromTransform: {fileID: 1621124270} fromPosition: {x: 0, y: 0, z: 0} axis: 3 --- !u!114 &868139007 @@ -610,7 +773,9 @@ MonoBehaviour: m_EditorClassIdentifier: errorMessage: indentLevel: 0 - target: {fileID: 1090256565} + targetObject: + targetType: 1 + otherGameObject: {fileID: 1621124268} tweenName: duration: 1 easeType: 2 @@ -632,7 +797,9 @@ MonoBehaviour: m_EditorClassIdentifier: errorMessage: indentLevel: 0 - target: {fileID: 1090256565} + targetObject: + targetType: 1 + otherGameObject: {fileID: 1090256565} tweenName: duration: 1 easeType: 2 @@ -654,7 +821,9 @@ MonoBehaviour: m_EditorClassIdentifier: errorMessage: indentLevel: 0 - target: {fileID: 131346341} + targetObject: + targetType: 1 + otherGameObject: {fileID: 1621124268} tweenName: duration: 1 easeType: 2 @@ -675,7 +844,9 @@ MonoBehaviour: m_EditorClassIdentifier: errorMessage: indentLevel: 0 - target: {fileID: 1621124268} + targetObject: + targetType: 1 + otherGameObject: {fileID: 1955612099} tweenName: duration: 1 easeType: 2 @@ -695,7 +866,9 @@ MonoBehaviour: m_EditorClassIdentifier: errorMessage: indentLevel: 0 - target: {fileID: 1090256565} + targetObject: + targetType: 1 + otherGameObject: {fileID: 1090256565} tweenName: duration: 1 easeType: 2 @@ -716,7 +889,9 @@ MonoBehaviour: m_EditorClassIdentifier: errorMessage: indentLevel: 0 - target: {fileID: 1621124268} + targetObject: + targetType: 1 + otherGameObject: {fileID: 1621124268} tweenName: duration: 1 easeType: 2 @@ -737,7 +912,9 @@ MonoBehaviour: m_EditorClassIdentifier: errorMessage: indentLevel: 0 - target: {fileID: 1955612099} + targetObject: + targetType: 1 + otherGameObject: {fileID: 1955612099} tweenName: duration: 1 easeType: 2 @@ -757,7 +934,9 @@ MonoBehaviour: m_EditorClassIdentifier: errorMessage: indentLevel: 0 - target: {fileID: 1621124268} + targetObject: + targetType: 1 + otherGameObject: {fileID: 1090256565} tweenName: duration: 1 easeType: 2 @@ -865,7 +1044,7 @@ Prefab: objectReference: {fileID: 0} - target: {fileID: 400000, guid: e0d427add844a4d9faf970a3afa07583, type: 2} propertyPath: m_RootOrder - value: 5 + value: 6 objectReference: {fileID: 0} - target: {fileID: 11400000, guid: e0d427add844a4d9faf970a3afa07583, type: 2} propertyPath: viewSize @@ -1003,7 +1182,7 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 61dddfdc5e0e44ca298d8f46f7f5a915, type: 3} m_Name: m_EditorClassIdentifier: - selectedFungusScript: {fileID: 868138993} + selectedFungusScript: {fileID: 470391090} --- !u!4 &1971204865 Transform: m_ObjectHideFlags: 1 diff --git a/Assets/Fungus/FungusScript/Editor/TargetObjectDrawer.cs b/Assets/Fungus/FungusScript/Editor/TargetObjectDrawer.cs new file mode 100644 index 00000000..85895940 --- /dev/null +++ b/Assets/Fungus/FungusScript/Editor/TargetObjectDrawer.cs @@ -0,0 +1,50 @@ +using UnityEditor; +using UnityEditorInternal; +using UnityEngine; +using System; +using System.Collections; + +namespace Fungus +{ + + [CustomPropertyDrawer (typeof(TargetObject), true)] + public class TargetObjectDrawer : PropertyDrawer + { + public override void OnGUI (Rect position, SerializedProperty property, GUIContent label) + { + EditorGUI.BeginProperty(position, label, property); + + SerializedProperty targetTypeProp = property.FindPropertyRelative("targetType"); + SerializedProperty otherGameObjectProp = property.FindPropertyRelative("otherGameObject"); + + EditorGUI.PropertyField(position, targetTypeProp, new GUIContent("Game Object")); + + if (targetTypeProp.enumValueIndex == 0) + { + otherGameObjectProp.objectReferenceValue = null; + } + else + { + Rect objectFieldRect = position; + objectFieldRect.y += EditorGUIUtility.singleLineHeight; + objectFieldRect.height = EditorGUIUtility.singleLineHeight; + EditorGUI.PropertyField(objectFieldRect, otherGameObjectProp, new GUIContent(" ")); + } + + EditorGUI.EndProperty(); + } + + public override float GetPropertyHeight(SerializedProperty property, GUIContent label) + { + // Adjust property height if also showing an object reference field + float propHeight = base.GetPropertyHeight(property, label); + SerializedProperty targetTypeProp = property.FindPropertyRelative("targetType"); + if (targetTypeProp.enumValueIndex == 1) + { + return propHeight * 2; + } + return propHeight; + } + } + +} \ No newline at end of file diff --git a/Assets/Fungus/FungusScript/Editor/TargetObjectDrawer.cs.meta b/Assets/Fungus/FungusScript/Editor/TargetObjectDrawer.cs.meta new file mode 100644 index 00000000..4f99d31d --- /dev/null +++ b/Assets/Fungus/FungusScript/Editor/TargetObjectDrawer.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 88ec756e97d1b47d2bde7ef335130f58 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Assets/Fungus/FungusScript/Scripts/Command.cs b/Assets/Fungus/FungusScript/Scripts/Command.cs index 269a1965..2d2b6ddf 100644 --- a/Assets/Fungus/FungusScript/Scripts/Command.cs +++ b/Assets/Fungus/FungusScript/Scripts/Command.cs @@ -160,10 +160,39 @@ namespace Fungus return 0; } + /** + * Return the color for the command background in inspector. + */ public virtual Color GetButtonColor() { return Color.white; } + + /** + * Get the appropriate game object from a TargetObject. + * Returns the Fungus Script game object if the target type is Owner. + * Returns the specified other game object if the target type is Other. + */ + protected virtual GameObject ResolveTarget(TargetObject targetObject) + { + if (parentSequence == null) + { + return null; + } + + GameObject target = null; + if (targetObject.targetType == TargetObjectType.Owner) + { + target = parentSequence.GetFungusScript().gameObject; + } + else + { + target = targetObject.otherGameObject; + } + + return target; + } + } } \ No newline at end of file diff --git a/Assets/Fungus/FungusScript/Scripts/TargetObject.cs b/Assets/Fungus/FungusScript/Scripts/TargetObject.cs new file mode 100644 index 00000000..cba12490 --- /dev/null +++ b/Assets/Fungus/FungusScript/Scripts/TargetObject.cs @@ -0,0 +1,33 @@ +using UnityEngine; +using System.Collections; + +namespace Fungus +{ + public enum TargetObjectType + { + Owner, + Other + } + + [System.Serializable] + public class TargetObject + { + public TargetObjectType targetType; + public GameObject otherGameObject; + + public virtual string GetSummary() + { + if (targetType == TargetObjectType.Owner) + { + return "Owner"; + } + else if (otherGameObject != null) + { + return otherGameObject.name; + } + + return null; + } + } + +} \ No newline at end of file diff --git a/Assets/Fungus/FungusScript/Scripts/TargetObject.cs.meta b/Assets/Fungus/FungusScript/Scripts/TargetObject.cs.meta new file mode 100644 index 00000000..0f83032e --- /dev/null +++ b/Assets/Fungus/FungusScript/Scripts/TargetObject.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 1695c9a1c253c446ebb3379cdfa33596 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Assets/Fungus/iTween/Commands/LookFrom.cs b/Assets/Fungus/iTween/Commands/LookFrom.cs index 8cd3f2e3..ad5c64be 100644 --- a/Assets/Fungus/iTween/Commands/LookFrom.cs +++ b/Assets/Fungus/iTween/Commands/LookFrom.cs @@ -1,4 +1,4 @@ -using UnityEngine; +using UnityEngine; using System.Collections; namespace Fungus @@ -47,7 +47,7 @@ namespace Fungus tweenParams.Add("oncomplete", "OnComplete"); tweenParams.Add("oncompletetarget", gameObject); tweenParams.Add("oncompleteparams", this); - iTween.LookFrom(target, tweenParams); + iTween.LookFrom(ResolveTarget(targetObject), tweenParams); } } diff --git a/Assets/Fungus/iTween/Commands/LookTo.cs b/Assets/Fungus/iTween/Commands/LookTo.cs index fd0285ac..e2b56d38 100644 --- a/Assets/Fungus/iTween/Commands/LookTo.cs +++ b/Assets/Fungus/iTween/Commands/LookTo.cs @@ -1,4 +1,4 @@ -using UnityEngine; +using UnityEngine; using System.Collections; namespace Fungus @@ -47,7 +47,7 @@ namespace Fungus tweenParams.Add("oncomplete", "OnComplete"); tweenParams.Add("oncompletetarget", gameObject); tweenParams.Add("oncompleteparams", this); - iTween.LookTo(target, tweenParams); + iTween.LookTo(ResolveTarget(targetObject), tweenParams); } } diff --git a/Assets/Fungus/iTween/Commands/MoveAdd.cs b/Assets/Fungus/iTween/Commands/MoveAdd.cs index 835b26c7..39e02192 100644 --- a/Assets/Fungus/iTween/Commands/MoveAdd.cs +++ b/Assets/Fungus/iTween/Commands/MoveAdd.cs @@ -1,4 +1,4 @@ -using UnityEngine; +using UnityEngine; using System.Collections; namespace Fungus @@ -26,7 +26,7 @@ namespace Fungus tweenParams.Add("oncomplete", "OnComplete"); tweenParams.Add("oncompletetarget", gameObject); tweenParams.Add("oncompleteparams", this); - iTween.MoveAdd(target, tweenParams); + iTween.MoveAdd(ResolveTarget(targetObject), tweenParams); } } diff --git a/Assets/Fungus/iTween/Commands/MoveFrom.cs b/Assets/Fungus/iTween/Commands/MoveFrom.cs index 265f9881..8ea63203 100644 --- a/Assets/Fungus/iTween/Commands/MoveFrom.cs +++ b/Assets/Fungus/iTween/Commands/MoveFrom.cs @@ -1,4 +1,4 @@ -using UnityEngine; +using UnityEngine; using System.Collections; namespace Fungus @@ -36,7 +36,7 @@ namespace Fungus tweenParams.Add("oncomplete", "OnComplete"); tweenParams.Add("oncompletetarget", gameObject); tweenParams.Add("oncompleteparams", this); - iTween.MoveFrom(target, tweenParams); + iTween.MoveFrom(ResolveTarget(targetObject), tweenParams); } } diff --git a/Assets/Fungus/iTween/Commands/MoveTo.cs b/Assets/Fungus/iTween/Commands/MoveTo.cs index c2232ecc..97df8a7a 100644 --- a/Assets/Fungus/iTween/Commands/MoveTo.cs +++ b/Assets/Fungus/iTween/Commands/MoveTo.cs @@ -1,4 +1,4 @@ -using UnityEngine; +using UnityEngine; using System.Collections; namespace Fungus @@ -36,7 +36,7 @@ namespace Fungus tweenParams.Add("oncomplete", "OnComplete"); tweenParams.Add("oncompletetarget", gameObject); tweenParams.Add("oncompleteparams", this); - iTween.MoveTo(target, tweenParams); + iTween.MoveTo(ResolveTarget(targetObject), tweenParams); } } diff --git a/Assets/Fungus/iTween/Commands/PunchPosition.cs b/Assets/Fungus/iTween/Commands/PunchPosition.cs index ed68b137..5b50f8ff 100644 --- a/Assets/Fungus/iTween/Commands/PunchPosition.cs +++ b/Assets/Fungus/iTween/Commands/PunchPosition.cs @@ -1,4 +1,4 @@ -using UnityEngine; +using UnityEngine; using System.Collections; namespace Fungus @@ -26,7 +26,7 @@ namespace Fungus tweenParams.Add("oncomplete", "OnComplete"); tweenParams.Add("oncompletetarget", gameObject); tweenParams.Add("oncompleteparams", this); - iTween.PunchPosition(target, tweenParams); + iTween.PunchPosition(ResolveTarget(targetObject), tweenParams); } } diff --git a/Assets/Fungus/iTween/Commands/PunchRotation.cs b/Assets/Fungus/iTween/Commands/PunchRotation.cs index 1b35d335..73d537fb 100644 --- a/Assets/Fungus/iTween/Commands/PunchRotation.cs +++ b/Assets/Fungus/iTween/Commands/PunchRotation.cs @@ -1,4 +1,4 @@ -using UnityEngine; +using UnityEngine; using System.Collections; namespace Fungus @@ -26,7 +26,7 @@ namespace Fungus tweenParams.Add("oncomplete", "OnComplete"); tweenParams.Add("oncompletetarget", gameObject); tweenParams.Add("oncompleteparams", this); - iTween.PunchRotation(target, tweenParams); + iTween.PunchRotation(ResolveTarget(targetObject), tweenParams); } } diff --git a/Assets/Fungus/iTween/Commands/PunchScale.cs b/Assets/Fungus/iTween/Commands/PunchScale.cs index 49c6b45a..bb62e205 100644 --- a/Assets/Fungus/iTween/Commands/PunchScale.cs +++ b/Assets/Fungus/iTween/Commands/PunchScale.cs @@ -1,4 +1,4 @@ -using UnityEngine; +using UnityEngine; using System.Collections; namespace Fungus @@ -22,7 +22,7 @@ namespace Fungus tweenParams.Add("oncomplete", "OnComplete"); tweenParams.Add("oncompletetarget", gameObject); tweenParams.Add("oncompleteparams", this); - iTween.PunchScale(target, tweenParams); + iTween.PunchScale(ResolveTarget(targetObject), tweenParams); } } diff --git a/Assets/Fungus/iTween/Commands/RotateAdd.cs b/Assets/Fungus/iTween/Commands/RotateAdd.cs index 1c8a01e2..5ae2c275 100644 --- a/Assets/Fungus/iTween/Commands/RotateAdd.cs +++ b/Assets/Fungus/iTween/Commands/RotateAdd.cs @@ -1,4 +1,4 @@ -using UnityEngine; +using UnityEngine; using System.Collections; namespace Fungus @@ -26,7 +26,7 @@ namespace Fungus tweenParams.Add("oncomplete", "OnComplete"); tweenParams.Add("oncompletetarget", gameObject); tweenParams.Add("oncompleteparams", this); - iTween.RotateAdd(target, tweenParams); + iTween.RotateAdd(ResolveTarget(targetObject), tweenParams); } } diff --git a/Assets/Fungus/iTween/Commands/RotateFrom.cs b/Assets/Fungus/iTween/Commands/RotateFrom.cs index 3e7c4a93..613ed0a5 100644 --- a/Assets/Fungus/iTween/Commands/RotateFrom.cs +++ b/Assets/Fungus/iTween/Commands/RotateFrom.cs @@ -1,4 +1,4 @@ -using UnityEngine; +using UnityEngine; using System.Collections; namespace Fungus @@ -36,7 +36,7 @@ namespace Fungus tweenParams.Add("oncomplete", "OnComplete"); tweenParams.Add("oncompletetarget", gameObject); tweenParams.Add("oncompleteparams", this); - iTween.RotateFrom(target, tweenParams); + iTween.RotateFrom(ResolveTarget(targetObject), tweenParams); } } diff --git a/Assets/Fungus/iTween/Commands/RotateTo.cs b/Assets/Fungus/iTween/Commands/RotateTo.cs index aa4965a1..5d16d2b8 100644 --- a/Assets/Fungus/iTween/Commands/RotateTo.cs +++ b/Assets/Fungus/iTween/Commands/RotateTo.cs @@ -1,4 +1,4 @@ -using UnityEngine; +using UnityEngine; using System.Collections; namespace Fungus @@ -36,7 +36,7 @@ namespace Fungus tweenParams.Add("oncomplete", "OnComplete"); tweenParams.Add("oncompletetarget", gameObject); tweenParams.Add("oncompleteparams", this); - iTween.RotateTo(target, tweenParams); + iTween.RotateTo(ResolveTarget(targetObject), tweenParams); } } diff --git a/Assets/Fungus/iTween/Commands/ScaleAdd.cs b/Assets/Fungus/iTween/Commands/ScaleAdd.cs index d285d264..4513d0f2 100644 --- a/Assets/Fungus/iTween/Commands/ScaleAdd.cs +++ b/Assets/Fungus/iTween/Commands/ScaleAdd.cs @@ -1,4 +1,4 @@ -using UnityEngine; +using UnityEngine; using System.Collections; namespace Fungus @@ -22,7 +22,7 @@ namespace Fungus tweenParams.Add("oncomplete", "OnComplete"); tweenParams.Add("oncompletetarget", gameObject); tweenParams.Add("oncompleteparams", this); - iTween.ScaleAdd(target, tweenParams); + iTween.ScaleAdd(ResolveTarget(targetObject), tweenParams); } } diff --git a/Assets/Fungus/iTween/Commands/ScaleFrom.cs b/Assets/Fungus/iTween/Commands/ScaleFrom.cs index 8d2b891b..f7c44e9b 100644 --- a/Assets/Fungus/iTween/Commands/ScaleFrom.cs +++ b/Assets/Fungus/iTween/Commands/ScaleFrom.cs @@ -1,4 +1,4 @@ -using UnityEngine; +using UnityEngine; using System.Collections; namespace Fungus @@ -32,7 +32,7 @@ namespace Fungus tweenParams.Add("oncomplete", "OnComplete"); tweenParams.Add("oncompletetarget", gameObject); tweenParams.Add("oncompleteparams", this); - iTween.ScaleFrom(target, tweenParams); + iTween.ScaleFrom(ResolveTarget(targetObject), tweenParams); } } diff --git a/Assets/Fungus/iTween/Commands/ScaleTo.cs b/Assets/Fungus/iTween/Commands/ScaleTo.cs index 318df1a3..a2186a3d 100644 --- a/Assets/Fungus/iTween/Commands/ScaleTo.cs +++ b/Assets/Fungus/iTween/Commands/ScaleTo.cs @@ -1,4 +1,4 @@ -using UnityEngine; +using UnityEngine; using System.Collections; namespace Fungus @@ -32,7 +32,7 @@ namespace Fungus tweenParams.Add("oncomplete", "OnComplete"); tweenParams.Add("oncompletetarget", gameObject); tweenParams.Add("oncompleteparams", this); - iTween.ScaleTo(target, tweenParams); + iTween.ScaleTo(ResolveTarget(targetObject), tweenParams); } } diff --git a/Assets/Fungus/iTween/Commands/ShakePosition.cs b/Assets/Fungus/iTween/Commands/ShakePosition.cs index 763771c5..d7fb9b13 100644 --- a/Assets/Fungus/iTween/Commands/ShakePosition.cs +++ b/Assets/Fungus/iTween/Commands/ShakePosition.cs @@ -1,4 +1,4 @@ -using UnityEngine; +using UnityEngine; using System.Collections; namespace Fungus @@ -41,7 +41,7 @@ namespace Fungus tweenParams.Add("oncomplete", "OnComplete"); tweenParams.Add("oncompletetarget", gameObject); tweenParams.Add("oncompleteparams", this); - iTween.ShakePosition(target, tweenParams); + iTween.ShakePosition(ResolveTarget(targetObject), tweenParams); } } diff --git a/Assets/Fungus/iTween/Commands/ShakeRotation.cs b/Assets/Fungus/iTween/Commands/ShakeRotation.cs index c378d1cd..6124c4fb 100644 --- a/Assets/Fungus/iTween/Commands/ShakeRotation.cs +++ b/Assets/Fungus/iTween/Commands/ShakeRotation.cs @@ -1,4 +1,4 @@ -using UnityEngine; +using UnityEngine; using System.Collections; namespace Fungus @@ -26,7 +26,7 @@ namespace Fungus tweenParams.Add("oncomplete", "OnComplete"); tweenParams.Add("oncompletetarget", gameObject); tweenParams.Add("oncompleteparams", this); - iTween.ShakeRotation(target, tweenParams); + iTween.ShakeRotation(ResolveTarget(targetObject), tweenParams); } } diff --git a/Assets/Fungus/iTween/Commands/ShakeScale.cs b/Assets/Fungus/iTween/Commands/ShakeScale.cs index d9c9c82d..cd7f6430 100644 --- a/Assets/Fungus/iTween/Commands/ShakeScale.cs +++ b/Assets/Fungus/iTween/Commands/ShakeScale.cs @@ -1,4 +1,4 @@ -using UnityEngine; +using UnityEngine; using System.Collections; namespace Fungus @@ -22,7 +22,7 @@ namespace Fungus tweenParams.Add("oncomplete", "OnComplete"); tweenParams.Add("oncompletetarget", gameObject); tweenParams.Add("oncompleteparams", this); - iTween.ShakeScale(target, tweenParams); + iTween.ShakeScale(ResolveTarget(targetObject), tweenParams); } } diff --git a/Assets/Fungus/iTween/Commands/iTweenCommand.cs b/Assets/Fungus/iTween/Commands/iTweenCommand.cs index f8c91c3d..cd146051 100644 --- a/Assets/Fungus/iTween/Commands/iTweenCommand.cs +++ b/Assets/Fungus/iTween/Commands/iTweenCommand.cs @@ -14,7 +14,7 @@ namespace Fungus public abstract class iTweenCommand : Command { [Tooltip("Target game object to apply the Tween to")] - public GameObject target; + public TargetObject targetObject; [Tooltip("An individual name useful for stopping iTweens by name")] public string tweenName; @@ -33,6 +33,8 @@ namespace Fungus public override void OnEnter() { + GameObject target = ResolveTarget(targetObject); + if (target == null) { Continue(); @@ -64,12 +66,14 @@ namespace Fungus public override string GetSummary() { - if (target == null) + string targetSummary = targetObject.GetSummary(); + + if (targetSummary == null) { return "Error: No target object selected"; } - return target.gameObject.name + " over " + duration + " seconds"; + return targetSummary + " over " + duration + " seconds"; } public override Color GetButtonColor()