async private void ConsumeAfterWait() { await Task.Delay(TimeSpan.FromSeconds(m_EatFishEvery)); m_FishCounter = Math.Max(m_FishCounter - m_FishConsumptionPerMeal, 0); OnFishCountChanged?.Invoke(m_DesiredFishCount, m_FishCounter); ConsumeAfterWait(); }
public void AddFish(GameObject _harvestedFish) { OnFishCountChanged?.Invoke(m_DesiredFishCount, ++m_FishCounter); if (_harvestedFish != null) { m_Unclaimed.Remove(_harvestedFish); m_Claimed.Remove(_harvestedFish); if (Application.isEditor) { DestroyImmediate(_harvestedFish); } else { Destroy(_harvestedFish); } } }