已阅读5页,还剩3页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
Android水管工游戏的简单脚本 Posted on 2013年07月04日 by U3d / Unity3D脚本/插件 /被围观 72 次 001 using UnityEngine; 002 using System.Collections; 003004 public class TestGoto : MonoBehaviour 005 public GUISkin skin; 006 float width; 007 float height; 008 public Texture up; 009 public Texture down; 010 public Texture right; 011 public Texture left; 012 public Texture up_down; 013 public Texture right_left; 014 int images; 015 Vector4 dires; 016 int flag; 017 int step; 018 int coml; 019 int row; 020 int m; 021 int n; 022 bool isend; 023 bool iswin; 024 int TF; 025 void Start () 026 /width=80*(Screen.width/480); 027 width=Screen.width*0.12F; 028 height=width; 029 flag=0; 030 step=0; 031 row=4; 032 coml=8; 033 m=0; 034 n=0; 035 iswin=false; 036 images=new int32; 037 dires=new Vector432; 038 TF=new int32; 039 for(int k=0;k=31;k+) 040 flag=Random.Range(1,7); 041 imagesk=flag; 042 043044 /level 01 045 046047 void OnGUI() 048049 GUI.skin=skin; 050 GUI.Window(1,new Rect(0,0,Screen.width,Screen.height),ShowWindow,); 051052 if(isend) 053 WinOrLose(); 054 055056 057 void ShowWindow(int windowID) 058 if(GUI.Button(new Rect(width*0.2F,0,width,height),open) 059 isend=true; 060 061 for(int j=0;jrow;j+) 062 for(int i=0;icoml;i+) 063 if(GUI.Button(new Rect(i*width+width*0.2F,(j+1)*height,width,height),select(imagesj*coml+i) 064 step+=1; 065 if(imagesj*coml+i5) 066 imagesj*coml+i+=1; 067 if(imagesj*coml+i=5) 068 imagesj*coml+i=1; 069 070 else 071 imagesj*coml+i+=1; 072 if(imagesj*coml+i=7) 073 imagesj*coml+i=5; 074 075 076 077078 Vector4 dir; 079 if(select(imagesj*coml+i)=up) 080 dir=new Vector4(1,1,0,0); 081 else if(select(imagesj*coml+i)=right) 082 dir=new Vector4(0,1,1,0); 083 else if(select(imagesj*coml+i)=down) 084 dir=new Vector4(0,0,1,1); 085 else if(select(imagesj*coml+i)=left) 086 dir=new Vector4(1,0,0,1); 087 else if(select(imagesj*coml+i)=up_down) 088 dir=new Vector4(1,0,1,0); 089 else 090 dir=new Vector4(0,1,0,1); 091 092 diresj*coml+i=dir; 093 /print(j*coml+i+:+diresj*coml+i); 094 095 096 097 Texture select(int n) 098 Texture image=new Texture(); 099 switch(n) 100 case 1: 101 image=up; 102 break; 103 case 2: 104 image=right; 105 break; 106 case 3: 107 image=down; 108 break; 109 case 4: 110 image=left; 111 break; 112 case 5: 113 image=up_down; 114 break; 115 case 6: 116 image=right_left; 117 break; 118 119 return image; 120 121 /判断输赢 122 void WinOrLose() 123 switch(imagesn*coml+m) 124 /第一种类型的图片,向上+向右 125 / if(diresn*coml+m.x=1&diresn*coml+m.y=1) 126 case 1: 127 if(n=0) 128 if(m=0) 129 TFn*coml+m=1; 130 m+; 131 132 /Unity3D教程手册: 133 else 134 if(m0&n0&m0) 179 if(dires(n-1)*coml+m.z=1&diresn*coml+(m-1).w=1) 180 TFn*coml+m=1; 181 if(TF(n-1)*coml+m=1) 182 m-; 183 184 if(TFn*coml+(m-1)=1) 185 n-; 186 187 188 189 break; 190 /第四种类型的图片 向右+向下 191 / if(diresn*coml+m.y=1&diresn*coml+m.z=1) 192 case 2: 193 if(n(row-1)&m0&m0&n(row-1) 230 if(diresn*coml+(m-1).y=1&dires(n+1)*coml+m.x=1) 231 TFn*coml+m=1; 232 if(TFn*coml+(m-1)=1) 233 n+; 234 235 if(TF(n+1)*coml+m=1) 236 m-; 237 238 23
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 赤水公务员考试真题试卷试题及答案
- 热源厂建设与改造方案
- 矿区水土保持与环境保护方案
- 城乡生活污水提升治理工程环境影响报告书
- 备战广东省公务员考试试题及答案
- 北方邦公务员考试试题及答案
- 2026年蔬菜种植公司舆情监测与应对处置制度
- 2025甘肃智联慧通人力资源服务限公司(中国邮政集团定西分公司)招聘11人易考易错模拟试题(共500题)试卷后附参考答案
- 数据安全治理:“十五五”数据要素合规流通保障
- 2025湖南长沙市体育局所属事业单位招聘普通雇员2人易考易错模拟试题(共500题)试卷后附参考答案
- 教师教学能力比赛-钳工工艺与技能-六方螺母的制作电子教案
- 北京市西城区九年级数学学习探究诊断(下册)第二十七章相似
- 湘教版七年级地理上册知识点复习提纲
- 会计账册报表(非营利组织适用)
- 全国巾帼家政服务职业技能大赛(养老护理员)决赛备赛试题库(含答案)
- 五下音乐《银色的马车从天上来啦(简谱、五线谱)》课件
- (完整版)工匠精神课件
- 3-Aegisy下腔静脉滤器介绍
- 2024年山东省化学检验员技能竞赛参考试题库(附答案)
- translated-(2024.V1)NCCN临床实践指南:心理痛苦的处理(中文版)
- 2023初中化学课程标准(2022年版)考试题库及答案
评论
0/150
提交评论