欧美一级特黄大片做受成人-亚洲成人一区二区电影-激情熟女一区二区三区-日韩专区欧美专区国产专区

Unity實現(xiàn)3D循環(huán)滾動效果的方法-創(chuàng)新互聯(lián)

這篇文章主要介紹Unity實現(xiàn)3D循環(huán)滾動效果的方法,文中介紹的非常詳細,具有一定的參考價值,感興趣的小伙伴們一定要看完!

成都創(chuàng)新互聯(lián)致力于互聯(lián)網(wǎng)網(wǎng)站建設(shè)與網(wǎng)站營銷,提供網(wǎng)站制作、成都網(wǎng)站建設(shè)、網(wǎng)站開發(fā)、seo優(yōu)化、網(wǎng)站排名、互聯(lián)網(wǎng)營銷、微信小程序、公眾號商城、等建站開發(fā),成都創(chuàng)新互聯(lián)網(wǎng)站建設(shè)策劃專家,為不同類型的客戶提供良好的互聯(lián)網(wǎng)應(yīng)用定制解決方案,幫助客戶在新的全球化互聯(lián)網(wǎng)環(huán)境中保持優(yōu)勢。

具體內(nèi)容如下

Unity實現(xiàn)3D循環(huán)滾動效果的方法

然后通過SetDepthAndPosition這個方法,實現(xiàn)圖片的空間空間展開

Unity實現(xiàn)3D循環(huán)滾動效果的方法

Unity實現(xiàn)3D循環(huán)滾動效果的方法

Z軸和Y軸,系數(shù)是一樣的

經(jīng)過上面設(shè)置,空間就擺開了

Unity實現(xiàn)3D循環(huán)滾動效果的方法

using UnityEngine;
using System.Collections;
using System.Collections.Generic;

public class SelectRole : MonoBehaviour {
 public GameObject rolesObj;
 private int _half = 0;//一側(cè)的卡片數(shù)
 private int _movX = 150;//X軸移動距離
 private int _movY = 50;//Y軸移動距離
 private int _movZ = 60;//Z軸移動距離
 private int count = 3;//組件數(shù)
 private List<RoleItem> _roleList = new List<RoleItem>();

 // Use this for initialization
 void Start () {
  //加載圖片
  Object[] textureList = (Object[])Resources.LoadAll("Pictures");

  int maxDepth = textureList.Length % 2 == 1 ? textureList.Length / 2 + 1 : textureList.Length / 2;//大深度
  _half = maxDepth;  

  for (int i = 0; i < textureList.Length; i++)
  {   
   //加載角色圖片預(yù)設(shè)
   GameObject role = Instantiate(Resources.Load("Role", typeof(GameObject))) as GameObject;   
   role.transform.parent = rolesObj.transform;
   role.transform.localScale = Vector3.one;

   EventDelegate.Add(role.GetComponent<UIToggle>().onChange , RoleToggleChange);

   RoleItem item = role.GetComponent<RoleItem>();   
   item.texture.mainTexture = textureList[i] as Texture;

   //設(shè)置角色卡片排序命名
   role.name = maxDepth.ToString();
   if (i > 0)
   {
    //奇數(shù)設(shè)置為右邊,下標為正數(shù)
    if (i % 2 == 1)
    {
     maxDepth--;
     role.name = maxDepth.ToString();
    }
    //偶數(shù)設(shè)置為左邊,下標為負數(shù)
    else
    {
     role.name = "-" + maxDepth.ToString();
    }
   }

   SetDepthAndPosition(item,0,0);
   _roleList.Add(item);
  }  
 }


 private void SetDepthAndPosition(RoleItem role,int dir,int index)
 {
  int indexDepth = 0;
  //左右移動后,重新排序命名
  if (dir != 0)
  {
   if (index*dir > _half )
    indexDepth = -dir * (_half - 1);
   else
    indexDepth = index > -1 && index < 1 ? dir : index;
   role.name = indexDepth.ToString(); 
  }  
  else
  {
   indexDepth = int.Parse(role.name);
  }

  TweenPosition tp = role.GetComponent<TweenPosition>();
  int x = indexDepth < 0 ? -(_half + indexDepth) * _movX : (_half - indexDepth) * _movX;
  indexDepth = System.Math.Abs(indexDepth);
  tp.to = new Vector3(x, (_half - indexDepth) * _movY, (_half - indexDepth) * _movZ);


  role.bg.depth = count * indexDepth;
  role.active.depth = 1 + count * indexDepth;
  role.texture.depth = 2 + count * indexDepth;  

  role.GetComponent<UIToggle>().value = indexDepth == _half ? true:false;
  tp.PlayForward();
 }

 /// <summary>
 /// 左邊
 /// </summary>
 public void LeftClick()
 {
  //重新排列順序
  foreach (RoleItem role in _roleList)
  {
   int index = int.Parse(role.name);
   print(index);
   SetDepthAndPosition(role,1,++index);
  } 
 }

 /// <summary>
 /// 右邊
 /// </summary>
 public void RightClick()
 {
  //重新排列順序
  foreach (RoleItem role in _roleList)
  {
   int index = int.Parse(role.name);
   SetDepthAndPosition(role,-1,--index);
  }
 }

 /// <summary>
 /// 鼠標選中某個角色
 /// </summary>
 public void RoleToggleChange()
 { 
  if(UIToggle.current.value)
  {
   int index = int.Parse(UIToggle.current.name);
   int moveCount = _half - System.Math.Abs(index);//移動個數(shù)
   for (int i = 0; i < moveCount;i++ )
   {
    if (index > 0)
     LeftClick();
    else
     RightClick();
   }   
  }
 }

}

以上是“Unity實現(xiàn)3D循環(huán)滾動效果的方法”這篇文章的所有內(nèi)容,感謝各位的閱讀!希望分享的內(nèi)容對大家有幫助,更多相關(guān)知識,歡迎關(guān)注創(chuàng)新互聯(lián)成都網(wǎng)站設(shè)計公司行業(yè)資訊頻道!

另外有需要云服務(wù)器可以了解下創(chuàng)新互聯(lián)scvps.cn,海內(nèi)外云服務(wù)器15元起步,三天無理由+7*72小時售后在線,公司持有idc許可證,提供“云服務(wù)器、裸金屬服務(wù)器、高防服務(wù)器、香港服務(wù)器、美國服務(wù)器、虛擬主機、免備案服務(wù)器”等云主機租用服務(wù)以及企業(yè)上云的綜合解決方案,具有“安全穩(wěn)定、簡單易用、服務(wù)可用性高、性價比高”等特點與優(yōu)勢,專為企業(yè)上云打造定制,能夠滿足用戶豐富、多元化的應(yīng)用場景需求。

文章題目:Unity實現(xiàn)3D循環(huán)滾動效果的方法-創(chuàng)新互聯(lián)
路徑分享:http://aaarwkj.com/article34/isipe.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供Google、App設(shè)計、定制開發(fā)、外貿(mào)網(wǎng)站建設(shè)、網(wǎng)頁設(shè)計公司、電子商務(wù)

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)

成都定制網(wǎng)站建設(shè)
欧美日韩国产精品综合| 黄色日韩欧美在线观看| 色香蕉精品国产综合| 国产在线精品91国自产拍| 国产在线视频不卡福利片| 久久99热这里只频精品| 国内精品自产拍久久久久久久久91| 青青草原在线视频一区| 久久中文字幕人妻熟av| 亚洲一区二区三区日本在线| 亚洲欧美日韩午夜在线| 久久精品视频视频视频| 国产一区二区毛多内射| 日本在线一区二区视频麻豆| 亚洲人妻在线一区二区三区| 国产视频不卡一区二区| 日产中文乱码字幕无线观看| 麻豆精品国产粉嫩av| 久久91亚洲精品久久91| 欧美激情片免费在线观看| 91九色蝌蚪国产欧美亚洲| 久久精品国产精品亚洲片| 日韩不卡在线观看免费| 强乱人妻中文字幕日本| 国产精品国产三级国产专播| 亚洲各类熟女们中文字幕| 免费在线观看福利av| 亚洲精品国产av一区| 国产欧美一区二区三区久久| 久久九特黄的免费大片| 久久精品国产亚洲av无| 国产亚洲综合久久系列| 两性色午夜视频在线观看| 亚洲欧美日韩在线观看a三区| 日本黄色录像在线观看| 国产精品偷伦一区二区| 亚洲最大av免费在线看| 欧美日韩性性在线观看| 成人国产视频免费观看| 亚洲成人久久久av一区| 精品成人18亚洲av播放|