资源简介
一个用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校园招聘华虹笔试考题
- 下一篇:物理学教程(马文蔚)答案
评论
共有 条评论