private IEnumerator SwitchBeerTapBarrel(PickUp barrel) { progressBar.Show(); while (switchingProgress <= switchTime && isHolding) { switchingProgress += Time.deltaTime; progressBar.UpdateProgress(switchingProgress / switchTime); if (switchingProgress > switchTime) { beerTap.Refill(); BeerBarrel beerBarrel = barrel as BeerBarrel; beerBarrel.Release(); Destroy(barrel.gameObject); ResetRefilling(); break; } yield return(null); } }
private void Update() { if (beerBarrel == null) { beerBarrel = Instantiate(beerBarrelPrefab); beerBarrel.transform.position = this.transform.position; beerBarrelSpawn?.Invoke(beerBarrel); } }