コード例 #1
0
    public void Serve(Drink drink)
    {
        int stars = 1;

        if (drink.GetElement() == this.desiredElement)
        {
            stars += 2;
        }

        int prevCount = this.desiredBuffs.Count;

        foreach (Buffs buff in drink.GetBuffs())
        {
            this.desiredBuffs.Remove(buff);
        }

        if (this.desiredBuffs.Count < prevCount)
        {
            stars += 2;
        }

        switch (stars)
        {
        case 5:
            Debug.Log("Super satisfied");
            break;

        case 3:
            Debug.Log("Passable");
            break;

        case 1:
            Debug.Log("Abysmal");
            break;

        default:
            Debug.Log("Error");
            break;
        }

        totalCustomers++;
        totalStars           += stars;
        averageRating         = (float)totalStars / (totalCustomers * 5.0f);
        starRating.fillAmount = averageRating;
        Debug.Log(totalStars);
        Debug.Log(totalCustomers);

        this.Enter();
    }