예제 #1
0
    public void HideRecipe()
    {
        if (isTutorial)
        {
            //Playlist.instance.NextSong();
            isTutorial = false;
        }
        if (lastRecipe != null)
        {
            MiniRecipe templateMR;
            MiniRecipe instanceMR;
            if (MiniRecipe.minirecipes < 11)
            {
                templateMR = this.minirecipe;
            }
            else
            {
                templateMR = this.minirecipe2;
            }
            instanceMR = (MiniRecipe)Instantiate(templateMR);

            instanceMR.GetComponent <RectTransform>().parent = templateMR.GetComponent <RectTransform>().parent;
            instanceMR.transform.localPosition = templateMR.transform.localPosition;
            instanceMR.transform.localPosition = instanceMR.transform.localPosition + new Vector3(0, -5 * (MiniRecipe.minirecipes % 12), 0);
            instanceMR.Show(lastRecipe);
        }
        AudioBend.Play();
        EventSystem.current.SetSelectedGameObject(null, new BaseEventData(EventSystem.current));
    }
예제 #2
0
    public static void ShowRecipe(DrinkRecipe _recipe)
    {
        if (_recipe != null)
        {
            if (instance.lastRecipe == null)
            {
                beforeTutorial        = false;
                isTutorial            = true;
                instance.tutorialStep = 0;
                instance.lastRecipe   = _recipe;
                instance.NextHelp();
            }
            else
            {
                instance.popup.Show();
                instance.drinkName.text = _recipe.drinkName;
                string r = "Recipe:\n";
                for (int i = 0; i < _recipe.ingredients.Length; ++i)
                {
                    r += "" + (int)(_recipe.amounts[i] / 50) + "x " + _recipe.ingredients[i].ToString();
                    if (i < _recipe.ingredients.Length - 1)
                    {
                        r += "\n";
                    }
                }
                instance.recipe.text = r;

                AudioBend.Pause();
                instance.lastRecipe = _recipe;
            }
        }
    }
예제 #3
0
    // Use this for initialization
    void Start()
    {
        instance = this;
        source   = GetComponent <AudioSource>();
        bend     = GetComponent <AudioBend>();

        //time = Time.time;
        //time = +delay;
    }
예제 #4
0
 public void NextHelp()
 {
     if (tutorialStep == 0)
     {
         AudioBend.Pause();
     }
     if (tutorialStep < tutorial.Length)
     {
         tutorial[tutorialStep].Show();
         ++tutorialStep;
     }
     else if (lastRecipe != null)
     {
         ShowRecipe(lastRecipe);
     }
 }
예제 #5
0
    // Update is called once per frame
    void Update()
    {
        //timeCounter += Time.deltaTime;
        if (Playlist.beat)
        {
            time++;
        }
        if (level < levels.Length)
        {
            //if (timeCounter > timeBetweenDrinks[level])
            if (time >= timeBetweenDrinks[level])
            {
                time = 0;
                if (drinksServed == 0)
                {
                    SpawnGlass(level);
                }
                else
                {
                    SpawnGlass();
                }
                drinksServed++;
            }
            if (drinksServed > drinksPerLevel[level])
            {
                if (level < levels.Length)
                {
                    drinksServed = 0;
                    level++;
                    if (level < levels.Length)
                    {
                        //time = 0;// -timeBetweenDrinks[level];
                        //AudioBend.GoToPitch(drinkSpawningSpeed[level],level*4);
                    }
                }
                else
                {
                    Debug.Log("WIN!");
                    AudioBend.GoToPitch(0);

                    if (!ended)
                    {
                        ended = true;
                        end.SetActive(true);
                        Playlist.instance.End();
                        Time.timeScale = 0;
                    }
                }
            }

            if (CoffeeReceiver.HP == 0 && !ended)
            {
                ended = true;
                end.SetActive(true);
                Time.timeScale = 0;
                Playlist.instance.End();
            }
            if (level < levels.Length)
            {
                text.text = "HP: "; for (int hp = 0; hp < 5; ++hp)
                {
                    text.text += CoffeeReceiver.HP > hp ? "I" : "-";
                }
                text.text += " | LVL " + (level + 1);
                text.text += " | " + CoffeeReceiver.TOTALSCORE.ToString("00000") + " pts";
            }
            else
            {
                text.text = " WINNER! | " + CoffeeReceiver.TOTALSCORE.ToString("0000") + " pts";
            }
        }
        if (ended)
        {
        }
    }
예제 #6
0
 private void Awake()
 {
     instance = this;
 }