




已阅读5页,还剩8页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
成 绩 安徽科技学院 unity课程实习报告所在专业 地理信息系统 组长姓名 杨明明(2206110124) 组内成员 刘德旺(2206110114) 孟令康(2206110116) 任宏伟 (2206110117) 赵文 (2206110130) 所在院系 城建与环境学院 指导教师 邱 银 国 日 期 2014年11月5日 一、实验目的及要求本次实验的总的目的是通过具体的程序的编写与unity 3d软件相结合,将所学的知识内化,即将在课堂上学到的知识集成在一起,并实现相关功能,从而锻炼自己的程序编写、程序调试能力以及对unity 3d的掌握能力。本次实验的具体要求是使用Unity3d软件完成一个综合的应用系统。二、实验方法本次实验是以windows操作系统为平台,通过unity 3d软件进行本次实验的项目实现,unity 3d是一个十分优秀的全面整合的专业游戏引擎。通过unity 3d软件和编程工具的结合可以轻松创建各种3D模型,模拟模型动态以及插入互动内容。三、实验内容、步骤及结果1. 实验内容本次实验是通过unity 3d软件完成一个综合的应用系统。并且本次实验所设计的系统要实现的功能如下:(1) 漫游浏览(三维);(2) 连接数据库(SQL Server 2008);(3) 音视频播放;(4) 绘制简单图形;(5) 基本GUI元素显示;2. 实验步骤及结果步骤:(1)场景设计以及构思;(2)项目实施及代码编写;(3)场景代码相结合;(4)进行调试。结果:1) 基本GUI元素显示:代码如下:#pragma strictvar str:String;var mm:String;function Start () function Update () function OnGUI()GUI.BeginGroup(Rect(Screen.width/2-150,Screen.height/2-100,400,300);GUI.Label(Rect(20,20,80,30),菜单:);if(GUI.Button(Rect(100,40,60,20),自动漫游)Application.LoadLevel(自动漫游);if(GUI.Button(Rect(100,10,60,20),音频播放)Application.LoadLevel(音频播放);if(GUI.Button(Rect(100,70,60,20),画线)Application.LoadLevel(画线);if(GUI.Button(Rect(100,100,60,20),视频播放)Application.LoadLevel(视频播放);GUI.EndGroup();2) 绘制简单图形:代码如下: public class NewBehaviourScript : MonoBehaviour ArrayList pX = new ArrayList(); ArrayList pY = new ArrayList(); public Material mat; /Point3d pts3d = new Point3d(); Vector3 mousePos = new Vector3(); enum DrawMode Null, Lines, Triangle, Rectangle ; DrawMode dm; bool TriClose = false;/ Use this for initializationvoid Start () dm = DrawMode.Null; / Update is called once per framevoid Update () mousePos = Input.mousePosition; if (Input.GetMouseButton(0) pX.Add(Input.mousePosition.x); pY.Add(Input.mousePosition.y); void OnGUI() /此处略。3) 音视频播放:音频:代码如下:using UnityEngine;using System.Collections;public class music : MonoBehaviour / Use this for initializationvoid Start () / Update is called once per framevoid Update () void OnGUI()if(GUI.Button(new Rect(Screen.width/2-100,Screen.height-30,50,20),Start)gameObject.audio.Play();if(GUI.Button(new Rect(Screen.width/2-40,Screen.height-30,50,20),Pause)gameObject.audio.Pause();if(GUI.Button(new Rect(Screen.width/2+20,Screen.height-30,50,20),Stop)gameObject.audio.Stop();if(GUI.Button(new Rect(Screen.width/2+80,Screen.height-30,50,20),Return)Application.LoadLevel(loading);视频:代码如下:using UnityEngine;using System.Collections;public class vidio : MonoBehaviour public MovieTexture movietexture;public bool ON=false;/ Use this for initializationvoid Start () renderer.material.mainTexture=null;movietexture.loop=true;gameObject.audio.Stop();/ Update is called once per framevoid Update () void OnGUI()if(GUI.Button(new Rect(Screen.width/2-40,Screen.height-40,40,40),开关)if(!ON)movietexture.Play();renderer.material.mainTexture=movietexture;gameObject.audio.Play();ON=true;elsemovietexture.Stop();gameObject.audio.Stop();ON=false;renderer.material.mainTexture=null;if(GUI.Button(new Rect(Screen.width/2,Screen.height-40,40,40),停止)movietexture.Stop();gameObject.audio.Stop();if(GUI.Button(new Rect(Screen.width/2+40,Screen.height-40,40,40),暂停)movietexture.Pause();gameObject.audio.Pause();if(GUI.Button(new Rect(Screen.width/2+80,Screen.height-40,40,40),返回)Application.LoadLevel(loading);4) 漫游浏览(三维):代码如下:using UnityEngine;using System.Collections;public class working : MonoBehaviour float hSliderValue = 1f; public GameObject path;/定义一个数组用来存储路径方块 public static int i = 0;/定义一个整型变量用来存储当前路径点序号 / Use this for initialization void Start() / Update is called once per frame void Update() gameObject.transform.LookAt(pathi % path.Length.transform); gameObject.transform.Translate(Vector3.forward * Time.deltaTime * hSliderValue); if (Input.GetMouseButtonDown(0) Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); RaycastHit hit = new RaycastHit(); if (Physics.Raycast(ray, out hit) print(hit.collider.gameO); void OnGUI() GUI.skin.label.fontSize = 10; GUI.color = Color.cyan; /GUI.Button (new Rect(10,10,80,30),djfkj); hSliderValue = GUI.HorizontalSlider(new Rect(Screen.width - 200, 40, 100, 30), hSliderValue, 0.0f, 100.0f); /GUI.contentColor = Color.black; GUI.Label(new Rect(Screen.width - 200, 15, 200, 30), 漫游速度: + hSliderValue.ToString()+ m/s); /空间坐标 /GUI.Label(new Rect(10, Screen.height - 20, 100, 30), X坐标: + transform.position.x + m); /GUI.Label(new Rect(120, Screen.height - 20, 100, 30), Y坐标: + transform.position.y + m); /GUI.Label(new Rect(230, Screen.height - 20, 100, 30), Z坐标: + transform.position.z + m);if(GUILayout.Button(返回
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 考研政治面试题库及答案
- 农业产业园项目2025年区域农业产业结构优化研究与效益评估
- 基于2025年视角的资源型城市产业升级与绿色发展报告
- 2025年特色主题餐厅餐饮市场区域差异与竞争策略研究报告
- 数字化驱动2025:公路货运行业效率提升与可持续发展报告
- 安全教育培训记录缺失课件
- 共享厨房在促进餐饮消费升级方面的实践与探索报告
- 服装设计师品牌方案
- 租赁物品使用协议格式
- 2025年医药电商平台药品供应链金融合规性分析与运营优化报告
- 德瑞斯D600变频器说明书
- 2025-2030年中国锂电池回收行业市场深度调研及前景趋势与投资研究报告
- 数字化教育资源在跨学科教学中的应用
- JG/T 127-2017建筑门窗五金件滑撑
- T/CGCC 7-2017焙烤食品用糖浆
- 2024福建农信社春季招聘笔试历年典型考题及考点剖析附带答案详解
- 医生重症医学科进修汇报
- DB13(J)-T 8389-2020 被动式超低能耗建筑节能工程施工及质量验收标准
- 月嫂 考试题及答案
- 物质安全资料脱模剂MSDS
- 2025年中国过敏性鼻炎市场研究报告
评论
0/150
提交评论