Exemplo n.º 1
0
    /// <summary>
    /// Handleinput for the objects in the level
    /// </summary>
    /// <param name="inputHelper">The inputhelper to react to input</param>
    public override void HandleInput(InputHelper inputHelper)
    {
        if (inputHelper.KeyPressed(Keys.F) && NoteInVicinity)
        {
            foreach (GameObject obj in gameObjects)
            {
                if (obj is NoteObject)
                {
                    foreach (Sound sound in MusicPlayer.SoundEffect)
                    {
                        if (sound.Name == "paperrustle")
                        {
                            sound.PlaySound();
                        }
                    }
                    NoteObject note = obj as NoteObject;
                    note.PickUp();
                }
            }
        }

        if (inputHelper.KeyPressed(Keys.R))
        {
            this.completed = true;
        }

        Find("Player").HandleInput(inputHelper);
    }