資源簡介
一個用unity5.0實現的簡單的拼圖游戲,拖動拼圖碎片而把其放到相應的位置,此資源包含可以直接運行的源代碼。具體的介紹可見博客:
http://blog.csdn.net/wfenglinxu/article/details/49584605

代碼片段和文件信息
using?UnityEngine;
using?System.Collections;
public?class?item?:?MonoBehaviour?{
public?bool?isChongHe=false; //是否與其對應的node重合
private?Gameobject?mouseobject;
//?Use?this?for?initialization
void?Start?()?{
mouseobject?=?Gameobject.Find?(“mouse“);
}
//進入對應的node時將isChongHe置為true
void?OnTriggerEnter2D(Collider2D?other){
if?(other.gameobject.tag?==?“position“)?{
if(other.gameobject.name==mouseobject.GetComponent().puzzlename)
isChongHe?=?true;
}
}
//離開對應的node時將isChongHe置為false
void?OnTriggerExit2D(Collider2D?other){
if?(other.gameobject.tag?==?“position“)?{
if(other.gameobject.name==mouseobject.GetComponent().puzzlename)
isChongHe?=?false;
}
}
//當自身被拖動到對應的node處并放開后執行node.die()銷毀自身
void?OnTriggerStay2D(Collider2D?other){
if?(other.gameobject.tag?==?“position“)?{
if(other.gameobject.name==mouseobject.GetComponent().puzzlename?&&?!mouseobject.GetComponent().isClicked){
//other.GetComponent().die();
//{ //Destroy(this.gameobject);
this.transform.tag=“position“;
this.transform.position=other.transform.position;
//mouseobject.GetComponent().num++;
}
}
}
}
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件???????3476??2015-11-02?19:57??puzzle\Assembly-CSharp-vs.csproj
?????文件???????3476??2015-11-02?19:57??puzzle\Assembly-CSharp.csproj
????I.A....?????29508??2015-11-02?22:35??puzzle\Assets\owlsence.unity
????..A..H.???????174??2015-11-02?17:28??puzzle\Assets\owlsence.unity.me
?????文件???????1287??2015-10-24?12:09??puzzle\Assets\sc
????..A..H.???????262??2015-11-02?19:57??puzzle\Assets\sc
?????文件???????1894??2015-11-02?21:54??puzzle\Assets\sc
????..A..H.???????262??2015-11-02?19:57??puzzle\Assets\sc
????..A..H.???????191??2015-11-02?17:26??puzzle\Assets\sc
?????文件?????545663??2015-11-02?19:47??puzzle\Assets\Sprite\owl_back.png
????..A..H.??????1160??2015-11-02?19:17??puzzle\Assets\Sprite\owl_back.png.me
?????文件??????87519??2015-10-30?23:22??puzzle\Assets\Sprite\owl_puzzle.png
????..A..H.??????3130??2015-11-02?19:33??puzzle\Assets\Sprite\owl_puzzle.png.me
????..A..H.???????191??2015-11-02?17:26??puzzle\Assets\Sprite.me
????I.A....??????4120??2015-11-02?17:20??puzzle\Library\AnnotationManager
????I.A....????984236??2015-11-02?22:48??puzzle\Library\assetDataba
????I.A....?????????6??2015-11-02?17:21??puzzle\Library\AssetImportState
????I.A....??????4756??2015-11-02?22:48??puzzle\Library\AssetServerCacheV3
????I.A....?????????0??2015-11-02?17:20??puzzle\Library\BuildPla
????I.A....??????4124??2015-11-02?17:20??puzzle\Library\BuildSettings.asset
????I.A....?????36752??2015-11-02?22:48??puzzle\Library\CurrentLayout.dwlt
????I.A....??????4268??2015-11-02?22:42??puzzle\Library\EditorUserBuildSettings.asset
????I.A....??????4144??2015-11-02?17:20??puzzle\Library\EditorUserSettings.asset
????I.A....??????4164??2015-11-02?22:48??puzzle\Library\expandedItems
????I.A....??????4404??2015-11-02?22:42??puzzle\Library\guidmapper
????I.A....??????4164??2015-11-02?21:54??puzzle\Library\InspectorExpandedItems.asset
?????文件?????????65??2015-11-02?17:20??puzzle\Library\LibraryFormatVersion.txt
????I.A....??????4285??2015-11-02?17:20??puzzle\Library\me
?????文件????????478??2015-11-02?17:20??puzzle\Library\me
????I.A....??????4321??2015-11-02?17:20??puzzle\Library\me
............此處省略905個文件信息
- 上一篇:2013校園招聘華虹筆試考題
- 下一篇:物理學教程(馬文蔚)答案
評論
共有 條評論