当前位置: 首页 > news >正文

网站建设周期规划移动端下拉框价威cj111602推广

网站建设周期规划,移动端下拉框价威cj111602推广,tcn短链接在线生成,扬州建网站文章目录 3D游戏编程与设计 HW 3.5 牧师与恶魔1.游戏介绍2.题目要求3.MVC结构4.游戏对象表#xff0c;玩家动作表#xff0c;事件表5.类设计#xff08;一#xff09;Models① Boat② Coast③ Character #xff08;二#xff09;Views① UserGUI #xff08;三#xf… 文章目录 3D游戏编程与设计 HW 3.5 牧师与恶魔1.游戏介绍2.题目要求3.MVC结构4.游戏对象表玩家动作表事件表5.类设计一Models① Boat② Coast③ Character 二Views① UserGUI 三Controllers① Director② ISceneController③ IUserAction④ Moveable⑤ GameController⑥ FirstController 6.游戏结果展示一 游戏界面二游戏失败三游戏胜利 3D游戏编程与设计 HW 3.5 牧师与恶魔 完整游戏过程可见以下视频 https://www.bilibili.com/video/BV1Vk4y117J2/ 完整代码可见以下仓库 https://gitee.com/beilineili/game3-d 1.游戏介绍 牧师和恶魔是一款益智游戏你将帮助神父和恶魔在限定的时间内过河。河的一边有三个牧师和三个魔鬼。他们都想到河的另一边去但是只有一条船每次只能载两个人。必须有一个人把船从一边转向另一边。如果牧师们被河两岸的恶魔们打败在岸上的牧师数量少于恶魔他们就会被杀死游戏也就结束了。在游戏中你可以点击它们来移动它们点击go按钮来移动船到另一个方向。你可以用很多的方法来尝试。让所有的牧师活下去! 祝你好运 2.题目要求 3.MVC结构 MVC是模型(model)视图(view)控制器(controller)的缩写它是一种软件设计模式用一种业务逻辑、数据、界面显示分离的方法组织代码将业务逻辑聚集到一个部件里面在改进和个性化定制界面及用户交互的同时不需要重新编写业务逻辑。MVC基本结构图 在牧师与恶魔游戏设计中可以分为 ① SSDirector整个结构的管理者控制各个场景的切换协调 ② ISceneController抽象每个场景的管理者是Director用来向场景控制器传递要求的接口 ③ IUserAction抽象负责管理行为之间的交互对于玩家的每个动作产生相应的响应结果通过这样基于职责的设计实现了赋予不同对象特定的职责使游戏程序的结构更加清晰、可复用性更高。 4.游戏对象表玩家动作表事件表 游戏对象对象类型Priest 牧师CubeDevil 魔鬼SphereBoat 船CubeRiver 河流CubeCoast 河岸Cube 动作触发事件点击 Character 人物人物上船下船点击 Boat 船只船只过河 事件结果其中一边恶魔数量大于牧师包括船上和岸上的玩家失败所有牧师和恶魔都到了另一岸玩家成功 5.类设计 基于职责设计使用面向对象技术设计游戏。 项目的程序代码采用MVC结构根据功能将代码文件分别放入Controllers, Models, Views文件夹中。 一Models ① Boat 有 location船位置坐标属性有起点和终点此外还需要维护船上的空位坐标以及角色信息 ② Coast 同 Boat需要维护岸上的空位坐标和角色信息 ③ Character 有 namelocation 和 isOnBoard 属性其中 name 用于区分角色是牧师还是恶魔IsOnBoat 用于区分是否在船上 二Views ① UserGUI Start 函数通过获得 Director 的单例初始化获得当前场记 CurrentSecnController // 得到 GameControllervoid Start () {status 0;action Director.GetInstance().CurrentSecnController as IUserAction;}OnGUI 函数渲染游戏界面 void OnGUI () {textStyle new GUIStyle {fontSize 40,alignment TextAnchor.MiddleCenter};hintStyle new GUIStyle {fontSize 15,fontStyle FontStyle.Normal};btnStyle new GUIStyle(button) {fontSize 30};// 打印标题和规则提示信息GUI.Label(new Rect(Screen.width / 2 - 50, Screen.height / 2 - 195, 100, 50), Priest And Devil, textStyle);GUI.Label(new Rect(Screen.width / 2 - 400, Screen.height / 2 - 125, 100, 50), White Cube: Periest\n Red Sphere: Devil\n\n rule, hintStyle);// 打印游戏结果和重开游戏的按钮if (status 1) {// LoseGUI.Label(new Rect(Screen.width / 2 - 50, Screen.height / 2 - 85, 100, 50), You Lose!, textStyle);if (GUI.Button(new Rect(Screen.width / 2 - 70, Screen.height / 2, 140, 70), Restart, btnStyle)) {status 0;action.Restart();}} else if (status 2) {// WinGUI.Label(new Rect(Screen.width / 2 - 50, Screen.height / 2 - 85, 100, 50), You Win!, textStyle);if (GUI.Button(new Rect(Screen.width / 2 - 70, Screen.height / 2, 140, 70), Restart, btnStyle)) {status 0;action.Restart();}}}OnMouseDown 函数监听捕捉用户的点击动作转至 Controller 处理 void OnMouseDown() {if (gameObject.name boat) {action.MoveBoat();} else {action.CharacterClicked(characterCtrl);}}三Controllers ① Director 获取当前游戏的场景管理游戏全局状态 public class Director : System.Object{// Singlton instance.private static Director instance;public ISceneController CurrentSecnController { get; set; }// get instance anytime anywhere!public static Director GetInstance(){if (instance null){instance new Director();}return instance;}public int getFPS(){return Application.targetFrameRate;}public void setFPS(int fps){Application.targetFrameRate fps;}}② ISceneController 场记 GameController 与导演 Director 交互的接口 public interface ISceneController{void LoadResources();}③ IUserAction 玩家与 GameController 互动的用户交互接口 public interface IUserAction {void MoveBoat();void CharacterClicked(CharacterController characterCtrl);void Restart();}④ Moveable SetDestination 用于控制对应游戏对象的运动 public void SetDestination(Vector3 pos) {destination pos;middle pos;if (pos.y transform.position.y) { // 移动船status 2;} else if (pos.y transform.position.y) { // 将角色从岸上移到船上middle.y transform.position.y;} else { // 将角色从船上移到岸上middle.x transform.position.x;}status 1;}⑤ GameController CoastController GetEmptyIndex岸上空位的下标 GetEmptyPosition岸上空位的坐标 GetOnCoast上岸 GetOffCoast离岸 GetCharacterNum计算岸上角色的数量BoatController Move移动船 GetEmptyIndex船上空位的下标 IsEmpty船是否有空位 GetEmptyPosition船上空位的坐标 GetOnBoat当玩家点击牧师或魔鬼使之上船时被调用。 GetOffBoat当玩家点击牧师或魔鬼使之上岸时被调用。 GetCharacterNum计算船上角色的数量CharacterController 配合 CoastController 和 BoatController ⑥ FirstController 在场景被加载唤醒awake时它会自动注入导演设置当前场景 void Awake() {Director director Director.GetInstance();director.CurrentSecnController this;userGUI gameObject.AddComponentUserGUI() as UserGUI;characters new MyNamespace.CharacterController[6];LoadResources();}CheckGameOver 判断游戏胜负 private int CheckGameOver() {int rightPriest 0;int rightDevil 0;int leftPriest 0;int leftDevil 0;int status 0;rightPriest rightCoastCtrl.GetCharacterNum()[0];rightDevil rightCoastCtrl.GetCharacterNum()[1];leftPriest leftCoastCtrl.GetCharacterNum()[0];leftDevil leftCoastCtrl.GetCharacterNum()[1];// Winif (leftPriest leftDevil 6) {status 2; }if (boatCtrl.boat.Location Location.right) {rightPriest boatCtrl.GetCharacterNum()[0];rightDevil boatCtrl.GetCharacterNum()[1];} else {leftPriest boatCtrl.GetCharacterNum()[0];leftDevil boatCtrl.GetCharacterNum()[1];}// Loseif ((rightPriest rightDevil rightPriest 0) ||(leftPriest leftDevil leftPriest 0)) {status 1;}return status;}6.游戏结果展示 完整游戏过程可见以下视频 https://www.bilibili.com/video/BV1Vk4y117J2/ 一 游戏界面 二游戏失败 三游戏胜利
http://www.hkea.cn/news/14276964/

相关文章:

  • 上海工程建设安全协会网站学校建设网站报告书
  • 企业网站设计说明哪些网站是503错误代码
  • 网站链接数网站后台 生成所有页面
  • 布吉企业网站建设编程培训费用
  • 黑色风格网站主页面wordpress如何链接地址
  • 迈创网站建设wordpress多媒体路径
  • 怎么做会员自动售卡网站遵义门户网站
  • 重庆 手机网站制作南京需要做网站的公司
  • 网站视频怎么做的网线制作的步骤
  • 湖南省建设网站告诉你做网站需要多少钱
  • 奉化建设网站wordpress默认图像不显示
  • 赣州网站建设优化服务网站建设营销企业
  • 建站后角度是不是0视频网站开发分析
  • 个人做网站排版什么是网站栏目标题
  • 南京市公共资源建设中心网站电商设计图
  • 建一个网站买完域名后应该怎么做怎么做二维码微信扫后直到网站
  • 做热饮店网站阿里云个人怎么免费做网站
  • 大作业做网站英文seo外链发布工具
  • 创建游戏网站网页制作课程
  • s001网站建设公司怎么注册亚马逊跨境电商
  • 做色流网站广东公共广告20120708
  • 用wordpress建站多少钱网络销售员每天做什么
  • 做网站开什么端口网站首页没排名但内页有排名
  • 网站怎么实现两种语言学校网页设计模板html
  • 怎么做前端网站邮箱企业邮箱登录入口
  • 专业做网站的页面设计如何做好wordpress的seo优化
  • 网站后台灰色wordpress文章模块化插件
  • win 2008 iis建立网站ui网站设计模板
  • 黄江网站设计万云网络网站
  • 竹子建站免费版无忧中英繁企业网站系统通用版