Example #1
0
 public bool tryPickupItem(Interactable item)
 {
     if (pc.roomOccupied.Take(item))
     {
         audioSource.PlayAudioOnce(ref pickUp, AudioType.SoundEffect);
         pc.inventory.Add(item);
         return(true);
     }
     return(false);
 }
Example #2
0
    public virtual void Interact(string action)
    {
        if (action == "")
        {
            action = defaultInteraction;
        }

        if (isOneTimeUse && hasBeenUsed)
        {
            //You have already used this and can't do it again audio clip.
            Debug.Log("You have already used this and can't do it again.");
        }
        else
        {
            if (verbs.ContainsKey(action) && !verbTargets.ContainsKey(action))
            {
                if (isOneTimeUse)
                {
                    hasBeenUsed = true;
                }

                if (states[verbs[action]] == "event")
                {
                    GameManager.instance.events[verbs[action]].triggerEvent();
                    audioSource.PlayAudioOnce(ref interact, AudioType.SoundEffect);
                }
                else
                {
                    GameManager.instance.states[verbs[action]] = states[verbs[action]];
                    audioSource.PlayAudioOnce(ref interact, AudioType.SoundEffect);
                }
            }
            else
            {
                //You can't do that.
                Debug.Log("That requires something else to do.");
            }
        }
    }
    public void giveMoveInstruction(string instruction)
    {
        Room resultRoom = null;

        resultRoom = getRoomByName(instruction) ?? getRoomByDirection(instruction);

        if (resultRoom == null)
        {
            audioPlayback.PlayAudioOnce(ref bumpIntoWallSound, AudioType.SoundEffect);
        }
        else if (resultRoom == roomOccupied)
        {
            // Locked door scenario
        }
        else
        {
            moveToRoom(resultRoom);
        }
    }
Example #4
0
 public override void triggerEvent()
 {
     base.triggerEvent();
     audioSource.PlayAudioOnce(ref soundOnEntry, AudioType.SoundEffect);
 }