Ejemplo n.º 1
0
    public void AddWater(Transform waterOrb)
    {
        // This if statement prevents the added water from remaining the selected material. //
        if (MouseLook.selectedItem != null && MouseLook.selectedItem == waterOrb)
        {
            waterOrb.GetComponent <Renderer>().material = gameManager.playerController.defaultMat;

            // Have to have this otherwise default mat doesn't reset and the next item you look out will turn into water. //
            gameManager.playerController.defaultMat = null;
            MouseLook.selectedItem = null;
        }
        // -------------------------------------------------------------------------------- //

        water     = GameObject.Instantiate(waterOrb, waterOrb.position, waterOrb.rotation);
        water.tag = "NonInteractableWater";
        water.GetComponent <SphereCollider>().isTrigger = true;

        // ------------------------------------------ Setting the CookingOrbState ------------------------------------------ //

        if (currentCookingOrbState == CookingOrbState.EMPTY)
        {
            currentCookingOrbState = CookingOrbState.EMPTY_WATER;
        }
        else if (currentCookingOrbState == CookingOrbState.INGREDIENTS_NOWATER)
        {
            currentCookingOrbState = CookingOrbState.INGREDIENTS_AND_WATER;
        }
        else if (currentCookingOrbState == CookingOrbState.INGREDIENTS_AND_WATER || currentCookingOrbState == CookingOrbState.EMPTY_WATER)
        {
            Debug.Log("Tried to add water to cooking orb but there is already water!");
        }
        Debug.Log(currentCookingOrbState);

        // ----------------------------------------------------------------------------------------------------------------- //
    }
Ejemplo n.º 2
0
    void UpdateCookingOrbState()
    {
        if (currentCookingOrbState != CookingOrbState.COOKING)
        {
            // ------------------------------------ Deleting the soup orb if it's currentPortions hit 0 ------------------------------------ //
            if (occupyingSoup != null && occupyingSoup.GetComponent <SoupData>().currentPortions <= 0)
            {
                occupyingSoup.gameObject.SetActive(false);
                occupyingSoup = null;

                // Freeing the cooking orb. //
                currentCookingOrbState = CookingOrbState.EMPTY;

                // Clearing the calculated stats to be ready for the next soup.
                calculatedSweet  = 0;
                calculatedSpicy  = 0;
                calculatedChunky = 0;
            }
            // ----------------------------------------------------------------------------------------------------------------------------- //

            else if (currentIngredients.Count > 0 && currentCookingOrbState == CookingOrbState.EMPTY)
            {
                currentCookingOrbState = CookingOrbState.INGREDIENTS_NOWATER;
            }
            else if (currentIngredients.Count > 0 && currentCookingOrbState == CookingOrbState.EMPTY_WATER)
            {
                currentCookingOrbState = CookingOrbState.INGREDIENTS_AND_WATER;
            }
            else if (currentIngredients.Count == 0 && currentCookingOrbState == CookingOrbState.INGREDIENTS_AND_WATER)
            {
                currentCookingOrbState = CookingOrbState.EMPTY_WATER;
            }
        }
    }
Ejemplo n.º 3
0
    // ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ //

    public void BeginCooking()
    {
        // Making the cooking orb state OCCUPIED. //
        currentCookingOrbState = CookingOrbState.COOKING;

        // Activating the fire particles. //
        fireParticles.gameObject.SetActive(true);

        SoundManager.SetSound(soundManager.cookingOrbSource, soundManager.cookingOrbCookingSound, true);
        SoundManager.PlaySound(soundManager.cookingOrbSource);

        SoundManager.SetSound(soundManager.cookingOrbSource2, soundManager.cookingOrbCookingSound2, true);
        SoundManager.PlaySound(soundManager.cookingOrbSource2);

        SoundManager.SetSound(soundManager.cookingOrbHatchSource, soundManager.hatchOpen, false);
        SoundManager.PlaySound(soundManager.cookingOrbHatchSource);
    }
Ejemplo n.º 4
0
    // Start is called before the first frame update
    public void Start()
    {
        gameManager  = GameManager.GetInstance();
        soundManager = gameManager.soundManager;


        currentIngredients          = new List <Transform>();
        currentlyTrackedIngredients = new List <Transform>();

        // Initialising cooking orb things. //
        currentCookingOrbState = CookingOrbState.EMPTY;
        currentSpicy           = 0;
        currentChunky          = 0;
        currentSweet           = 0;


        shrinkingIngredients = new List <Transform>();

        // Turning off the fire particles. //
        fireParticles.gameObject.SetActive(false);

        // Initialising the lightsMaterial.
        lightsMaterial = cookingOrbBase.GetComponent <Renderer>().material;
    }
Ejemplo n.º 5
0
    // Update is called once per frame
    public void Update()
    {
        // Adding tracked ingredients to the cooking orb. //
        if (currentCookingOrbState == CookingOrbState.EMPTY_WATER || currentCookingOrbState == CookingOrbState.INGREDIENTS_AND_WATER)
        {
            AddTrackedIngredients();
        }

        // Doing cooking timer. //
        if (currentCookingOrbState == CookingOrbState.COOKING)
        {
            cookingTimer += Time.deltaTime;
            if (cookingTimer >= spinningStartTime)
            {
                xRotation += ((360 * Time.deltaTime) / (cookingDuration - spinningStartTime)) * spinningSpeed;
                cookingOrb.localRotation = Quaternion.Euler(xRotation, cookingOrb.localRotation.y, cookingOrb.localRotation.z);
            }
            if (cookingTimer >= cookingDuration)
            {
                // De-activating the fire particles. //
                fireParticles.gameObject.SetActive(false);


                SoundManager.StopPlayingSound(soundManager.cookingOrbSource);
                SoundManager.StopPlayingSound(soundManager.cookingOrbSource2);

                SoundManager.SetSound(soundManager.cookingOrbSource, soundManager.cookingOrbSuccessSound, false);
                SoundManager.PlaySound(soundManager.cookingOrbSource);


                SoundManager.SetSound(soundManager.cookingOrbHatchSource, soundManager.hatchOpen, false);
                SoundManager.PlaySound(soundManager.cookingOrbHatchSource);

                MakeSoup();

                // Resetting cookingTimer after cook. //
                cookingTimer = 0;

                currentCookingOrbState = CookingOrbState.OCCUPIED_SOUP;
                occupyingSoup.gameObject.SetActive(true);
                cookingOrb.GetComponent <Animator>().SetBool("IsOpen", false);
            }
        }


        // Moving water to the centre of the orb. //
        if (isCentered == false && water != null)
        {
            Debug.Log("CENTERING WATER...");
            MoveWaterToCenter();
        }

        // Cooking orb updates. //

        UpdateCookingOrbState();

        UpdateCookingOrbAnimation();


        ShrinkIngredients();

        // Displaying current calculated stats. //
        DisplaySoupStats(calculatedSpicy, calculatedChunky, calculatedSweet);
    }