给敌人盾牌


项目一:太空射手

给敌人盾牌

或者至少其中一些

Gameplay showing random enemies that spawn with a shield and the shields can be destroyed.

Random enemies are spawned with a shield.

盾牌的视觉效果、动画和其他内容与我为玩家所做的完全一样。那是作为实际敌人对象的子对象。默认设置为关闭。

一旦敌人被 Spawn Manager 实例化,它会随机分配一些敌人拥有盾牌。我已将此设置为大约每三个要生成的敌人发生一次。激活是通过调用敌人的公共方法 ActivateShields 来实现的。

The code for giving some enemies shields after they have been instantiated.

How to randomly give some enemies shields when they are spawned.

public 方法只是一个简单的方法,它将敌人的 Shield 子对象设置为与 Unity 的 设置激活 方法。

A simple method for activating the enemies shield.

A simple method to activate the shield.

一旦敌人被玩家的激光射击或玩家撞击敌人击中,盾牌就会在敌人的 OnEnemyDeath 方法中被禁用。

Staged gameplay to show that the enemy shields can be either shot or rammed by the player to disable them, also showing that the enemies will be destroyed if hit a second time.

Shield destruction and enemies death in action.

使用 SetActive 方法完成禁用后,OnEnemyDeath 方法将返回调用方法,并使用 返回 跳转语句。当它以这种方式完成时,不需要其他方法来处理盾牌被击中时发生的情况。

A method that shows what happens when the enemy is hit, with or without the shield.

The method that handles what happens when the enemies are hit.

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明

本文链接:https://www.qanswer.top/20760/49150700

原创文章,作者:ItWorker,如若转载,请注明出处:https://blog.ytso.com/288067.html

(0)
上一篇 2022年9月7日
下一篇 2022年9月7日

相关推荐

发表回复

登录后才能评论