using Mirror; using UnityEngine; namespace Valheim { // 再生法阵效果,每秒恢复血量10; public class Regeneration : NetworkBehaviour { /// /// 回复血量 /// #if UNITY_EDITOR [DisplayOnly] #endif public int repliesVolume = 25; /// /// 检测范围 /// public float checkRange = 2F; /// /// 检测时间 /// private float timer = 0; /// /// 回血间隔 /// #if UNITY_EDITOR [DisplayOnly] #endif public float interval = 1F; public Transform[] Points; //每过1秒 检测一次 public void Update() { if (isServer) { timer += Time.deltaTime; if (timer >= interval) { GameManager.Ins.RegenerationHealth(2, 1, repliesVolume, transform.gameObject); timer = 0; } } } } }