新建Unity项目3D | 版本选择 2022.3
| 导入Creator Kit: FPS资源 | 双击 ExampleScene | 点play 按钮运行起来:
- W A S D 移动;Shift + W A S D 跑
- 空格跳跃
- 鼠标左键射击目标
也可以自己自定义操作键:
Edit | Project settings | Input Manager.
展开 Horizontal 和 Vertical进行自定义修改即可。修改完 cmd+s保存。
✅ Customize the Germ Targets
➡️ Create your Own Level for the Game
To make your own copy: 菜单栏:FPSKIT > Create new Scene
, 命名为MyTestScene
然后双击 MyTestScene 打开:
Assets > Creator Kit - FPS > Prefabs > Targets 选中 GermSlimeTarget Prefab 拖到场景中:
➡️ Change Target Stats
可以自己修改 GermSlimeTarget的一些属性值测试:
➡️ Create a New Target
到 Assets > Creator Kit - FPS > Art > Models > Characters, 选择 GermSpike 拖到场景中:
给它添加刚体 “Rigidbody” :
- Disable the Use Gravity checkbox
- Enable the Is Kinematic checkbox
Disabling Use Gravity
will make the germ float, and enabling Is Kinematic
will stop bullets (or anything else) from moving it around.
添加碰撞器 Sphere Collider:
In the Center field, set Y to 0.95. This will ensure that the collider sits at the center of the germ, rather than below it.
To change the size of the Collider: set Radius to 1.5
添加一个 名为 Target 脚本组件:
添加动画和声音:
将 GermSpike 游戏对象拖拽到 Assets > Creator Kit - FPS > Prefabs > Targets 下面,选择 Original Prefab,变成预制体:
✅ Design your Own Level
- Design a full level for the game
- Add locked doors and keys which open them
首先,缩小场景,选中 LevelLayout 游戏对象:
When you do this, blue spheres will appear surrounding the default brain room
执行此操作时,默认的 brain room
周围将出现蓝色spheres
These spheres represent Audio Reverb Zones and Audio Sources, which are components attached to all rooms by default. The spheres can get in the way of editing the level layout, so you’re going to disable them.
这些球体表示音频混响区域和音频源,默认情况下,它们是【附加到所有房间的组件】。球体可能会妨碍编辑关卡布局,因此您将禁用
它们。
➡️ Add New Rooms and Corridors
点击 Editing Layout,默认情况下,这将启用“添加”模式。然后单击 CorridorGroup 添加 Corridors,或单击 RoomGroup 添加 Rooms。
- corridor /ˈkɔːrɪdɔːr/ n. 走廊
然后就可以制作自己的关卡了:
点Remove之后,可以删除某一段。关卡都制作好后,再次点击 Editing Layout 退出编辑模式。
保存场景之后运行测试。
➡️ Add a Locked Door
到 Assets > Creator Kit - FPS > Prefabs > Door and Key 下,选择 FatBlob ,这个就是门的预制体,拖到场景中:
➡️ Associate a Key with the Lock
到 Assets > Creator Kit - FPS > Prefabs > Door and Key 下,选择 Key ,这个就是钥匙的预制体,拖到场景中
找到Key脚本组件下面 Key Type,设置一个唯一的名称。
然后选择 FatBlob 游戏对象 | Lock 脚本 | 选择开这个门的钥匙名称:
保存场景,运行测试看看,获得钥匙能否打开门。
✅ Modify the Doctor’s Weapons
➡️ Create a New Weapon
到 Assets > Creator Kit - FPS > Prefabs > Weapons 下,选中 GermOBlaster ,cmd + d 复制一份,命名为 Weapon666:
然后编辑 Weapon666 预制体,找到它下面的 Weapon脚本组件(This is a custom script written for this Creator Kit, with lots of different configurable values
.)
- Change the Trigger Type to Manual (现在,当按下扳机时,武器只会发射一次,而不是尽可能快地射击。)
- Change the Clip Size value from 30 to 8, to reduce the amount of ammo in a single reload clip. ( 将“Clip Size”值从 30 更改为 8,以减少单个装填弹夹中的弹药量。)
- Change the Damage value from 0.5 to 5.
➡️ Make your Weapon Available to the Player
在 Hierarchy 中选择 Character 游戏对象。找到它下面名为 Controller的脚本组件,然后展开 Starting Weapons :
Change the Size from 3 to 4
. This will give the player four weapons at the start of the level to the player.
Drag the new weapon Prefab from the Project window to the Element 3
field that has appeared in the Inspector.
保存场景,运行。用鼠标滚轮切换武器。
✅ Create a Level Endpoint
➡️ Create a LevelEnd GameObject
在 Hierarchy 下 Create Empty ,命名为 LevelEnd。然后 Transform 进行Reset。
按 F 聚焦到 LevelEnd | 添加 Box Collider, 调整size :
把 LevelEnd 放置到合适的位置:
➡️ Add a Trigger
go to the Box Collider
component. Enable the Is Trigger
checkbox.
Click the Add Component
button. Search for “End Checkpoint
”, and add this component to 【LevelEnd
】.
Save your changes.
Now press Play
and test the trigger, by moving into the Box Collider you placed in the level. When you enter that space, the game will end and show you the result screen
.