代码来源于“易宁”大佬的分享,仅供学习,不要直接复制粘贴。

原帖链接:http://bbs.3dmgame.com/thread-3859071-1-1.html



一二二.墙自动回血

	用MT管理器打开游戏目录/assets/DLC0002/scripts/prefabs/walls.lua文件,在if old_percent > 0 and new_percent <= 0 then clearobstacle(inst) end的下一行插入以下内容:

		if new_percent < 1 then inst.components.health:StartRegen(200, 1) end
		if new_percent >= 1 then inst.components.health:StopRegen() end

	即可让墙自动回血,其中2001为每1秒回200的血,数字可自行调整