Пример #1
0
 private static IEnumerator FillWithLiquidAfterDelay(GameObject gameObject, float delay) {
     PillBottle pillBottle = gameObject.GetComponent<PillBottle>();
     if (pillBottle.liquidPrepared) {
         yield return new WaitForSeconds(delay);
         pillBottle.fillLiquid();
     }
 }
    public IEnumerator fillLiquidBottles(BagProperties bag)
    {
        bool hadAnyLiquidBottles = false;

        foreach (BagContentProperties bagContentPropertiese in bag.bagContents)
        {
            // TODO - More types to fill?
            PillBottle pillBottle = bagContentPropertiese.GetComponent <PillBottle>();
            if (!System.Object.ReferenceEquals(pillBottle, null))
            {
                bool willFillLiquid = pillBottle.fillLiquid();
                if (willFillLiquid)
                {
                    hadAnyLiquidBottles = true;
                }
            }
        }

        if (hadAnyLiquidBottles)
        {
            yield return(new WaitForSeconds(1.2f));
        }
    }