Browse Source

Reverted TargetObject property to just use GameObject instead

This feature was just adding more complexity in practice
master
chrisgregan 10 years ago
parent
commit
c66d306cf0
  1. 50
      Assets/Fungus/FungusScript/Editor/TargetObjectDrawer.cs
  2. 8
      Assets/Fungus/FungusScript/Editor/TargetObjectDrawer.cs.meta
  3. 26
      Assets/Fungus/FungusScript/Scripts/Command.cs
  4. 33
      Assets/Fungus/FungusScript/Scripts/TargetObject.cs
  5. 8
      Assets/Fungus/FungusScript/Scripts/TargetObject.cs.meta
  6. 2
      Assets/Fungus/iTween/Scripts/Commands/LookFrom.cs
  7. 2
      Assets/Fungus/iTween/Scripts/Commands/LookTo.cs
  8. 2
      Assets/Fungus/iTween/Scripts/Commands/MoveAdd.cs
  9. 2
      Assets/Fungus/iTween/Scripts/Commands/MoveFrom.cs
  10. 2
      Assets/Fungus/iTween/Scripts/Commands/MoveTo.cs
  11. 2
      Assets/Fungus/iTween/Scripts/Commands/PunchPosition.cs
  12. 2
      Assets/Fungus/iTween/Scripts/Commands/PunchRotation.cs
  13. 2
      Assets/Fungus/iTween/Scripts/Commands/PunchScale.cs
  14. 2
      Assets/Fungus/iTween/Scripts/Commands/RotateAdd.cs
  15. 2
      Assets/Fungus/iTween/Scripts/Commands/RotateFrom.cs
  16. 2
      Assets/Fungus/iTween/Scripts/Commands/RotateTo.cs
  17. 2
      Assets/Fungus/iTween/Scripts/Commands/ScaleAdd.cs
  18. 2
      Assets/Fungus/iTween/Scripts/Commands/ScaleFrom.cs
  19. 2
      Assets/Fungus/iTween/Scripts/Commands/ScaleTo.cs
  20. 2
      Assets/Fungus/iTween/Scripts/Commands/ShakePosition.cs
  21. 2
      Assets/Fungus/iTween/Scripts/Commands/ShakeRotation.cs
  22. 2
      Assets/Fungus/iTween/Scripts/Commands/ShakeScale.cs
  23. 10
      Assets/Fungus/iTween/Scripts/Commands/iTweenCommand.cs
  24. 104
      Assets/FungusExamples/iTween/iTween.unity

50
Assets/Fungus/FungusScript/Editor/TargetObjectDrawer.cs

@ -1,50 +0,0 @@
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", "Select either the owner game object or another object in the scene."));
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;
}
}
}

8
Assets/Fungus/FungusScript/Editor/TargetObjectDrawer.cs.meta

@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: 88ec756e97d1b47d2bde7ef335130f58
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:

26
Assets/Fungus/FungusScript/Scripts/Command.cs

@ -167,32 +167,6 @@ namespace Fungus
{
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;
}
}
}

33
Assets/Fungus/FungusScript/Scripts/TargetObject.cs

@ -1,33 +0,0 @@
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;
}
}
}

8
Assets/Fungus/FungusScript/Scripts/TargetObject.cs.meta

@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: 1695c9a1c253c446ebb3379cdfa33596
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:

2
Assets/Fungus/iTween/Scripts/Commands/LookFrom.cs

@ -47,7 +47,7 @@ namespace Fungus
tweenParams.Add("oncomplete", "OnComplete");
tweenParams.Add("oncompletetarget", gameObject);
tweenParams.Add("oncompleteparams", this);
iTween.LookFrom(ResolveTarget(targetObject), tweenParams);
iTween.LookFrom(targetObject, tweenParams);
}
}

2
Assets/Fungus/iTween/Scripts/Commands/LookTo.cs

@ -47,7 +47,7 @@ namespace Fungus
tweenParams.Add("oncomplete", "OnComplete");
tweenParams.Add("oncompletetarget", gameObject);
tweenParams.Add("oncompleteparams", this);
iTween.LookTo(ResolveTarget(targetObject), tweenParams);
iTween.LookTo(targetObject, tweenParams);
}
}

2
Assets/Fungus/iTween/Scripts/Commands/MoveAdd.cs

@ -26,7 +26,7 @@ namespace Fungus
tweenParams.Add("oncomplete", "OnComplete");
tweenParams.Add("oncompletetarget", gameObject);
tweenParams.Add("oncompleteparams", this);
iTween.MoveAdd(ResolveTarget(targetObject), tweenParams);
iTween.MoveAdd(targetObject, tweenParams);
}
}

2
Assets/Fungus/iTween/Scripts/Commands/MoveFrom.cs

@ -36,7 +36,7 @@ namespace Fungus
tweenParams.Add("oncomplete", "OnComplete");
tweenParams.Add("oncompletetarget", gameObject);
tweenParams.Add("oncompleteparams", this);
iTween.MoveFrom(ResolveTarget(targetObject), tweenParams);
iTween.MoveFrom(targetObject, tweenParams);
}
}

2
Assets/Fungus/iTween/Scripts/Commands/MoveTo.cs

@ -36,7 +36,7 @@ namespace Fungus
tweenParams.Add("oncomplete", "OnComplete");
tweenParams.Add("oncompletetarget", gameObject);
tweenParams.Add("oncompleteparams", this);
iTween.MoveTo(ResolveTarget(targetObject), tweenParams);
iTween.MoveTo(targetObject, tweenParams);
}
}

2
Assets/Fungus/iTween/Scripts/Commands/PunchPosition.cs

@ -26,7 +26,7 @@ namespace Fungus
tweenParams.Add("oncomplete", "OnComplete");
tweenParams.Add("oncompletetarget", gameObject);
tweenParams.Add("oncompleteparams", this);
iTween.PunchPosition(ResolveTarget(targetObject), tweenParams);
iTween.PunchPosition(targetObject, tweenParams);
}
}

2
Assets/Fungus/iTween/Scripts/Commands/PunchRotation.cs

@ -26,7 +26,7 @@ namespace Fungus
tweenParams.Add("oncomplete", "OnComplete");
tweenParams.Add("oncompletetarget", gameObject);
tweenParams.Add("oncompleteparams", this);
iTween.PunchRotation(ResolveTarget(targetObject), tweenParams);
iTween.PunchRotation(targetObject, tweenParams);
}
}

2
Assets/Fungus/iTween/Scripts/Commands/PunchScale.cs

@ -22,7 +22,7 @@ namespace Fungus
tweenParams.Add("oncomplete", "OnComplete");
tweenParams.Add("oncompletetarget", gameObject);
tweenParams.Add("oncompleteparams", this);
iTween.PunchScale(ResolveTarget(targetObject), tweenParams);
iTween.PunchScale(targetObject, tweenParams);
}
}

2
Assets/Fungus/iTween/Scripts/Commands/RotateAdd.cs

@ -26,7 +26,7 @@ namespace Fungus
tweenParams.Add("oncomplete", "OnComplete");
tweenParams.Add("oncompletetarget", gameObject);
tweenParams.Add("oncompleteparams", this);
iTween.RotateAdd(ResolveTarget(targetObject), tweenParams);
iTween.RotateAdd(targetObject, tweenParams);
}
}

2
Assets/Fungus/iTween/Scripts/Commands/RotateFrom.cs

@ -36,7 +36,7 @@ namespace Fungus
tweenParams.Add("oncomplete", "OnComplete");
tweenParams.Add("oncompletetarget", gameObject);
tweenParams.Add("oncompleteparams", this);
iTween.RotateFrom(ResolveTarget(targetObject), tweenParams);
iTween.RotateFrom(targetObject, tweenParams);
}
}

2
Assets/Fungus/iTween/Scripts/Commands/RotateTo.cs

@ -36,7 +36,7 @@ namespace Fungus
tweenParams.Add("oncomplete", "OnComplete");
tweenParams.Add("oncompletetarget", gameObject);
tweenParams.Add("oncompleteparams", this);
iTween.RotateTo(ResolveTarget(targetObject), tweenParams);
iTween.RotateTo(targetObject, tweenParams);
}
}

2
Assets/Fungus/iTween/Scripts/Commands/ScaleAdd.cs

@ -22,7 +22,7 @@ namespace Fungus
tweenParams.Add("oncomplete", "OnComplete");
tweenParams.Add("oncompletetarget", gameObject);
tweenParams.Add("oncompleteparams", this);
iTween.ScaleAdd(ResolveTarget(targetObject), tweenParams);
iTween.ScaleAdd(targetObject, tweenParams);
}
}

2
Assets/Fungus/iTween/Scripts/Commands/ScaleFrom.cs

@ -32,7 +32,7 @@ namespace Fungus
tweenParams.Add("oncomplete", "OnComplete");
tweenParams.Add("oncompletetarget", gameObject);
tweenParams.Add("oncompleteparams", this);
iTween.ScaleFrom(ResolveTarget(targetObject), tweenParams);
iTween.ScaleFrom(targetObject, tweenParams);
}
}

2
Assets/Fungus/iTween/Scripts/Commands/ScaleTo.cs

@ -32,7 +32,7 @@ namespace Fungus
tweenParams.Add("oncomplete", "OnComplete");
tweenParams.Add("oncompletetarget", gameObject);
tweenParams.Add("oncompleteparams", this);
iTween.ScaleTo(ResolveTarget(targetObject), tweenParams);
iTween.ScaleTo(targetObject, tweenParams);
}
}

2
Assets/Fungus/iTween/Scripts/Commands/ShakePosition.cs

@ -41,7 +41,7 @@ namespace Fungus
tweenParams.Add("oncomplete", "OnComplete");
tweenParams.Add("oncompletetarget", gameObject);
tweenParams.Add("oncompleteparams", this);
iTween.ShakePosition(ResolveTarget(targetObject), tweenParams);
iTween.ShakePosition(targetObject, tweenParams);
}
}

2
Assets/Fungus/iTween/Scripts/Commands/ShakeRotation.cs

@ -26,7 +26,7 @@ namespace Fungus
tweenParams.Add("oncomplete", "OnComplete");
tweenParams.Add("oncompletetarget", gameObject);
tweenParams.Add("oncompleteparams", this);
iTween.ShakeRotation(ResolveTarget(targetObject), tweenParams);
iTween.ShakeRotation(targetObject, tweenParams);
}
}

2
Assets/Fungus/iTween/Scripts/Commands/ShakeScale.cs

@ -22,7 +22,7 @@ namespace Fungus
tweenParams.Add("oncomplete", "OnComplete");
tweenParams.Add("oncompletetarget", gameObject);
tweenParams.Add("oncompleteparams", this);
iTween.ShakeScale(ResolveTarget(targetObject), tweenParams);
iTween.ShakeScale(targetObject, tweenParams);
}
}

10
Assets/Fungus/iTween/Scripts/Commands/iTweenCommand.cs

@ -14,7 +14,7 @@ namespace Fungus
public abstract class iTweenCommand : Command
{
[Tooltip("Target game object to apply the Tween to")]
public TargetObject targetObject = new TargetObject();
public GameObject targetObject;
[Tooltip("An individual name useful for stopping iTweens by name")]
public string tweenName;
@ -33,9 +33,7 @@ namespace Fungus
public override void OnEnter()
{
GameObject target = ResolveTarget(targetObject);
if (target == null)
if (targetObject == null)
{
Continue();
return;
@ -66,12 +64,12 @@ namespace Fungus
public override string GetSummary()
{
if (targetObject.targetType == TargetObjectType.Other && targetObject.otherGameObject == null)
if (targetObject == null)
{
return "Error: No target object selected";
}
return targetObject.GetSummary() + " over " + duration + " seconds";
return targetObject.name + " over " + duration + " seconds";
}
public override Color GetButtonColor()

104
Assets/FungusExamples/iTween/iTween.unity

@ -191,9 +191,7 @@ MonoBehaviour:
m_EditorClassIdentifier:
errorMessage:
indentLevel: 0
targetObject:
targetType: 0
otherGameObject: {fileID: 0}
targetObject: {fileID: 470391086}
tweenName:
duration: 3
easeType: 2
@ -232,6 +230,7 @@ MonoBehaviour:
width: 120
height: 30
sequenceName: Do Tween
runSlowInEditor: 1
eventHandler: {fileID: 470391088}
commandList:
- {fileID: 470391087}
@ -257,9 +256,10 @@ MonoBehaviour:
width: 1213
height: 902
selectedSequence: {fileID: 470391089}
selectedCommands: []
selectedCommands:
- {fileID: 470391087}
variables: []
runSlowInEditor: 1
description:
runSlowDuration: .25
colorCommands: 1
hideComponents: 1
@ -396,9 +396,7 @@ MonoBehaviour:
m_EditorClassIdentifier:
errorMessage:
indentLevel: 0
targetObject:
targetType: 1
otherGameObject: {fileID: 1090256565}
targetObject: {fileID: 1090256565}
tweenName: MoveIt
duration: 1
easeType: 2
@ -425,6 +423,7 @@ MonoBehaviour:
width: 120
height: 30
sequenceName: Test iTween
runSlowInEditor: 1
eventHandler: {fileID: 868139016}
commandList:
- {fileID: 868138995}
@ -471,9 +470,10 @@ MonoBehaviour:
width: 1213
height: 1284
selectedSequence: {fileID: 868138992}
selectedCommands: []
selectedCommands:
- {fileID: 868139014}
variables: []
runSlowInEditor: 1
description:
runSlowDuration: .25
colorCommands: 1
hideComponents: 1
@ -520,9 +520,7 @@ MonoBehaviour:
m_EditorClassIdentifier:
errorMessage:
indentLevel: 0
targetObject:
targetType: 1
otherGameObject: {fileID: 1621124268}
targetObject: {fileID: 1621124268}
tweenName:
duration: 1
easeType: 2
@ -544,9 +542,7 @@ MonoBehaviour:
m_EditorClassIdentifier:
errorMessage:
indentLevel: 0
targetObject:
targetType: 1
otherGameObject: {fileID: 1621124268}
targetObject: {fileID: 1621124268}
tweenName:
duration: .5
easeType: 2
@ -566,9 +562,7 @@ MonoBehaviour:
m_EditorClassIdentifier:
errorMessage:
indentLevel: 0
targetObject:
targetType: 1
otherGameObject: {fileID: 1090256565}
targetObject: {fileID: 1090256565}
tweenName:
duration: .5
easeType: 2
@ -589,15 +583,13 @@ MonoBehaviour:
m_EditorClassIdentifier:
errorMessage:
indentLevel: 0
targetObject:
targetType: 1
otherGameObject: {fileID: 1621124268}
targetObject: {fileID: 1621124268}
tweenName:
duration: 1
easeType: 2
loopType: 0
waitUntilFinished: 1
toTransform: {fileID: 1955612100}
toTransform: {fileID: 1090256567}
toRotation: {x: 0, y: 0, z: 0}
isLocal: 0
--- !u!114 &868139000
@ -613,9 +605,7 @@ MonoBehaviour:
m_EditorClassIdentifier:
errorMessage:
indentLevel: 0
targetObject:
targetType: 1
otherGameObject: {fileID: 1955612099}
targetObject: {fileID: 1090256565}
tweenName:
duration: 1
easeType: 2
@ -637,15 +627,13 @@ MonoBehaviour:
m_EditorClassIdentifier:
errorMessage:
indentLevel: 0
targetObject:
targetType: 1
otherGameObject: {fileID: 1621124268}
targetObject: {fileID: 1621124268}
tweenName:
duration: 1
easeType: 2
loopType: 0
waitUntilFinished: 1
toTransform: {fileID: 1621124270}
toTransform: {fileID: 1090256567}
toScale: {x: .5, y: .5, z: 0}
--- !u!114 &868139002
MonoBehaviour:
@ -660,9 +648,7 @@ MonoBehaviour:
m_EditorClassIdentifier:
errorMessage:
indentLevel: 0
targetObject:
targetType: 1
otherGameObject: {fileID: 1090256565}
targetObject: {fileID: 1090256565}
tweenName:
duration: 1
easeType: 2
@ -683,9 +669,7 @@ MonoBehaviour:
m_EditorClassIdentifier:
errorMessage:
indentLevel: 0
targetObject:
targetType: 1
otherGameObject: {fileID: 1955612099}
targetObject: {fileID: 1955612099}
tweenName:
duration: 1
easeType: 2
@ -706,9 +690,7 @@ MonoBehaviour:
m_EditorClassIdentifier:
errorMessage:
indentLevel: 0
targetObject:
targetType: 1
otherGameObject: {fileID: 1621124268}
targetObject: {fileID: 1621124268}
tweenName:
duration: 1
easeType: 2
@ -730,9 +712,7 @@ MonoBehaviour:
m_EditorClassIdentifier:
errorMessage:
indentLevel: 0
targetObject:
targetType: 1
otherGameObject: {fileID: 1090256565}
targetObject: {fileID: 1090256565}
tweenName:
duration: 1
easeType: 2
@ -754,15 +734,13 @@ MonoBehaviour:
m_EditorClassIdentifier:
errorMessage:
indentLevel: 0
targetObject:
targetType: 1
otherGameObject: {fileID: 1955612099}
targetObject: {fileID: 1621124268}
tweenName:
duration: 1
easeType: 2
loopType: 0
waitUntilFinished: 1
fromTransform: {fileID: 1621124270}
fromTransform: {fileID: 1090256567}
fromPosition: {x: 0, y: 0, z: 0}
axis: 3
--- !u!114 &868139007
@ -778,9 +756,7 @@ MonoBehaviour:
m_EditorClassIdentifier:
errorMessage:
indentLevel: 0
targetObject:
targetType: 1
otherGameObject: {fileID: 1621124268}
targetObject: {fileID: 1090256565}
tweenName:
duration: 1
easeType: 2
@ -802,9 +778,7 @@ MonoBehaviour:
m_EditorClassIdentifier:
errorMessage:
indentLevel: 0
targetObject:
targetType: 1
otherGameObject: {fileID: 1090256565}
targetObject: {fileID: 1090256565}
tweenName:
duration: 1
easeType: 2
@ -826,9 +800,7 @@ MonoBehaviour:
m_EditorClassIdentifier:
errorMessage:
indentLevel: 0
targetObject:
targetType: 1
otherGameObject: {fileID: 1621124268}
targetObject: {fileID: 1621124268}
tweenName:
duration: 1
easeType: 2
@ -849,9 +821,7 @@ MonoBehaviour:
m_EditorClassIdentifier:
errorMessage:
indentLevel: 0
targetObject:
targetType: 1
otherGameObject: {fileID: 1955612099}
targetObject: {fileID: 1955612099}
tweenName:
duration: 1
easeType: 2
@ -871,9 +841,7 @@ MonoBehaviour:
m_EditorClassIdentifier:
errorMessage:
indentLevel: 0
targetObject:
targetType: 1
otherGameObject: {fileID: 1090256565}
targetObject: {fileID: 1090256565}
tweenName:
duration: 1
easeType: 2
@ -894,9 +862,7 @@ MonoBehaviour:
m_EditorClassIdentifier:
errorMessage:
indentLevel: 0
targetObject:
targetType: 1
otherGameObject: {fileID: 1621124268}
targetObject: {fileID: 1621124268}
tweenName:
duration: 1
easeType: 2
@ -917,9 +883,7 @@ MonoBehaviour:
m_EditorClassIdentifier:
errorMessage:
indentLevel: 0
targetObject:
targetType: 1
otherGameObject: {fileID: 1955612099}
targetObject: {fileID: 1955612099}
tweenName:
duration: 1
easeType: 2
@ -939,15 +903,13 @@ MonoBehaviour:
m_EditorClassIdentifier:
errorMessage:
indentLevel: 0
targetObject:
targetType: 1
otherGameObject: {fileID: 1090256565}
targetObject: {fileID: 1955612099}
tweenName:
duration: 1
easeType: 2
loopType: 0
waitUntilFinished: 1
fromTransform: {fileID: 1955612100}
fromTransform: {fileID: 1090256567}
fromPosition: {x: 0, y: 0, z: 0}
axis: 3
--- !u!114 &868139015

Loading…
Cancel
Save