Example #1
0
 void VerifyCup(CupController cup)
 {
     if (order.Compare(cup.drink))
     {
         this.order = DrinkGenerator.Generate();
         textBoxManager.Add("HMM MM GOOD.\nTIP FOR YOU.\nNow, give me a " + order.ToString() + ".");
         sprite.sprite = happy;
         Sounds.EatSound();
         Sounds.ChangeSound();
         streak++;
         streakText.text = "Current Streak: " + streak;
         Tip();
     }
     else
     {
         textBoxManager.Add("NO! You gave me a " + cup.drink.ToString() + ".\nGive me a " + order.ToString() + ".");
         if (angry != null)
         {
             sprite.sprite = angry;
         }
         Sounds.WrongSound();
         streak          = 0;
         streakText.text = "Current Streak: " + streak;
     }
 }
 public void SetUp()
 {
     context    = new MockDreamLeagueContext();
     cupService = new Mock <ICupService>();
     cupService.Setup(x => x.GetData(It.IsAny <int>())).Returns <int>(id => new CupViewModel(CupData.Data().FirstOrDefault(c => c.CupId == id)));
     controller = new CupController(context.MockContext.Object, cupService.Object);
 }
    void OnMouseDown()
    {
        //look at sibling objects for a snapped cup
        foreach (Transform child in transform.parent)
        {
            if (child.tag == "cup")
            {
                snappedCup = child.gameObject;
                cupScript  = snappedCup.GetComponent <CupController>();
                break;
            }
        }

        //if there's a cup with milk, and it doesn't have a lid, steam it up fam
        if (snappedCup != null && !cupScript.hasLid && cupScript.OnlyMilk() && !foaming)
        {
            cupScript.Steam(steamLength);
            foaming = true;
            StartCoroutine(StopFoaming(steamLength));
        }
    }
    void OnMouseDown()
    {
        //check to see if it's got the required components:
        //filter
        if ((filter = GetFilter()) == null)
        {
            return;
        }
        //script
        if ((filterScript = filter.GetComponent <FilterController>()) == null)
        {
            return;
        }
        //if the filter is locked
        if (!filterScript.locked)
        {
            return;
        }
        //if there's a cup attached to the bottom
        if ((cup = GetCup()) == null)
        {
            return;
        }
        //if the cup has a script
        if ((cupScript = cup.GetComponent <CupController>()) == null)
        {
            return;
        }
        //if the cup has a lid on it
        if (cupScript.hasLid)
        {
            return;
        }
        //if it's in the middle of a pour animation already
        if (filterScript.pouring)
        {
            return;
        }
        //make sure it has coffee grounds in it
        if (!filterScript.hasGrounds)
        {
            return;
        }

        //and now enable the pour animation
        filterScript.cupScript = this.cupScript;
        filterScript.AnimatePour(sizes[cupScript.size]);
        //and change the cup contents accordingly
        if (filterScript.doubleShot)
        {
            cupScript.drink.AddEspressoShots(2);
        }
        else
        {
            cupScript.drink.AddEspressoShots(1);
        }

        Sounds.PourSound();

        //remove the espresso grounds from the filter so they have to be added again
        filterScript.RemoveGrounds();
    }