// Update is called once per frame void Update() { switch (pourState) { case PourState.Pouring_Base: // if(drinkZ < maxDrinkZ && GetComponentInParent<Glass>().tweenToHandIsDone){ if (drinkZ < maxDrinkZ) { FillUp(); cocktail.AddBase(myBaseType); } break; case PourState.Pouring_Mixer: if (drinkZ < maxDrinkZ) { FillUp(); cocktail.AddMixer(myMixerType); } break; case PourState.Not_pouring: myMixerType = Ingredients.MixerType.NO_MIXER; myBaseType = Ingredients.BaseType.NO_BASE; break; default: break; } }
void Start() { pourSim = GetComponentInChildren <PourSimulator>(); requestedBaseType = Ingredients.BaseType.NO_BASE; requestedMixerType = Ingredients.MixerType.NO_MIXER; requestedAlcoholPercentage = -1f; }
public void AddMixer(Ingredients.MixerType mixerType_) { switch (mixerType_) { case Ingredients.MixerType.JUICE: juiceVolume = juiceVolume + pourSim.drinkZ; break; case Ingredients.MixerType.SODA: sodaVolume = sodaVolume + pourSim.drinkZ; break; case Ingredients.MixerType.TONIC_WATER: tonicVolume = tonicVolume + pourSim.drinkZ; break; default: break; } }
public void FillUpWithMixer(Ingredients.MixerType _mixerType) { pourState = PourState.Pouring_Mixer; myMixerType = _mixerType; Debug.Log("Filling up drink with mixer!"); switch (_mixerType) { case Ingredients.MixerType.SODA: myMesh.material.color = Color.red; Debug.Log("pouring soda!"); break; case Ingredients.MixerType.JUICE: myMesh.material.color = Color.yellow; Debug.Log("pouring juice!"); break; case Ingredients.MixerType.TONIC_WATER: myMesh.material.color = Color.blue; Debug.Log("pouring tonic water!"); break; default: break; } // scale += scaleGrowthRate * Time.deltaTime; // FillUp(); if (drinkZ < maxDrinkZ) { FillUp(); cocktail.AddMixer(_mixerType); } else if (drinkZ >= maxDrinkZ) { Debug.Log("Drink is full!"); } }
public bool isRightDrink(float alcoholPercentage, Ingredients.BaseType baseType, Ingredients.MixerType mixerType) { //first check what kind of request it was. bool isRightDrink_ = false; //customer doesn't care how much alcohol is in drink, but cares about BOTH ingredients if (requestedAlcoholPercentage == -1f) { //then check for requested ingredients if (baseType == requestedBaseType && mixerType == requestedMixerType) { Debug.Log("Drink is correct!"); } return(true); } //customer doesn't care about how much alcohol is in drink, but cares about the base if (requestedAlcoholPercentage == -1f && mixerType == requestedMixerType) { if (baseType == requestedBaseType) { Debug.Log("Drink is correct!"); } return(true); } //customer cares how much alcohol is in drink, doesn't care about ingredients if (requestedAlcoholPercentage > 0) { if (Mathf.Abs(requestedAlcoholPercentage - alcoholPercentage) <= errorMargin) { Debug.Log("Drink is correct!"); } return(true); } return(isRightDrink_); }