public void FixedUpdate() // Fixed update responds to timescale
    {
        if (BlinkWhenPlayerNear && playerInCollider)
        {
            timer += Time.deltaTime;
            if (timer > .6)
            {
                timer = 0;
                if (blinkOn)
                {
                    _meshRenderer.material = mat_original;
                    blinkOn = false;
                }
                else
                {
                    _meshRenderer.material = mat_blink;
                    blinkOn = true;
                }
            }
        }


        if (interactionDelayFrames <= 0 && playerInCollider && Input.GetAxis("Interact") > 0)
        {
            interactionDelayFrames = interactionDelayFramesMax;
            if (hasItem && itemToReceive != null)
            {
                foreach (var item in itemToReceive)
                {
                    inventory.AddItem(item, 1);
                }

                itemToReceive = null;
            }
            CallOnInteract.Invoke();

            if (BlinkOnInteract)
            {
                StartCoroutine(nameof(BlinkOnce), BlinkOnce());
            }

            if (DestoryObjectAfterUse)
            {
                interactText.ToggleVisibility(false);
                Destroy(gameObject);
            }

            if (killAfterUse)
            {
                Kill();
            }
        }
        else if (interactionDelayFrames > 0)
        {
            interactionDelayFrames--;
        }
    }
Exemplo n.º 2
0
    private void MiniGameFinished()
    {
        Systems.Status.UnPause();

        SceneManager.UnloadSceneAsync(MiniGameSceneName);

        Systems.Objectives.Satisfy("WATERHEATEREVENT");
        camera.SetActive(true);
        canvi.SetActive(true);
        // sunlight.SetActive(true);
        levelMusic.SetActive(true);
        waterMusic.SetActive(false);


        _inventory.RemoveItem(MustardWater, 1);
        _inventory.AddItem(FilledWater, 1);

        Heater.SetActive(true);
        //_interact.Kill();

        UIManager.Instance.ToggleActive(theGUI);

        GameObject.Find("InventoryZip").GetComponent <AudioSource>().Play();

        _interact.Kill();

        Spot.SetActive(false);
        if (Systems.Objectives.Check("LatrineTalk"))
        {
            if (Systems.Inventory.HasItem(Resources.Load <Item>("Items/Rope"), 1) && !Systems.Inventory.HasItem(Resources.Load <Item>("Items/Shovel"), 1))
            {
                _canvas.ChangeText("Find a shovel");
            }
            else if (!Systems.Inventory.HasItem(Resources.Load <Item>("Items/Rope"), 1) && Systems.Inventory.HasItem(Resources.Load <Item>("Items/Shovel"), 1))
            {
                _canvas.ChangeText("Find a rope");
            }
            if (!Systems.Inventory.HasItem(Resources.Load <Item>("Items/Rope"), 1) && !Systems.Inventory.HasItem(Resources.Load <Item>("Items/Shovel"), 1))
            {
                _canvas.ChangeText("Find a shovel and a rope");
            }
        }
        else
        {
            _canvas.ChangeText(words);
        }

        //Destroy(gameObject);
        //Destroy(this);
    }