private void Update() { if (isOn) { timer += Time.deltaTime; if (timer >= duration) { isOn = false; timer = 0; OnFreezeStateChanged?.Invoke(isOn); } } }
public void FreezeEnemies(float duration) { this.duration = duration; isOn = true; OnFreezeStateChanged?.Invoke(isOn); }