Browse Source

MoveTo, RotateTo and ScaleTo can now take a transform property

master
chrisgregan 10 years ago
parent
commit
04d330933e
  1. 14
      Assets/Fungus/iTween/Commands/MoveTo.cs
  2. 12
      Assets/Fungus/iTween/Commands/RotateTo.cs
  3. 12
      Assets/Fungus/iTween/Commands/ScaleTo.cs

14
Assets/Fungus/iTween/Commands/MoveTo.cs

@ -5,16 +5,24 @@ namespace Fungus
{
[CommandInfo("iTween",
"Move To",
"Moves a game object to a specified position over time.")]
"Moves a game object to a specified position over time. The position can be defined by a transform in another object (using To Transform) or by setting an absolute position (using To Position, if To Transform is set to None).")]
public class MoveTo : iTweenCommand
{
public Vector3 position;
public Transform toTransform;
public Vector3 toPosition;
public bool isLocal;
public override void DoTween()
{
Hashtable tweenParams = new Hashtable();
tweenParams.Add("position", position);
if (toTransform == null)
{
tweenParams.Add("position", toPosition);
}
else
{
tweenParams.Add("position", toTransform);
}
tweenParams.Add("time", duration);
tweenParams.Add("easetype", easeType);
tweenParams.Add("looptype", loopType);

12
Assets/Fungus/iTween/Commands/RotateTo.cs

@ -8,13 +8,21 @@ namespace Fungus
"Rotates a game object to the specified angles over time.")]
public class RotateTo : iTweenCommand
{
public Vector3 rotation;
public Transform toTransform;
public Vector3 toRotation;
public bool isLocal;
public override void DoTween()
{
Hashtable tweenParams = new Hashtable();
tweenParams.Add("rotation", rotation);
if (toTransform == null)
{
tweenParams.Add("rotation", toRotation);
}
else
{
tweenParams.Add("rotation", toTransform);
}
tweenParams.Add("time", duration);
tweenParams.Add("easetype", easeType);
tweenParams.Add("looptype", loopType);

12
Assets/Fungus/iTween/Commands/ScaleTo.cs

@ -8,12 +8,20 @@ namespace Fungus
"Changes a game object's scale to a specified value over time.")]
public class ScaleTo : iTweenCommand
{
public Vector3 scale;
public Transform toTransform;
public Vector3 toScale;
public override void DoTween()
{
Hashtable tweenParams = new Hashtable();
tweenParams.Add("scale", scale);
if (toTransform == null)
{
tweenParams.Add("scale", toScale);
}
else
{
tweenParams.Add("scale", toTransform);
}
tweenParams.Add("time", duration);
tweenParams.Add("easetype", easeType);
tweenParams.Add("looptype", loopType);

Loading…
Cancel
Save