Example #1
0
    public void Toggle()
    {
        IsOpen = !IsOpen;

        openGraphics.SetActive(IsOpen);
        closedGraphics.SetActive(!IsOpen);

        doorCollisionObject.SetActive(!IsOpen);

        Promaja.Refresh();

        if (IsOpen)
        {
            if (openClip)
            {
                openClip.Play2D(0.5f);
            }
        }
        else
        {
            if (closeClip)
            {
                closeClip.Play2D(0.5f);
            }
        }

        if (mixer)
        {
            mixer.SetFloat("City Lowpass", IsOpen ? 13000 : 200);
            mixer.SetFloat("City Volume", IsOpen ? 0 : -5);
        }
    }
Example #2
0
    public Interactable Take(Hands hands)
    {
        if (hands.heldItem)
        {
            return(null);                // cant take in occupied hands
        }
        if (inSlot)
        {
            OnRemovedFromSlot(inSlot);
            inSlot.OnItemRemoved();
            inSlot.itemInSlot = null;
        }

        inSlot = null;

        transform.SetParent(hands.transform);
        transform.localPosition = hands.holdOffset;
        isHeld  = true;
        inHands = hands;

        if (pickupClip)
        {
            pickupClip.Play2D(soundVolume);
        }

        Debug.Log($"Took {name}");

        return(this);
    }
Example #3
0
    IEnumerator Co()
    {
        while (true)
        {
            float rate = Random.Range(minRate, maxRate);
            if (rate == 0)
            {
                rate = 0.0001f;
            }

            float time = 1 / rate;
            int   num  = 1;

            // If time is less than frame time, do multiple
            if (time < Time.deltaTime)
            {
                num = Mathf.RoundToInt(Time.deltaTime / time);
            }

            yield return(new WaitForSecondsRealtime(time));

            for (int i = 0; i < num; i++)
            {
                if (useMultiple)
                {
                    testClips.Play2D();
                }
                else
                {
                    testClip.Play2D();
                }
            }
        }
    }
Example #4
0
    public bool PlaceInSlot(Slot slot)
    {
        // cant place in occupied slot
        if (slot.itemInSlot)
        {
            return(false);
        }
        // cant place if that slot doesn't interact with this item
        if (slot.useInteractionControl && !InteractionControl.I.CanInteract(gameObject, slot.gameObject))
        {
            return(false);
        }

        if (slot.onlyInteractsWith && slot.onlyInteractsWith != this)
        {
            return(false);
        }

        transform.SetParent(slot.transform);
        transform.localPosition = Vector3.zero; // temp, TODO: Animate
        isHeld = false;
        inSlot = slot;

        slot.itemInSlot = this;

        OnPlacedInSlot(slot);
        slot.OnItemPlaced();

        if (putClip)
        {
            putClip.Play2D(soundVolume);
        }
        return(true);
    }
Example #5
0
    public override void OnItemPlaced()
    {
        closedSprite.enabled  = true;
        overlaySprite.enabled = true;

        openSprite.enabled = false;

        rernaClose?.Play2D(openCloseVolume);
    }
Example #6
0
 public override void OnItemRemoved()
 {
     base.OnItemRemoved();
     if (itemInSlot && itemInSlot is Dzezva)
     {
         turnOffClip.Play2D();
         //vriSource.enabled = false;
         //shumiSource.enabled = false;
     }
 }
Example #7
0
 public override void OnItemPlaced()
 {
     base.OnItemPlaced();
     if (itemInSlot && itemInSlot is Dzezva)
     {
         vriSource.enabled   = true;
         shumiSource.enabled = true;
         turnOnClip.Play2D();
     }
 }
Example #8
0
    public void Ignite()
    {
        if (Promaja.IsActive)
        {
            Debug.LogWarning("Can't ignite cuz promaja");
            return;
        }

        if (initialTime == -1)
        {
            initialTime = Time.time;
        }

        flame.SetActive(true);
        isBurning = true;
        igniteClip.Play2D(1);

        smoke.SetActive(false);
    }
Example #9
0
    public void SwitchChannel()
    {
        channel++;

        if (channel >= channelSprites.Length)
        {
            channel = 0;
        }

        SetChannel();

        if (channel == 0)
        {
            switchOffClip.Play2D(switchVolume);
        }
        else
        {
            switchClip.Play2D(switchVolume);
        }
    }