コード例 #1
0
    void unLid()
    {
        if (controller.currentCust() != null)
        {
            current_ammount = 0;
            controller.currentCust().giveCustomerSmoothie(mixer.empty());
            mixer.empty();
            fillSprite.transform.localPosition = new Vector3(0, (current_ammount * (max_y_coordinates - min_y_coordinates) / max_fill) + min_y_coordinates, 0);
        }

        int launchDir = ((int)(Random.value * 2) * 2) - 1;

        lidPrefab.SetActive(true);
        lidPrefab.transform.rotation = Quaternion.Euler(new Vector3(0, 0, 0));
        lidPrefab.transform.position = lid.transform.position;
        lidPrefab.GetComponent <Rigidbody2D>().AddForce(new Vector3(launchDir * 1000, 200, 0));


        lid.SetActive(false);
        lidded = false;
    }