您好,登錄后才能下訂單哦!
導(dǎo)入iTween插件包后,做以下操作
1、創(chuàng)建一個(gè)空對(duì)象,用來(lái)做路徑;
2、給空對(duì)象添加路徑組件
3、修改空對(duì)象和路徑組件名字,并拉出行走路徑(可隨意拉)
4、添加游戲?qū)ο笥糜诎凑章窂叫凶?,如圖中的其中一個(gè)方塊,并添加腳本代碼MoveSample.cs,代碼如下
using UnityEngine; using System.Collections; public class MoveSample : MonoBehaviour { void Start(){ GameObject go = gameObject as GameObject; //路徑對(duì)象 GameObject goPath = GameObject.Find("goPath"); iTween.MoveTo(go, iTween.Hash( "path", iTweenPath.GetPath("path"), "looktarget", goPath.transform, "looktime", 0.0f, "speed", 20.0f, "easetype", iTween.EaseType.linear, "looptype", iTween.LoopType.none, "oncomplete", "PlaySecondPath", "oncompleteparams", go, "oncompletetarget", this.gameObject )); } }
5、運(yùn)行查看效果
demo下載
http://www.kuaipan.cn/file/id_141868194330585854.htm?source=1
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。