【原】unity3d之iTween

itween插件官网:http://itween.pixelplacement.com/gettingstarted.php

更新说明:

oncompletetarget 表明回调函数所在的GameObject。如果把oncompletetarget写成当前gameObject,回调函数需要写在当前gameObject所挂脚本里面。



1、iTween函数调用

iTween.MoveTo(要移动的gameObject,iTween.Hash("position",new Vector3(0,-3,0),"time",0.1f,"oncomplete","SwithOutEnd","oncompletetarget",执行回调函数的GameObject));
void SwithOutEnd()
{

}

2、iTween带参数函数调用

iTween.MoveTo(要移动的gameObject,iTween.Hash("position",new Vector3(0,-3,0),"time",0.1f,"oncomplete","SwithOutEnd","oncompletetarget", 执行回调函数的GameObject,"oncompleteparams",2));
void SwithOutEnd(int i)
{

}

 
 

3、iTween stop应用

iTween.ScaleTo(gameSceneManager.goldZeroEffect,iTween.Hash("scale",new Vector3(1,1,1),"time",0.4f,"easyType",iTween.EaseType.linear,"looptype",iTween.LoopType.loop));
 yield return new  WaitForSeconds(2);
 iTween.Stop(gameSceneManager.goldZeroEffect);
4、iTween 回调函数多参调用
默认iTween的任何函数 都可以有一个完成后的回调函数,并且能带一个参数,有时可能希望带多个参数(如何解决呢?)
作者给的思路是将唯一能带的参数 作为对象(类/结构体)传进去,这样就可以实现多参了
iTween.MoveTo(gameObject,iTween.Hash("position",new Vector3(0,-3,0),"time",0.1f,"oncomplete","SwithOutEnd","oncompletetarget", 执行回调函数的GameObject,"oncompleteparams",对象));
void SwithOutEnd(类型 对象)
{
    
}
待更新ing...........
posted @ 2012-07-10 12:50  U_探索  阅读(5841)  评论(0编辑  收藏  举报