使用unity构建射击小游戏

发布时间 2023-03-22 21:17:29作者: zylyehuo

使用unity构建射击小游戏

成果图

参考例程

www.manning.com/hocking

问题汇总

1、renderer.material 方法过时

换成使用 this.GetComponent()

参考网址:
https://blog.csdn.net/Czhenya/article/details/77995517

2、敌人射出子弹后,子弹悬浮现象

检查 WanderingAI.cs 文件

3、点击鼠标,出现连续发出多发子弹

可检查 RayShooter.cs 文件,改变方法名 ==> 将Down删除(存在版本差异)

4、Player对象检测为null或空时

检查 WanderingAI.cs 文件这段代码

例程与书中不同地方(仅供参考)

1、FPSInput.cs文件

2、MouseLook.cs文件