游戏对象主要是:
Empty (不显示却是最常用对象之一) 作为子对象的容器创建一个新的对象空间 3D 物体 基础 3D 物体(Primitive Object):立方体(Cube)、球体(Sphere)、胶囊体(Capsule)、圆柱体(Sylinder)、平面(Plane)、四边形(Quad)构造 3D 物体:由三角形网格构建的物体:如地形等 Camera 摄像机,观察游戏世界的窗口Light 光线,游戏世界的光源Audio 声音游戏对象的使用: 可以给对象添加组件,组件包括物体是不是刚体,受不受重力影响等等,还可以通过编写脚本,并将其添加到组件上面来用脚本控制游戏对象的行为
【2019开始的新要求】:设计一个裁判类,当游戏达到结束条件时,通知场景控制器游戏结束 奖励关卡的游戏原型设计
动作管理器设计的核心代码参照了潘老师的课程网站这里给出裁判类 Referee 的代码 using System.Collections; using System.Collections.Generic; using UnityEngine; public class Referee : MonoBehaviour { public int start_priest; public int start_devil; public int end_priest; public int end_devil; public int[] boat_role_num = {0, 0}; public int boat_sign; public Referee(){ start_devil = 0; start_priest = 0; end_devil = 0; end_priest = 0; boat_sign = 0; } public void set(int sp, int sd, int ep, int ed, int[] brn, int bs){ start_priest = sp; start_devil = sd; end_priest = ep; end_devil = ed; boat_role_num = brn; boat_sign = bs; } public int check() { if (end_priest + end_devil == 6) return 2; // 胜利 if (boat_sign == 1) { start_priest += boat_role_num[0]; start_devil += boat_role_num[1]; } else { end_priest += boat_role_num[0]; end_devil += boat_role_num[1]; } if (start_priest > 0 && start_priest < start_devil) { return 1; // 失败,岸上牧师人数少于恶魔 } if (end_priest > 0 && end_priest < end_devil) { return 1; // 失败,岸上牧师人数少于恶魔 } return 0; } }传送门