コード例 #1
0
    /// <summary>
    /// Moves the selected bottle up, and the squirt bottle down
    /// </summary>
    /// <param name="index">The bottle to move</param>
    private IEnumerator MoveSauceUp_(int index)
    {
        _selectedSauce = (SauceType)index;

        var bottle = Chef.SauceBottles[index];

        // move bottle up
        while (bottle.localPosition.y < 8)
        {
            bottle.Translate(new Vector3(0, 14 * Time.deltaTime, 0));
            yield return(new WaitForSeconds(0.01f));
        }

        // change sauce appearance
        Chef.SquirtBottle.BottleImage.sprite = LicenseToGrillController.Instance.SauceImages[index];
        Chef.SquirtBottle.SauceImage.color   = ColourFetcher.GetSauceColour(index);

        // change particle colour
        var particleMain = Chef.SquirtBottle.SquirtParticle.main;

        particleMain.startColor = ColourFetcher.GetSauceColour(index);

        // move big bottle down
        while (Chef.SquirtBottle.transform.localPosition.y > SAUCE_SQUIRT_BOTTLE_Y_POSITION)
        {
            Chef.SquirtBottle.transform.Translate(new Vector3(0, -14 * Time.deltaTime, 0));
            yield return(new WaitForSeconds(0.01f));
        }

        _action = ChefAction.SquirtingSauce;
        Chef.SaucePlatform.gameObject.SetActive(true);
        Chef.Help_Sauce.SetActive(true);
    }