Unity 简单手机小游戏 - 3D重力滚球(源码)
2017-08-19 11:49
961 查看
游戏效果图: 需要的可以素材的可以留言,评论,,目前做了5个关卡
码云:https://gitee.com/Czhenya/GunNiGeQiu
通过陀螺仪使得小球有运动的力
开始的UI场景,应用于按钮(开始,和游戏结束)
用触发器时刻判断,进洞重新开始,到终点弹出重玩,下一关按钮进行选择,用GUI制作了简易放回主菜单(回到场景0)按键,,
码云:https://gitee.com/Czhenya/GunNiGeQiu
通过陀螺仪使得小球有运动的力
public class groy : MonoBehaviour { float x; float y; Gyroscope go; void Start() { go = Input.gyro; go.enabled = true; } void Update() { x = Input.acceleration.x; y = Input.acceleration.y; this.GetComponent<Rigidbody>().AddForce(new Vector3(-x, 0, -y) * 20); } }
开始的UI场景,应用于按钮(开始,和游戏结束)
public class StartUi : MonoBehaviour { public void Reaply() { Time.timeScale = 1; Application.LoadLevel(1); } public void Quit() { Application.Quit(); } }
用触发器时刻判断,进洞重新开始,到终点弹出重玩,下一关按钮进行选择,用GUI制作了简易放回主菜单(回到场景0)按键,,
public class Mover : MonoBehaviour { public GameObject go; private void OnTriggerStay(Collider other) { if (other.name == "target") { go.gameObject.SetActive(true); Time.timeScale = 0; } else { Application.LoadLevel(1); } } private void OnTriggerEnter(Collider other) { if (other.name == "target") { go.gameObject.SetActive(true); Time.timeScale = 0; } else { Application.LoadLevel(1); } } private void OnGUI() { GUIStyle style = new GUIStyle(); style.fontSize = 36; if (GUI.Button(new Rect(50,30, 200,80 ), "返回菜单",style)){ Application.LoadLevel(0); } } }
相关文章推荐
- 【个人Unity笔记】{基础} 2D小游戏一个简单的自动刷怪脚本
- unity中使用GUI按钮实现简单的猜拳小游戏:
- 通过root手机获得微信小游戏源码
- 最简单易懂的Unity1.2 源码 (注入)
- 【P000-000】第一个项目,暂定为android手机上的简单证券交易费计算系统(源码列表统一在此更新)
- 郭克华手机编程教学视频----我的练习源码(6)实战:实现一个简单的监听程序
- c#实现简单金山打字小游戏(源码)
- unity 做手机开发的简单适配
- 【Unity】项目源码——简单2D空战游戏
- Android小游戏——简单易懂单机人人对战五子棋源码详解
- 【源码分享】mui实现简单的手机音乐播放器
- C# 自动投票和手机号码归属地查询 - 简单程序源码分享(高手飘过)
- 如何使用androidpn实现android手机消息推送(简单的源码分析)
- 如何使用androidpn实现android手机消息推送(简单的源码分析)
- Unity IMGUI 的小游戏(井字棋)制作以及怎么发布为安卓apk并且发给女孩子手机上成功运行的教程 - 3D游戏编程学习日志
- 11款手机微信小游戏源码特效
- 如何使用androidpn实现android手机消息推送(简单的源码分析)
- 一款简单的客户端安卓手机qq源码
- Unity中FPS类小游戏的简单制作
- VS2010+.net4.0仿照苹果手机上的消除之星写了一个电脑版的功能简单 稍后将公开源码(一)