Browse Source

iTweenCommand.targetObject now uses GameObjectData

master
chrisgregan 9 years ago
parent
commit
8dfd156866
  1. 2
      Assets/Fungus/iTween/Scripts/Commands/LookFrom.cs
  2. 2
      Assets/Fungus/iTween/Scripts/Commands/LookTo.cs
  3. 2
      Assets/Fungus/iTween/Scripts/Commands/MoveAdd.cs
  4. 2
      Assets/Fungus/iTween/Scripts/Commands/MoveFrom.cs
  5. 2
      Assets/Fungus/iTween/Scripts/Commands/MoveTo.cs
  6. 2
      Assets/Fungus/iTween/Scripts/Commands/PunchPosition.cs
  7. 2
      Assets/Fungus/iTween/Scripts/Commands/PunchRotation.cs
  8. 2
      Assets/Fungus/iTween/Scripts/Commands/PunchScale.cs
  9. 2
      Assets/Fungus/iTween/Scripts/Commands/RotateAdd.cs
  10. 2
      Assets/Fungus/iTween/Scripts/Commands/RotateFrom.cs
  11. 2
      Assets/Fungus/iTween/Scripts/Commands/RotateTo.cs
  12. 2
      Assets/Fungus/iTween/Scripts/Commands/ScaleAdd.cs
  13. 2
      Assets/Fungus/iTween/Scripts/Commands/ScaleFrom.cs
  14. 2
      Assets/Fungus/iTween/Scripts/Commands/ScaleTo.cs
  15. 2
      Assets/Fungus/iTween/Scripts/Commands/ShakePosition.cs
  16. 2
      Assets/Fungus/iTween/Scripts/Commands/ShakeRotation.cs
  17. 2
      Assets/Fungus/iTween/Scripts/Commands/ShakeScale.cs
  18. 32
      Assets/Fungus/iTween/Scripts/Commands/iTweenCommand.cs

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

@ -48,7 +48,7 @@ namespace Fungus
tweenParams.Add("oncomplete", "OniTweenComplete"); tweenParams.Add("oncomplete", "OniTweenComplete");
tweenParams.Add("oncompletetarget", gameObject); tweenParams.Add("oncompletetarget", gameObject);
tweenParams.Add("oncompleteparams", this); tweenParams.Add("oncompleteparams", this);
iTween.LookFrom(targetObject, tweenParams); iTween.LookFrom(_targetObject.Value, tweenParams);
} }
} }

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

@ -48,7 +48,7 @@ namespace Fungus
tweenParams.Add("oncomplete", "OniTweenComplete"); tweenParams.Add("oncomplete", "OniTweenComplete");
tweenParams.Add("oncompletetarget", gameObject); tweenParams.Add("oncompletetarget", gameObject);
tweenParams.Add("oncompleteparams", this); tweenParams.Add("oncompleteparams", this);
iTween.LookTo(targetObject, tweenParams); iTween.LookTo(_targetObject.Value, tweenParams);
} }
} }

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

@ -27,7 +27,7 @@ namespace Fungus
tweenParams.Add("oncomplete", "OniTweenComplete"); tweenParams.Add("oncomplete", "OniTweenComplete");
tweenParams.Add("oncompletetarget", gameObject); tweenParams.Add("oncompletetarget", gameObject);
tweenParams.Add("oncompleteparams", this); tweenParams.Add("oncompleteparams", this);
iTween.MoveAdd(targetObject, tweenParams); iTween.MoveAdd(_targetObject.Value, tweenParams);
} }
} }

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

@ -37,7 +37,7 @@ namespace Fungus
tweenParams.Add("oncomplete", "OniTweenComplete"); tweenParams.Add("oncomplete", "OniTweenComplete");
tweenParams.Add("oncompletetarget", gameObject); tweenParams.Add("oncompletetarget", gameObject);
tweenParams.Add("oncompleteparams", this); tweenParams.Add("oncompleteparams", this);
iTween.MoveFrom(targetObject, tweenParams); iTween.MoveFrom(_targetObject.Value, tweenParams);
} }
} }

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

@ -37,7 +37,7 @@ namespace Fungus
tweenParams.Add("oncomplete", "OniTweenComplete"); tweenParams.Add("oncomplete", "OniTweenComplete");
tweenParams.Add("oncompletetarget", gameObject); tweenParams.Add("oncompletetarget", gameObject);
tweenParams.Add("oncompleteparams", this); tweenParams.Add("oncompleteparams", this);
iTween.MoveTo(targetObject, tweenParams); iTween.MoveTo(_targetObject.Value, tweenParams);
} }
} }

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

@ -27,7 +27,7 @@ namespace Fungus
tweenParams.Add("oncomplete", "OniTweenComplete"); tweenParams.Add("oncomplete", "OniTweenComplete");
tweenParams.Add("oncompletetarget", gameObject); tweenParams.Add("oncompletetarget", gameObject);
tweenParams.Add("oncompleteparams", this); tweenParams.Add("oncompleteparams", this);
iTween.PunchPosition(targetObject, tweenParams); iTween.PunchPosition(_targetObject.Value, tweenParams);
} }
} }

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

@ -27,7 +27,7 @@ namespace Fungus
tweenParams.Add("oncomplete", "OniTweenComplete"); tweenParams.Add("oncomplete", "OniTweenComplete");
tweenParams.Add("oncompletetarget", gameObject); tweenParams.Add("oncompletetarget", gameObject);
tweenParams.Add("oncompleteparams", this); tweenParams.Add("oncompleteparams", this);
iTween.PunchRotation(targetObject, tweenParams); iTween.PunchRotation(_targetObject.Value, tweenParams);
} }
} }

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

@ -23,7 +23,7 @@ namespace Fungus
tweenParams.Add("oncomplete", "OniTweenComplete"); tweenParams.Add("oncomplete", "OniTweenComplete");
tweenParams.Add("oncompletetarget", gameObject); tweenParams.Add("oncompletetarget", gameObject);
tweenParams.Add("oncompleteparams", this); tweenParams.Add("oncompleteparams", this);
iTween.PunchScale(targetObject, tweenParams); iTween.PunchScale(_targetObject.Value, tweenParams);
} }
} }

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

@ -27,7 +27,7 @@ namespace Fungus
tweenParams.Add("oncomplete", "OniTweenComplete"); tweenParams.Add("oncomplete", "OniTweenComplete");
tweenParams.Add("oncompletetarget", gameObject); tweenParams.Add("oncompletetarget", gameObject);
tweenParams.Add("oncompleteparams", this); tweenParams.Add("oncompleteparams", this);
iTween.RotateAdd(targetObject, tweenParams); iTween.RotateAdd(_targetObject.Value, tweenParams);
} }
} }

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

@ -37,7 +37,7 @@ namespace Fungus
tweenParams.Add("oncomplete", "OniTweenComplete"); tweenParams.Add("oncomplete", "OniTweenComplete");
tweenParams.Add("oncompletetarget", gameObject); tweenParams.Add("oncompletetarget", gameObject);
tweenParams.Add("oncompleteparams", this); tweenParams.Add("oncompleteparams", this);
iTween.RotateFrom(targetObject, tweenParams); iTween.RotateFrom(_targetObject.Value, tweenParams);
} }
} }

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

@ -37,7 +37,7 @@ namespace Fungus
tweenParams.Add("oncomplete", "OniTweenComplete"); tweenParams.Add("oncomplete", "OniTweenComplete");
tweenParams.Add("oncompletetarget", gameObject); tweenParams.Add("oncompletetarget", gameObject);
tweenParams.Add("oncompleteparams", this); tweenParams.Add("oncompleteparams", this);
iTween.RotateTo(targetObject, tweenParams); iTween.RotateTo(_targetObject.Value, tweenParams);
} }
} }

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

@ -23,7 +23,7 @@ namespace Fungus
tweenParams.Add("oncomplete", "OniTweenComplete"); tweenParams.Add("oncomplete", "OniTweenComplete");
tweenParams.Add("oncompletetarget", gameObject); tweenParams.Add("oncompletetarget", gameObject);
tweenParams.Add("oncompleteparams", this); tweenParams.Add("oncompleteparams", this);
iTween.ScaleAdd(targetObject, tweenParams); iTween.ScaleAdd(_targetObject.Value, tweenParams);
} }
} }

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

@ -33,7 +33,7 @@ namespace Fungus
tweenParams.Add("oncomplete", "OniTweenComplete"); tweenParams.Add("oncomplete", "OniTweenComplete");
tweenParams.Add("oncompletetarget", gameObject); tweenParams.Add("oncompletetarget", gameObject);
tweenParams.Add("oncompleteparams", this); tweenParams.Add("oncompleteparams", this);
iTween.ScaleFrom(targetObject, tweenParams); iTween.ScaleFrom(_targetObject.Value, tweenParams);
} }
} }

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

@ -33,7 +33,7 @@ namespace Fungus
tweenParams.Add("oncomplete", "OniTweenComplete"); tweenParams.Add("oncomplete", "OniTweenComplete");
tweenParams.Add("oncompletetarget", gameObject); tweenParams.Add("oncompletetarget", gameObject);
tweenParams.Add("oncompleteparams", this); tweenParams.Add("oncompleteparams", this);
iTween.ScaleTo(targetObject, tweenParams); iTween.ScaleTo(_targetObject.Value, tweenParams);
} }
} }

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

@ -42,7 +42,7 @@ namespace Fungus
tweenParams.Add("oncomplete", "OniTweenComplete"); tweenParams.Add("oncomplete", "OniTweenComplete");
tweenParams.Add("oncompletetarget", gameObject); tweenParams.Add("oncompletetarget", gameObject);
tweenParams.Add("oncompleteparams", this); tweenParams.Add("oncompleteparams", this);
iTween.ShakePosition(targetObject, tweenParams); iTween.ShakePosition(_targetObject.Value, tweenParams);
} }
} }

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

@ -27,7 +27,7 @@ namespace Fungus
tweenParams.Add("oncomplete", "OniTweenComplete"); tweenParams.Add("oncomplete", "OniTweenComplete");
tweenParams.Add("oncompletetarget", gameObject); tweenParams.Add("oncompletetarget", gameObject);
tweenParams.Add("oncompleteparams", this); tweenParams.Add("oncompleteparams", this);
iTween.ShakeRotation(targetObject, tweenParams); iTween.ShakeRotation(_targetObject.Value, tweenParams);
} }
} }

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

@ -23,7 +23,7 @@ namespace Fungus
tweenParams.Add("oncomplete", "OniTweenComplete"); tweenParams.Add("oncomplete", "OniTweenComplete");
tweenParams.Add("oncompletetarget", gameObject); tweenParams.Add("oncompletetarget", gameObject);
tweenParams.Add("oncompleteparams", this); tweenParams.Add("oncompleteparams", this);
iTween.ShakeScale(targetObject, tweenParams); iTween.ShakeScale(_targetObject.Value, tweenParams);
} }
} }

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

@ -4,6 +4,7 @@ using UnityEngine.Serialization;
namespace Fungus namespace Fungus
{ {
public enum iTweenAxis public enum iTweenAxis
{ {
None, None,
@ -12,12 +13,16 @@ namespace Fungus
Z Z
} }
public abstract class iTweenCommand : Command public abstract class iTweenCommand : Command, IUpdateable
{ {
[Tooltip("Target game object to apply the Tween to")] // Obsolete: Use _targetObject instead.
[HideInInspector]
[FormerlySerializedAs("target")] [FormerlySerializedAs("target")]
public GameObject targetObject; public GameObject targetObject;
[Tooltip("Target game object to apply the Tween to")]
public GameObjectData _targetObject;
[Tooltip("An individual name useful for stopping iTweens by name")] [Tooltip("An individual name useful for stopping iTweens by name")]
public string tweenName; public string tweenName;
@ -38,7 +43,7 @@ namespace Fungus
public override void OnEnter() public override void OnEnter()
{ {
if (targetObject == null) if (_targetObject.Value == null)
{ {
Continue(); Continue();
return; return;
@ -47,7 +52,7 @@ namespace Fungus
if (stopPreviousTweens) if (stopPreviousTweens)
{ {
// Force any existing iTweens on this target object to complete immediately // Force any existing iTweens on this target object to complete immediately
iTween[] tweens = targetObject.GetComponents<iTween>(); iTween[] tweens = _targetObject.Value.GetComponents<iTween>();
foreach (iTween tween in tweens) { foreach (iTween tween in tweens) {
tween.time = 0; tween.time = 0;
tween.SendMessage("Update"); tween.SendMessage("Update");
@ -79,18 +84,33 @@ namespace Fungus
public override string GetSummary() public override string GetSummary()
{ {
if (targetObject == null) if (_targetObject.Value == null)
{ {
return "Error: No target object selected"; return "Error: No target object selected";
} }
return targetObject.name + " over " + duration + " seconds"; return _targetObject.Value.name + " over " + duration + " seconds";
} }
public override Color GetButtonColor() public override Color GetButtonColor()
{ {
return new Color32(233, 163, 180, 255); return new Color32(233, 163, 180, 255);
} }
//
// IUpdateable implementation
//
public virtual void UpdateToVersion(int oldVersion, int newVersion)
{
if (oldVersion == 0 &&
targetObject != null)
{
_targetObject.gameObjectVal = targetObject;
_targetObject.gameObjectRef = null;
targetObject = null;
}
}
} }
} }
Loading…
Cancel
Save