23
« on: July 11, 2012, 11:10:55 PM »
Just did one script for bulk UI tween position using one scripts.Post here for sharing. Noted that this script require iTween install in your project.
using UnityEngine;
using System.Collections;
public class GroupTweenPosition : MonoBehaviour {
public GameObject[] targets;
public Vector3[] targetPosition;
public float[] timer;
public float[] delayTimer;
public iTween.EaseType[] motionType;
void Start ()
{
TweenPosition( targets, targetPosition,timer,delayTimer,motionType);
}
public void TweenPosition(GameObject[] targets,Vector3[] targetPosition,float[] timer,float[] delayTimer,iTween.EaseType[] motionType)
{
for(int cnt = 0;cnt < targets.Length;cnt++)
{
targetPosition[cnt] = transform.TransformPoint(targetPosition[cnt]);
iTween.MoveTo(targets[cnt],iTween.Hash("position",targetPosition[cnt],"time",timer[cnt],"delay",delayTimer[cnt],"easyType",motionType[cnt]));
}
}
}