Unity插件iTween的使用(例子)
using UnityEngine;
using System.Collections;
public class MoveSample : MonoBehaviour
{
void Start(){
//iTween.MoveBy(gameObject, iTween.Hash("x", 2, "easeType", "easeInOutExpo", "loopType", "pingPong", "delay", .1));
Hashtable args = new Hashtable ();
args.Add ("easeType", iTween.EaseType.easeInOutExpo);
args.Add ("speed", 10f);
args.Add ("time", 1f);
//颜色
//args.Add("NamedValueColor","_SpecColor");
//延迟执行时间
args.Add("delay", 0.1f);
//移动过程中面朝一个点
args.Add ("looktarget", Vector3.zero);
//循环类型
args.Add ("loopType", "none");
//处理移动过程中的事件。
//开始发生移动时调用AnimationStart方法,5.0表示它的参数
//args.Add("onstart", "AnimationStart");
//args.Add("onstartparams", 5.0f);
//移动结束时调用,参数和上面类似
//args.Add("oncomplete", "AnimationEnd");
//args.Add("oncompleteparams", "end");
//args.Add("oncompletetarget", gameObject);
//移动中调用,参数和上面类似
//args.Add("onupdate", "AnimationUpdate");
//args.Add("onupdatetarget", gameObject);
//args.Add("onupdateparams", true);
// x y z 标示移动的位置。
//args.Add("x",5);
//args.Add("y",5);
//args.Add("z",1);
//当然也可以写Vector3
args.Add("position",Vector3.zero);
iTween.MoveTo (this.gameObject, args);
}
}