我需要为我在Unity C#中制作的简单游戏设置损失条件
我正在制作一个简单的团结手机游戏。屏幕底部有一个大炮,您可以在屏幕顶部移动的平台上射出小子弹。对于我的失去状况,我需要按照“如果5个子弹在Y轴上超过5F”的方式说些什么,然后再进行游戏。
我知道如何在游戏结束时重新启动游戏,并且我尝试制作它,以便当您用完弹药并且并非所有平台都被破坏时,游戏结束了。但是问题是,如果您还剩一颗子弹,然后拍摄它,则在拍摄最后一颗子弹时就会触发游戏结束程序。因此,即使最后一个子弹击中了最后一个平台,游戏仍然结束并重新启动。在第一级,您有5个子弹,并且有一个平台。
我认为最好的方法是检查所有子弹是否在平台目标上方的Y轴上均高于5F。如果所有的5个子弹都高于此,则游戏结束。
I am working on a simple mobile game in Unity. There is a cannon at the bottom of the screen and you shoot small bullets at moving platforms at the top of the screen. For my lose condition I need to say something along the lines of "If 5 bullets are above 5f on y axis" then game over.
I know how to make the game restart when the game ends and I have tried making it so that when you run out of ammo and not all of the platforms are destroyed, the game ends. But the problem with this is that if you have one bullet left and you shoot it, the game end program gets triggered right when you shoot the last bullet. So even if the last bullet hits the last platform, the game still ends and restarts. On the first level you have 5 bullets and there is one platform.
I am thinking the best way to do it would be to check if all of the bullets fired are above 5f on y axis, which is above the platform target. If all 5 bullets fired are above this, then the game ends.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您的建议很有意义!看来您正在寻找场景,在这种情况下,玩家不再有实现目标的机会。因此,您的失落状态可能是两者:
Your suggestion makes sense! It seems like you're looking for the scenario where the player no longer stands a chance of completing their goal. So, your lose condition might be if both: