コード例 #1
0
    // 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;
        }
    }
コード例 #2
0
 void Start()
 {
     pourSim                    = GetComponentInChildren <PourSimulator>();
     requestedBaseType          = Ingredients.BaseType.NO_BASE;
     requestedMixerType         = Ingredients.MixerType.NO_MIXER;
     requestedAlcoholPercentage = -1f;
 }
コード例 #3
0
    //for future use in evaluating cocktails for narrative purposes
    // public static void EvaluateCocktail(List<Ingredients.BaseType> base_, List<Ingredients.DiluteType> dilute_,
    //                                  List<Ingredients.ToppingType> topping_, float alcoholLevel_,
    //                                  float satisfactionLevel_){

    // }
    public void AddBase(Ingredients.BaseType baseType_)
    {
        switch (baseType_)
        {
        case Ingredients.BaseType.GIN:
            ginVolume = ginVolume + pourSim.drinkZ;
            ginVolume = Mathf.Clamp(ginVolume, 0, 26f);
            break;

        case Ingredients.BaseType.WHISKY:
            whiskyVolume = whiskyVolume + pourSim.drinkZ;
            whiskyVolume = Mathf.Clamp(whiskyVolume, 0, 26f);
            break;

        case Ingredients.BaseType.RUM:
            rumVolume = rumVolume + pourSim.drinkZ;
            rumVolume = Mathf.Clamp(rumVolume, 0, 26f);
            break;

        default:
            break;
        }
    }
コード例 #4
0
    public void FillUpWithBase(Ingredients.BaseType _baseType)
    {
        pourState = PourState.Pouring_Base;
        // scale += scaleGrowthRate * Time.deltaTime;
        // Debug.Log("Filling up drink with base!");
        myBaseType = _baseType;
        switch (_baseType)
        {
        case Ingredients.BaseType.GIN:
            myMesh.material.color = Color.white;
            //  Debug.Log("Pouring gin!");
            break;

        case Ingredients.BaseType.WHISKY:
            myMesh.material.color = Color.yellow;
            //  Debug.Log("Pouring whisky!");
            break;

        case Ingredients.BaseType.RUM:
            myMesh.material.color = Color.red;
            //  Debug.Log("Pouring rum!");
            break;

        default:
            break;
        }

        if (drinkZ < maxDrinkZ)
        {
            FillUp();
            cocktail.AddBase(_baseType);
        }
        else if (drinkZ >= maxDrinkZ)
        {
            Debug.Log("Drink is full!");
        }
    }
コード例 #5
0
    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_);
    }