public static IMusic GetMusic(FileInfo fileInfo, MusicControl control)
 {
     return(fileInfo.Extension.ToLower() switch
     {
         ".flac" => new FlacMusic(fileInfo, control),
         _ => null,
     });
    public IEnumerator Test_SuspenseMusicPlaysInTeleportLocation()
    {
        MusicControl       mc       = CreateMusicControl();
        Player             player   = CreatePlayer();
        GameController     gameCtr  = CreateGameController(player);
        TeleportToPosition teleport = CreateTeleporter(new Vector3(1, 1, 1));

        teleport.GameCtr = gameCtr;

        yield return(new WaitForEndOfFrame());

        teleport.PlayerTeleport();

        yield return(new WaitForEndOfFrame());

        Assert.IsTrue(mc.source.isPlaying, "Music did not play in teleport location!");
        Assert.AreEqual(mc.suspenseBgMusic, mc.source.clip, "Teleporting down did not start suspense background music!");
        Assert.AreEqual(mc.suspenseMusicVolume, mc.source.volume, "Music did not have the right volume after teleporting down!");
        Assert.IsTrue(mc.source.loop, "Suspense music wasn't looping!");

        teleport.PlayerTeleport();

        yield return(new WaitForEndOfFrame());

        Assert.IsTrue(mc.source.isPlaying, "Music did not play after teleporting back up!");
        Assert.AreEqual(mc.normalBgMusic, mc.source.clip, "Did not return to normal background music after teleporting back up!");
        Assert.AreEqual(mc.normalMusicVolume, mc.source.volume, "Music did not have the right volume after teleporting back up!");
        Assert.IsTrue(mc.source.loop, "Normal music wasn't looping!");
    }
Beispiel #3
0
    // Start is called before the first frame update
    void Start()
    {
        musicControl   = GameObject.Find("Plane").GetComponent <MusicControl>();
        windows        = new ArrayList();
        show           = false;
        upOffset       = Screen.height * 0.52f;
        menuLeftOffset = Screen.width * 0.42f;
        menuUpOffset   = Screen.height * 0.06f;
        menuWidth      = Screen.width * 0.16f;
        menuHeight     = Screen.height * 0.08f;
        showWidth      = Screen.width * 0.5f;
        showHeight     = Screen.height * 0.2f;
        showLeftOffset = Screen.width * 0.25f;
        showUpOffset   = Screen.height * 0.3f;
        GetCamera cameraInfo = GameObject.Find("Plane").GetComponent <GetCamera>();

        MainCamera     = cameraInfo.MainCamera;
        MainMenuCamera = cameraInfo.MainMenuCamera;
        YouWinCamera   = cameraInfo.YouWinCamera;
        YouLoseCamera  = cameraInfo.YouLoseCamera;
        MainCamera.SetActive(false);
        YouLoseCamera.SetActive(false);
        YouWinCamera.SetActive(false);
        bg           = (Texture2D)Resources.Load("Img/bg3");
        start        = false;
        introduction = false;
        exit         = false;
    }
    public IEnumerator Test_BattleMusicOnlyPlaysInBattle()
    {
        MusicControl   mc      = CreateMusicControl();
        Player         player  = CreatePlayer();
        GameController gameCtr = CreateGameController(player);
        Enemy          enemy   = CreateEnemy(false);

        yield return(new WaitForEndOfFrame());

        gameCtr.StartBattle(enemy);

        yield return(new WaitForEndOfFrame());

        Assert.IsTrue(mc.source.isPlaying, "Music did not play when battle started!");
        Assert.AreEqual(mc.battleMusic, mc.source.clip, "Battle did not start with battle background music!");
        Assert.AreEqual(mc.battleMusicVolume, mc.source.volume, "Music did not have the right volume in battle!");
        Assert.IsTrue(mc.source.loop, "Battle music wasn't looping!");

        gameCtr.EndBattle();

        yield return(new WaitForEndOfFrame());

        Assert.IsTrue(mc.source.isPlaying, "Music did not play when returning from battle!");
        Assert.AreEqual(mc.normalBgMusic, mc.source.clip, "Did not return to normal background music after battle ended!");
        Assert.AreEqual(mc.normalMusicVolume, mc.source.volume, "Music did not have the right volume after ending the battle!");
        Assert.IsTrue(mc.source.loop, "Normal music wasn't looping!");
    }
Beispiel #5
0
 private void addItem(JumpToItem item)
 {
     items.Add(item);
     mapManager.Add(item.mapText);
     mapManager.Add(item.colourBackground);
     MusicControl.AddPoolItem(item.map);
 }
Beispiel #6
0
 void Awake()
 {
     if (Instance == null)
     {
         Instance = this;
     }
 }
        /// <summary>
        /// Init for form
        /// </summary>
        public tempMusicPlayer()
        {
            InitializeComponent();

            // Setup music controller
            musicControl = new MusicControl();
        }
Beispiel #8
0
 // Use this for initialization
 void Start()
 {
     if (controller == null)
     {
         controller = this;
     }
 }
Beispiel #9
0
 private void clearLayout()
 {
     MusicControl.ClearPool();
     runFiltering();
     mapManager.Clear();
     items.Clear();
 }
Beispiel #10
0
        internal override void Draw()
        {
            base.Draw();

            scrollableView.Draw();
            topLayer.Draw();
            MusicControl.Draw();
        }
Beispiel #11
0
    void Start()
    {
        _musicControl = FindObjectOfType <MusicControl>();

        particleCelebration.Stop(true);

        SetActiveSearchTarget(true);
    }
 private void Awake()
 {
     transitionAnimator = GameObject.Find("Crossfade").gameObject.GetComponent <Animator>();
     if (useSounds)
     {
         musicControl = GameObject.Find("SoundManager").GetComponent <MusicControl>();
     }
     controls = new PlayerInput();
 }
    void Start()
    {
        _musicControl = GameManager.Instance.GetMusicControl();
        imageNoSound.SetActive(!_musicControl.hasAudio);

        particleCelebration.Stop(true);

        SetActiveSearchTarget(true);
    }
Beispiel #14
0
        public JumpTo()
            : base(LocalisationManager.GetString(OsuString.JumpToDialog_Title), true)
        {
            spriteManager.Add(new pBox(new Vector2(PADDING, 79), new Vector2(GameBase.WindowManager.WidthScaled - (PADDING * 2), 1), 1, Color.White));
            spriteManager.Add(new pBox(new Vector2(PADDING, 440), new Vector2(GameBase.WindowManager.WidthScaled - (PADDING * 2), 1), 1, Color.White));
            Rectangle scrollableArea = new Rectangle(PADDING, 80, (int)(640 * GameBase.WindowManager.WidthWidescreenRatio) - (PADDING * 2), 360);

            scrollableView = new pScrollableArea(scrollableArea, Vector2.Zero, true, 0, defaultTargetType);
            mapManager     = new SpriteManager(true);
            topLayer       = new SpriteManager(true);
            mapManager.SetWidescreen(GameBase.WindowManager.IsWidescreen);
            collectionLabel = new pText(LocalisationManager.GetString(OsuString.SongSelection_Collections) + ":", 20, new Vector2(PADDING, 30), 2, true, new Color(254, 220, 97));
            collections     = new pDropdown(topLayer, "All", new Vector2(PADDING, 55), 140, 3);
            searchBox       = new pSearchBox(20, new Vector2(PADDING, 50), 20, Graphics.Renderers.TextAlignment.Right);
            searchTime      = -1;
            spriteManager.Add(searchBox.SpriteCollection);
            spriteManager.Add(collectionLabel);
            scrollableView.AddChild(mapManager);

            searchBox.OnChange += delegate(pTextBox sender, bool newText)
            {
                if (!newText)
                {
                    return;
                }

                if (searchBox.IsDefault && searchBox.textBeforeCommit.Length == 1)
                {
                    searchTime = GameBase.Time;
                }
                else if (!searchBox.IsDefault)
                {
                    searchTime = GameBase.Time + 300;
                }
            };

            Closed += delegate
            {
                MusicControl.ClearPool();
            };

            collections.AddOption("All", "All");
            collections.SetSelected("All", true);

            foreach (string c in CollectionManager.Collections.Keys)
            {
                collections.AddOption(c, c);
            }

            collections.OnSelect += collections_OnSelect;

            SelectedMap = BeatmapManager.Current;

            layout();
        }
Beispiel #15
0
        internal void UpdateSelected(bool userForced = false, bool firstUpdate = false)
        {
            if (BeatmapManager.Current != SelectedMap || userForced || firstUpdate)
            {
                //Keeps selected map in sync with current map. Sanity checks for null values.
                if ((!userForced && BeatmapManager.Current != null) || (userForced && SelectedMap == null))
                {
                    SelectedMap = BeatmapManager.Current;
                }
                else
                {
                    BeatmapManager.Current = SelectedMap;
                }

                Debug.Assert(SelectedMap != null);

                foreach (JumpToItem m in items)
                {
                    if (SelectedMap?.ContainingFolder == m.map.ContainingFolder)
                    {
                        m.colourBackground.FadeTo(0.6f, 100);
                        m.colourBackground.FadeColour(Color.CornflowerBlue, 100);

                        if (!userForced)
                        {
                            if (items.Count <= 12)
                            {
                                scrollableView.SetContentDimensions(new Vector2(0, 0));
                                continue;
                            }

                            int itemIndex     = items.IndexOf(m);
                            int itemPositionY = itemIndex * JumpToItem.ITEM_HEIGHT;

                            scrollableView.SetScrollPosition(new Vector2(0, Math.Min(scrollableView.ContentDimensions.Y - ITEM_WINDOW_HEIGHT, itemPositionY)));
                        }
                    }
                    else
                    {
                        if (m.colourBackground.Alpha > 0.001f)
                        {
                            m.colourBackground.FadeTo(0.001f, 20);
                            m.colourBackground.FadeColour(Color.White, 20);
                        }
                    }
                }
            }

            if (userForced && !SongConfirmed)
            {
                MusicControl.ChooseRandomSong(false);
                MusicControl.PushHistory(BeatmapManager.Current);
            }
        }
    void Start()
    {
        _musicControl = FindObjectOfType <MusicControl>();
        _loaderScene  = FindObjectOfType <LoaderScene>();

        _loaderScene.ShowLoadScreen(.5f, () =>
        {
            // Inicializar por primera vez main menu
            FindObjectOfType <RappiMainMenu>().InitMenu();
        });
    }
Beispiel #17
0
 // Start is called before the first frame update
 void Start()
 {
     musicControl   = GameObject.Find("Plane").GetComponent <MusicControl>();
     buttonWidth    = Screen.width * 0.16f;
     buttonHeight   = Screen.height * 0.08f;
     upOffset       = Screen.height * 0.55f;
     leftOffset     = Screen.width * 0.42f;
     MainMenuCamera = GameObject.Find("Plane").GetComponent <GetCamera>().MainMenuCamera;
     bg             = (Texture2D)Resources.Load("Img/bgWin");
     ok             = false;
 }
Beispiel #18
0
 private void Awake()
 {
     if (musicControl != null)
     {
         Destroy(gameObject);
     }
     else
     {
         musicControl = this;
         GameObject.DontDestroyOnLoad(gameObject);
     }
 }
    // Scene scene = SceneManager.GetActiveScene();

    public void Awake()
    {
        if (bgm == null)
        {
            bgm = this;
            //DontDestroyOnLoad(bgm);
        }
        else
        {
            Destroy(bgm);
        }
    }
    public IEnumerator Test_GameStartsWithLoopingNormalMusic()
    {
        MusicControl mc = CreateMusicControl();

        yield return(new WaitForEndOfFrame());

        Assert.IsTrue(mc.source.isPlaying,
                      "Music did not play when game started!");
        Assert.AreEqual(mc.normalBgMusic, mc.source.clip,
                        "Game did not start with normal background music!");
        Assert.IsTrue(mc.source.loop, "Music wasn't looping!");
    }
 private void Awake()
 {
     if (musicaControle != null)
     {
         Destroy(gameObject);
     }
     else
     {
         musicaControle = this;
         DontDestroyOnLoad(gameObject);
     }
 }
Beispiel #22
0
    IEnumerator OpeningSequence()
    {
        cam.FadeToColor(Color.black, 40f);
        MusicControl.PlayOpening();

        yield return(new WaitForSeconds(3f));

        cam.FadeToColor(Color.black, 2f);
        cam.SetText("you carry a message...\n\n\n\n...and a warning");
        cam.FadeTextIn();

        yield return(new WaitForSeconds(4));

        cam.FadeTextOut();

        yield return(new WaitForSeconds(2.5f));

        cam.SetText("you are the FORERUNNER\n\n\n");
        cam.FadeTextIn();

        yield return(new WaitForSeconds(3));

        cam.FadeToColor(Color.clear, 2f);

        yield return(new WaitForSeconds(2));

        cam.FadeTextOut();

        yield return(new WaitForSeconds(2));

        cam.FadeToColor(Color.clear, 40f);
        cam.SetText("press [SPACE] to start\n\n\n");
        cam.FadeTextIn();

        while (true)
        {
            if (Input.GetKeyDown(KeyCode.Space))
            {
                break;
            }
            yield return(null);
        }

        MusicControl.PlayDay();

        cam.SetText("move with WASD or\n the arrow keys\n\n\n\n");
        StartCoroutine("StartGame");

        yield return(new WaitForSeconds(3));

        cam.FadeTextOut();
    }
Beispiel #23
0
    // Use this for initialization
    void Start()
    {
        presenting.enabled = false;
        //determines if persistent data exists...
        GameObject musicObject = GameObject.Find("MusicObject");

        if (musicObject != null)
        {
            MusicControl musicScript = musicObject.GetComponent <MusicControl>();
            musicScript.gameLevel = false;
        }
        StartCoroutine("StartUpGame");
    }
Beispiel #24
0
    public void InitMenu()
    {
        _musicControl = GameManager.Instance.GetMusicControl();

        imageNoSound.SetActive(!_musicControl.hasAudio);

        if (GameManager.Instance.currPrize == PrizeType.None)
        {
            bttStart.interactable = false;
        }

        SetInfoSelectorPrize();
    }
Beispiel #25
0
 void Damaged()
 {
     MusicControl.PlayDamage();
     playerHealth--;
     if (playerHealth <= 0)
     {
         playerDied();
     }
     else
     {
         StartCoroutine("Invulnerable", postDamageInvuln);
     }
 }
Beispiel #26
0
    private void Awake()
    {
        DontDestroyOnLoad(this);

        if (playerInstance == null)
        {
            playerInstance = this;
        }
        else
        {
            DestroyObject(gameObject);
        }
    }
    public IEnumerator Test_MusicFadesOutOnGameEnd()
    {
        MusicControl mc = CreateMusicControl();

        mc.staticService = CreateUnityService(mc.OutroFadeDuration, 0, 0);

        yield return(new WaitForEndOfFrame());

        mc.InvokeGameEnd();

        yield return(new WaitForEndOfFrame());

        Assert.AreEqual(0, mc.source.volume, 0.00001f, "Music did not have the right volume!");
    }
 public MainWindow()
 {
     InitializeComponent();
     //if (filePath == null)
     //{
     //    artistNameLabel.Content = "Please Load an .mp3 File.";
     //}
     for (int i = 0; i < _controls.Length; i++)
     {
         MusicControl control = new MusicControl(i, canvas1);
         _controls[i] = control;
         SetEvents(control);
     }
     InitMediaPlayers();
 }
Beispiel #29
0
 // Use this for initialization
 void Start()
 {
     optionCanvas  = GameObject.Find("OptionsCanvas");
     upgradeCanvas = GameObject.Find("UpgradeCanvas");
     prefsControl  = FindObjectOfType <PlayerPrefsControlScript>();
     musicControl  = FindObjectOfType <MusicControl>();
     evSystem      = FindObjectOfType <EventSystem>();
     hording       = GameObject.Find("Txt_Hordings").GetComponent <Text>();
     level         = GameObject.Find("Txt_Level").GetComponent <Text>();
     firePower     = GameObject.Find("Txt_FirePower").GetComponent <Text>();
     health        = GameObject.Find("Txt_Health").GetComponent <Text>();
     multipler     = GameObject.Find("Txt_Multiplier").GetComponent <Text>();
     error         = GameObject.Find("Txt_Error").GetComponent <Text>();
     CalculateLevel();
     SetDefaultValues();
 }
    public IEnumerator Test_MusicFadesInOnGameStart()
    {
        MusicControl mc = CreateMusicControl();

        mc.staticService = CreateUnityService(mc.IntroFadeDuration / 2, 0, 0);

        yield return(new WaitForEndOfFrame());

        Assert.AreEqual(mc.normalMusicVolume / 2, mc.source.volume,
                        "Music did not have the right volume!");

        yield return(new WaitForEndOfFrame());

        Assert.AreEqual(mc.normalMusicVolume, mc.source.volume,
                        "Music did not have the right volume!");
    }
    /*
     * _____________________________________________________________________________________________________________________________________________________
     * Game Time
     */

    //Function runs when the gameobject is awoken
    void Awake()
    {
        Debug.Log("MusicPlayer Awake " + GetInstanceID());

        //Check if a MusicControl object instance already exists
        //if it does, destroy the newly instantiated object
        if (mcInstance != null)
        {
            Destroy(gameObject);
            Debug.Log("Destroy duplicate MusicPlayer instance");
        }
        //If a MusicControl object instance does NOT exist, set the variable = object
        else
        {
            mcInstance = this;
            GameObject.DontDestroyOnLoad(gameObject);
        }
    }
Beispiel #32
0
 void Awake()
 {
     Instance = this;
     Instance.source = GetComponent<AudioSource> ();
     Instance.SFX = transform.Find ("SFX").GetComponent<AudioSource> ();
 }
Beispiel #33
0
 void Awake()
 {
     _instant = this;
     Myaudio = this.GetComponent<AudioSource>();
     vol= PlayerPrefs.GetInt("Play_Numbr");
 }
Beispiel #34
0
 void Awake()
 {
     musicController = this;
     //detectorbar = transform.FindChild("MusicBackground").FindChild("MusicBar").FindChild("Circle").FindChild("PlaceHolder").GetComponent<Image>();
     ring = transform.FindChild("MusicBackground").FindChild("MusicBar").FindChild("Circle").FindChild("Ring").GetComponent<Image>();
     note = transform.FindChild("MusicBackground").FindChild("MusicBar").FindChild("Circle").FindChild("Note");
     Circle = transform.FindChild("MusicBackground").FindChild("MusicBar").FindChild("Circle");
     astro = transform.FindChild ("MusicBackground").FindChild ("Astronaut");
     cat = transform.FindChild ("MusicBackground").FindChild ("Cat");
     rainbow = transform.FindChild("MusicBackground").FindChild("MusicBar").FindChild("Rainbow");
     scoreText = transform.FindChild("MusicBackground").FindChild("MusicBar").FindChild("Rainbow").FindChild("Score").GetComponent<Text>();
     multpyerText = transform.FindChild("MusicBackground").FindChild("MusicBar").FindChild("Rainbow").FindChild("Multiplyer").GetComponent<Text>();
     Credits = transform.FindChild("Credits").GetComponent<Text>();
     notes = new List<Transform>();
     spawnList = new LinkedList<char>();
     measureBars = new Transform[3];
     for (int i = 0; i<3; i++)
         measureBars [i] = transform.FindChild ("MusicBackground").FindChild ("MusicBar").FindChild ("Circle").FindChild ("MeasureBar"+(i+1)).GetComponent<Transform>();
     numTick = 0;
 }