Browse Source

iTween duration can be a variable

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

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

@ -48,7 +48,7 @@ namespace Fungus
tweenParams.Add("axis", "z");
break;
}
tweenParams.Add("time", duration);
tweenParams.Add("time", _duration.Value);
tweenParams.Add("easetype", easeType);
tweenParams.Add("looptype", loopType);
tweenParams.Add("oncomplete", "OniTweenComplete");
@ -61,11 +61,13 @@ namespace Fungus
// ISerializationCallbackReceiver implementation
//
public void OnBeforeSerialize()
public override void OnBeforeSerialize()
{}
public void OnAfterDeserialize()
public override void OnAfterDeserialize()
{
base.OnAfterDeserialize();
if (fromTransformOLD != null)
{
_fromTransform.Value = fromTransformOLD;

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

@ -48,7 +48,7 @@ namespace Fungus
tweenParams.Add("axis", "z");
break;
}
tweenParams.Add("time", duration);
tweenParams.Add("time", _duration.Value);
tweenParams.Add("easetype", easeType);
tweenParams.Add("looptype", loopType);
tweenParams.Add("oncomplete", "OniTweenComplete");
@ -61,11 +61,13 @@ namespace Fungus
// ISerializationCallbackReceiver implementation
//
public void OnBeforeSerialize()
public override void OnBeforeSerialize()
{}
public void OnAfterDeserialize()
public override void OnAfterDeserialize()
{
base.OnAfterDeserialize();
if (toTransformOLD != null)
{
_toTransform.Value = toTransformOLD;

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

@ -26,7 +26,7 @@ namespace Fungus
tweenParams.Add("name", _tweenName.Value);
tweenParams.Add("amount", _offset.Value);
tweenParams.Add("space", space);
tweenParams.Add("time", duration);
tweenParams.Add("time", _duration.Value);
tweenParams.Add("easetype", easeType);
tweenParams.Add("looptype", loopType);
tweenParams.Add("oncomplete", "OniTweenComplete");
@ -39,11 +39,13 @@ namespace Fungus
// ISerializationCallbackReceiver implementation
//
public void OnBeforeSerialize()
public override void OnBeforeSerialize()
{}
public void OnAfterDeserialize()
public override void OnAfterDeserialize()
{
base.OnAfterDeserialize();
if (offsetOLD != default(Vector3))
{
_offset.Value = offsetOLD;

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

@ -36,7 +36,7 @@ namespace Fungus
{
tweenParams.Add("position", _fromTransform.Value);
}
tweenParams.Add("time", duration);
tweenParams.Add("time", _duration.Value);
tweenParams.Add("easetype", easeType);
tweenParams.Add("looptype", loopType);
tweenParams.Add("isLocal", isLocal);
@ -50,11 +50,13 @@ namespace Fungus
// ISerializationCallbackReceiver implementation
//
public void OnBeforeSerialize()
public override void OnBeforeSerialize()
{}
public void OnAfterDeserialize()
public override void OnAfterDeserialize()
{
base.OnAfterDeserialize();
if (fromTransformOLD != null)
{
_fromTransform.Value = fromTransformOLD;

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

@ -36,7 +36,7 @@ namespace Fungus
{
tweenParams.Add("position", _toTransform.Value);
}
tweenParams.Add("time", duration);
tweenParams.Add("time", _duration.Value);
tweenParams.Add("easetype", easeType);
tweenParams.Add("looptype", loopType);
tweenParams.Add("isLocal", isLocal);
@ -50,11 +50,13 @@ namespace Fungus
// ISerializationCallbackReceiver implementation
//
public void OnBeforeSerialize()
public override void OnBeforeSerialize()
{}
public void OnAfterDeserialize()
public override void OnAfterDeserialize()
{
base.OnAfterDeserialize();
if (toTransformOLD != null)
{
_toTransform.Value = toTransformOLD;

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

@ -26,7 +26,7 @@ namespace Fungus
tweenParams.Add("name", _tweenName.Value);
tweenParams.Add("amount", _amount.Value);
tweenParams.Add("space", space);
tweenParams.Add("time", duration);
tweenParams.Add("time", _duration.Value);
tweenParams.Add("easetype", easeType);
tweenParams.Add("looptype", loopType);
tweenParams.Add("oncomplete", "OniTweenComplete");
@ -39,11 +39,13 @@ namespace Fungus
// ISerializationCallbackReceiver implementation
//
public void OnBeforeSerialize()
public override void OnBeforeSerialize()
{}
public void OnAfterDeserialize()
public override void OnAfterDeserialize()
{
base.OnAfterDeserialize();
if (amountOLD != default(Vector3))
{
_amount.Value = amountOLD;

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

@ -26,7 +26,7 @@ namespace Fungus
tweenParams.Add("name", _tweenName.Value);
tweenParams.Add("amount", _amount.Value);
tweenParams.Add("space", space);
tweenParams.Add("time", duration);
tweenParams.Add("time", _duration.Value);
tweenParams.Add("easetype", easeType);
tweenParams.Add("looptype", loopType);
tweenParams.Add("oncomplete", "OniTweenComplete");
@ -39,11 +39,13 @@ namespace Fungus
// ISerializationCallbackReceiver implementation
//
public void OnBeforeSerialize()
public override void OnBeforeSerialize()
{}
public void OnAfterDeserialize()
public override void OnAfterDeserialize()
{
base.OnAfterDeserialize();
if (amountOLD != default(Vector3))
{
_amount.Value = amountOLD;

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

@ -22,7 +22,7 @@ namespace Fungus
Hashtable tweenParams = new Hashtable();
tweenParams.Add("name", _tweenName.Value);
tweenParams.Add("amount", _amount.Value);
tweenParams.Add("time", duration);
tweenParams.Add("time", _duration.Value);
tweenParams.Add("easetype", easeType);
tweenParams.Add("looptype", loopType);
tweenParams.Add("oncomplete", "OniTweenComplete");
@ -35,11 +35,13 @@ namespace Fungus
// ISerializationCallbackReceiver implementation
//
public void OnBeforeSerialize()
public override void OnBeforeSerialize()
{}
public void OnAfterDeserialize()
public override void OnAfterDeserialize()
{
base.OnAfterDeserialize();
if (amountOLD != default(Vector3))
{
_amount.Value = amountOLD;

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

@ -26,7 +26,7 @@ namespace Fungus
tweenParams.Add("name", _tweenName.Value);
tweenParams.Add("amount", _offset.Value);
tweenParams.Add("space", space);
tweenParams.Add("time", duration);
tweenParams.Add("time", _duration.Value);
tweenParams.Add("easetype", easeType);
tweenParams.Add("looptype", loopType);
tweenParams.Add("oncomplete", "OniTweenComplete");
@ -39,11 +39,13 @@ namespace Fungus
// ISerializationCallbackReceiver implementation
//
public void OnBeforeSerialize()
public override void OnBeforeSerialize()
{}
public void OnAfterDeserialize()
public override void OnAfterDeserialize()
{
base.OnAfterDeserialize();
if (offsetOLD != default(Vector3))
{
_offset.Value = offsetOLD;

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

@ -36,7 +36,7 @@ namespace Fungus
{
tweenParams.Add("rotation", _fromTransform.Value);
}
tweenParams.Add("time", duration);
tweenParams.Add("time", _duration.Value);
tweenParams.Add("easetype", easeType);
tweenParams.Add("looptype", loopType);
tweenParams.Add("isLocal", isLocal);
@ -50,11 +50,13 @@ namespace Fungus
// ISerializationCallbackReceiver implementation
//
public void OnBeforeSerialize()
public override void OnBeforeSerialize()
{}
public void OnAfterDeserialize()
public override void OnAfterDeserialize()
{
base.OnAfterDeserialize();
if (fromTransformOLD != null)
{
_fromTransform.Value = fromTransformOLD;

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

@ -36,7 +36,7 @@ namespace Fungus
{
tweenParams.Add("rotation", _toTransform.Value);
}
tweenParams.Add("time", duration);
tweenParams.Add("time", _duration.Value);
tweenParams.Add("easetype", easeType);
tweenParams.Add("looptype", loopType);
tweenParams.Add("isLocal", isLocal);
@ -50,11 +50,13 @@ namespace Fungus
// ISerializationCallbackReceiver implementation
//
public void OnBeforeSerialize()
public override void OnBeforeSerialize()
{}
public void OnAfterDeserialize()
public override void OnAfterDeserialize()
{
base.OnAfterDeserialize();
if (toTransformOLD != null)
{
_toTransform.Value = toTransformOLD;

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

@ -22,7 +22,7 @@ namespace Fungus
Hashtable tweenParams = new Hashtable();
tweenParams.Add("name", _tweenName.Value);
tweenParams.Add("amount", _offset.Value);
tweenParams.Add("time", duration);
tweenParams.Add("time", _duration.Value);
tweenParams.Add("easetype", easeType);
tweenParams.Add("looptype", loopType);
tweenParams.Add("oncomplete", "OniTweenComplete");
@ -35,11 +35,13 @@ namespace Fungus
// ISerializationCallbackReceiver implementation
//
public void OnBeforeSerialize()
public override void OnBeforeSerialize()
{}
public void OnAfterDeserialize()
public override void OnAfterDeserialize()
{
base.OnAfterDeserialize();
if (offsetOLD != default(Vector3))
{
_offset.Value = offsetOLD;

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

@ -33,7 +33,7 @@ namespace Fungus
{
tweenParams.Add("scale", _fromTransform.Value);
}
tweenParams.Add("time", duration);
tweenParams.Add("time", _duration.Value);
tweenParams.Add("easetype", easeType);
tweenParams.Add("looptype", loopType);
tweenParams.Add("oncomplete", "OniTweenComplete");
@ -46,11 +46,13 @@ namespace Fungus
// ISerializationCallbackReceiver implementation
//
public void OnBeforeSerialize()
public override void OnBeforeSerialize()
{}
public void OnAfterDeserialize()
public override void OnAfterDeserialize()
{
base.OnAfterDeserialize();
if (fromTransformOLD != null)
{
_fromTransform.Value = fromTransformOLD;

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

@ -33,7 +33,7 @@ namespace Fungus
{
tweenParams.Add("scale", _toTransform.Value);
}
tweenParams.Add("time", duration);
tweenParams.Add("time", _duration.Value);
tweenParams.Add("easetype", easeType);
tweenParams.Add("looptype", loopType);
tweenParams.Add("oncomplete", "OniTweenComplete");
@ -46,11 +46,13 @@ namespace Fungus
// ISerializationCallbackReceiver implementation
//
public void OnBeforeSerialize()
public override void OnBeforeSerialize()
{}
public void OnAfterDeserialize()
public override void OnAfterDeserialize()
{
base.OnAfterDeserialize();
if (toTransformOLD != null)
{
_toTransform.Value = toTransformOLD;

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

@ -40,7 +40,7 @@ namespace Fungus
tweenParams.Add("axis", "z");
break;
}
tweenParams.Add("time", duration);
tweenParams.Add("time", _duration.Value);
tweenParams.Add("easetype", easeType);
tweenParams.Add("looptype", loopType);
tweenParams.Add("isLocal", isLocal);
@ -54,11 +54,13 @@ namespace Fungus
// ISerializationCallbackReceiver implementation
//
public void OnBeforeSerialize()
public override void OnBeforeSerialize()
{}
public void OnAfterDeserialize()
public override void OnAfterDeserialize()
{
base.OnAfterDeserialize();
if (amountOLD != default(Vector3))
{
_amount.Value = amountOLD;

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

@ -26,7 +26,7 @@ namespace Fungus
tweenParams.Add("name", _tweenName.Value);
tweenParams.Add("amount", _amount.Value);
tweenParams.Add("space", space);
tweenParams.Add("time", duration);
tweenParams.Add("time", _duration.Value);
tweenParams.Add("easetype", easeType);
tweenParams.Add("looptype", loopType);
tweenParams.Add("oncomplete", "OniTweenComplete");
@ -39,11 +39,13 @@ namespace Fungus
// ISerializationCallbackReceiver implementation
//
public void OnBeforeSerialize()
public override void OnBeforeSerialize()
{}
public void OnAfterDeserialize()
public override void OnAfterDeserialize()
{
base.OnAfterDeserialize();
if (amountOLD != default(Vector3))
{
_amount.Value = amountOLD;

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

@ -22,7 +22,7 @@ namespace Fungus
Hashtable tweenParams = new Hashtable();
tweenParams.Add("name", _tweenName.Value);
tweenParams.Add("amount", _amount.Value);
tweenParams.Add("time", duration);
tweenParams.Add("time", _duration.Value);
tweenParams.Add("easetype", easeType);
tweenParams.Add("looptype", loopType);
tweenParams.Add("oncomplete", "OniTweenComplete");
@ -35,11 +35,13 @@ namespace Fungus
// ISerializationCallbackReceiver implementation
//
public void OnBeforeSerialize()
public override void OnBeforeSerialize()
{}
public void OnAfterDeserialize()
public override void OnAfterDeserialize()
{
base.OnAfterDeserialize();
if (amountOLD != default(Vector3))
{
_amount.Value = amountOLD;

4
Assets/Fungus/iTween/Scripts/Commands/StopTween.cs

@ -27,10 +27,10 @@ namespace Fungus
// ISerializationCallbackReceiver implementation
//
public void OnBeforeSerialize()
public virtual void OnBeforeSerialize()
{}
public void OnAfterDeserialize()
public virtual void OnAfterDeserialize()
{
if (tweenNameOLD != "")
{

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

@ -18,6 +18,7 @@ namespace Fungus
#region Obsolete Properties
[HideInInspector] [FormerlySerializedAs("target")] [FormerlySerializedAs("targetObject")] public GameObject targetObjectOLD;
[HideInInspector] [FormerlySerializedAs("tweenName")] public string tweenNameOLD;
[HideInInspector] [FormerlySerializedAs("duration")] public float durationOLD;
#endregion
[Tooltip("Target game object to apply the Tween to")]
@ -27,7 +28,7 @@ namespace Fungus
public StringData _tweenName;
[Tooltip("The time in seconds the animation will take to complete")]
public float duration = 1f;
public FloatData _duration = new FloatData(1f);
[Tooltip("The shape of the easing curve applied to the animation")]
public iTween.EaseType easeType = iTween.EaseType.easeInOutQuad;
@ -89,7 +90,7 @@ namespace Fungus
return "Error: No target object selected";
}
return _targetObject.Value.name + " over " + duration + " seconds";
return _targetObject.Value.name + " over " + _duration.Value + " seconds";
}
public override Color GetButtonColor()
@ -101,16 +102,22 @@ namespace Fungus
// ISerializationCallbackReceiver implementation
//
public void OnBeforeSerialize()
public virtual void OnBeforeSerialize()
{}
public void OnAfterDeserialize()
public virtual void OnAfterDeserialize()
{
if (targetObjectOLD != null)
{
_targetObject.Value = targetObjectOLD;
targetObjectOLD = null;
}
if (durationOLD == default(float))
{
_duration.Value = durationOLD;
durationOLD = default(float);
}
}
}

Loading…
Cancel
Save