Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我如何在我的 FirstPersonCharacter 处于触发区时不断损害它的健康?onBeginOverlap只有当它进入触发区域时,它才会失去伤害。这是我的蓝图:
onBeginOverlap
使用您的 DamageOverTime 函数创建 Timer 并每隔X秒调用一次,直到 onEndOverlap 发生。
简单的例子:
在这里您可以找到更多关于 BP 中的计时器的信息
在 c++ 中,我会将它连接到时间句柄或使用增量秒的 Tick 事件,但我还没有进入蓝图,所以我可以给你一个小建议开始。
您需要一个循环并检查角色是否在区域中。最简单的方法是设置一个 bool 变量,当它进入时将其设置为 true,并在变量为 true 时继续破坏,当它设置回 false 时(当他离开区域时)停止它。
希望它有点帮助。