Esempio n. 1
0
 // Use this for initialization
 void Start()
 {
     player            = GameObject.Find("Player").GetComponent <PlayerController>();
     sprite            = this.gameObject.GetComponent <SpriteRenderer>();
     metronome         = GameObject.Find("AudioSource").GetComponent <MetronomeTimer>();
     scale             = this.transform.localScale;
     position          = this.transform.position;
     health            = 50;
     enemyHeading      = 0;
     theCamera         = GameObject.Find("Main Camera").GetComponent <Camera>();
     songScript        = GameObject.Find("SongScript").GetComponent <SongScript>();
     this.sprite.color = new Color(0f, 0f, 0f);
     controllerColor   = this.sprite.color;
     surroundOneShot   = GameObject.Find("SurroundOneShot").GetComponent <AudioSource>();
     oneShotPlayed     = false;
 }
Esempio n. 2
0
 public ScriptLoader(SongScript script, Chart chart)
 {
     this.script = script;
     this.chart  = chart;
 }
Esempio n. 3
0
    // Use this for initialization
    void Start()
    {
        //AudioSettings.outputSampleRate = 44100;
        //Debug.Log(AudioSettings.outputSampleRate);
        /*
        if (Application.loadedLevelName == "GlaciersScene")
        {
            silence = GameObject.Find("AudioSource").GetComponent<AudioSource>();
            loop = GameObject.Find ("GlaciersLoop1").GetComponent<AudioSource>();
            loop2 = GameObject.Find ("GlaciersLoop2").GetComponent<AudioSource>();
            loop3 = GameObject.Find ("GlaciersLoop3").GetComponent<AudioSource>();
            loop4 = GameObject.Find ("GlaciersLoop4").GetComponent<AudioSource>();
            loop5 = GameObject.Find ("GlaciersLoop5").GetComponent<AudioSource>();
            loop6 = GameObject.Find ("GlaciersLoop6").GetComponent<AudioSource>();
            loop7 = GameObject.Find ("GlaciersLoop7").GetComponent<AudioSource>();
            loop8 = GameObject.Find ("GlaciersLoop8").GetComponent<AudioSource>();
            loop9 = GameObject.Find ("GlaciersLoop9").GetComponent<AudioSource>();
            loop10 = GameObject.Find ("GlaciersLoop10").GetComponent<AudioSource>();
            loop11 = GameObject.Find ("GlaciersLoop11").GetComponent<AudioSource>();
            loop12 = GameObject.Find ("GlaciersLoop12").GetComponent<AudioSource>();
            cubeKillAmount1 = 80;
            cubeKillAmount2 = 200;
            cubeKillAmount3 = 330;
            cubeKillAmount4 = 500;
            cubeKillAmount5 = 750;
            cubeKillAmount6 = 1000;
            cubeKillAmount7 = 1250;
            cubeKillAmount8 = 1450;
            cubeKillAmount8 = 2150;
            cubeKillAmount9 = 2550;
            cubeKillAmount10 = 3050;
            cubeKillAmount11 = 3250;
            loopArray = new AudioSource[]{loop, loop2, loop3, loop4, loop5, loop6, loop7, loop8, loop9, loop10, loop11, loop12};
            cubeKillArray = new int[]{cubeKillAmount1, cubeKillAmount2, cubeKillAmount3, cubeKillAmount4, cubeKillAmount5, cubeKillAmount6, cubeKillAmount7, cubeKillAmount8, cubeKillAmount9, cubeKillAmount10, cubeKillAmount11};
            numberOfSongSections = 11;
        }*/

        silence = GameObject.Find ("AudioSource").GetComponent<AudioSource>();
        isStarted = false;
        metronome = GameObject.Find ("AudioSource").GetComponent<MetronomeTimer>();
        loop = GameObject.Find ("LoopLoop1").GetComponent<AudioSource>();
        spawnsKilled = GameObject.Find ("Player").GetComponent<PlayerController>().spawnsKilled;
        numberOfSongSections = 10;
        spawnKillAmount1 = 2;
        spawnKillAmount2 = 6;
        spawnKillAmount3 = 12;
        spawnKillAmount4 = 20;
        spawnKillAmount5 = 29;
        spawnKillAmount6 = 39;
        spawnKillAmount7 = 43;
        spawnKillAmount8 = 50;
        spawnKillAmount9 = 55;

        spawnKillArray = new int[]{spawnKillAmount1, spawnKillAmount2, spawnKillAmount3, spawnKillAmount4, spawnKillAmount5, spawnKillAmount6, spawnKillAmount7, spawnKillAmount8, spawnKillAmount9, spawnKillAmount10};

        loopLoopNumber = 10;

        player = GameObject.Find ("Player").GetComponent<PlayerController>();
        shootingArp = GameObject.Find ("ShootingArp").GetComponent<AudioSource>();

        loopArray = new AudioSource[loopLoopNumber];
        kickArray = new AudioSource[loopLoopNumber];
        snareArray = new AudioSource[loopLoopNumber];
        clapArray = new AudioSource[loopLoopNumber];
        hatArray = new AudioSource[loopLoopNumber];
        glitchArray = new AudioSource[loopLoopNumber];
        gb1Pul1Array = new AudioSource[loopLoopNumber];
        gb1Pul2Array = new AudioSource[loopLoopNumber];
        gb1WavArray = new AudioSource[loopLoopNumber];
        gb2Pul1Array = new AudioSource[loopLoopNumber];
        gb2Pul2AndWavArray = new AudioSource[loopLoopNumber];
        gb1NoiseArray = new AudioSource[loopLoopNumber];

        SetUpLoopArrays();

        songScript = GameObject.Find ("SongScript").GetComponent<SongScript>();

        //pauseScript = GameObject.Find ("Paused").GetComponent<PauseScript>();
        //StartCoroutine(waitUntilEnd());
    }
Esempio n. 4
0
        public override void Start(Game game)
        {
            //script load/setup
            if (chartInfo.script != null)
            {
                Assembly   scriptAssembly = Utils.PluginLoader.LoadPlugin(Path.Combine(chartPath, chartInfo.script));
                SongScript script         = null;
                foreach (Type type in scriptAssembly.GetTypes())
                {
                    if (typeof(SongScript).IsAssignableFrom(type))
                    {
                        script = Activator.CreateInstance(type) as SongScript;
                    }
                }
                //you best have loaded one b o i
                scriptLoader = new ScriptLoader(script, this);
                game.addGameObject(scriptLoader);
            }



            instance        = this;
            this.components = new List <Component>();
            type            = objType.nonvisual;

            approachBeat = (float)Game.approachSpeed * ((float)(chartInfo.bpm) / 60000);
            scoreTime    = (float)Game.scoringTime * ((float)(chartInfo.bpm) / 60000);
            missTime     = (float)Game.missTime * ((float)(chartInfo.bpm) / 60000);
            //Console.WriteLine(Path.Combine(chartPath, chartInfo.songPath));
            List <NoteInfo> tempL = new List <NoteInfo>();
            List <NoteInfo> tempR = new List <NoteInfo>();
            List <NoteInfo> tempU = new List <NoteInfo>();
            List <NoteInfo> tempD = new List <NoteInfo>();

            foreach (var item in chartInfo.notes)
            {
                switch (item.collumn)
                {
                case collumn.Left:
                    tempL.Add(item);
                    break;

                case collumn.Down:
                    tempD.Add(item);
                    break;

                case collumn.Up:
                    tempU.Add(item);
                    break;

                case collumn.Right:
                    tempR.Add(item);
                    break;

                default:
                    break;
                }
            }
            receivers    = new Receiver[4];
            receivers[0] = new Receiver(collumn.Left, tempL, this);
            receivers[3] = new Receiver(collumn.Right, tempR, this);
            receivers[2] = new Receiver(collumn.Up, tempU, this);
            receivers[1] = new Receiver(collumn.Down, tempD, this);


            game.addGameObject(receivers[0]);
            game.addGameObject(receivers[1]);
            game.addGameObject(receivers[2]);
            game.addGameObject(receivers[3]);

            chartEventHandler = new ChartEventHandler(this, receivers, new List <EventInfo>(chartInfo.events));

            foreach (NoteInfo noteI in chartInfo.notes)
            {
                //float notems = (float)Math.Ceiling(noteI.time / ((float)chartInfo.bpm / 60000));
                //msNotes.Add()
            }

            //check if theres a video
            if (chartInfo.video.videoPath != null)
            {
                game.addGameObject(new VideoPlayer(Path.Combine(chartPath, chartInfo.video.videoPath), chartPath, Path.Combine(chartPath, "ChartInfo.json"), chartInfo.video, this));
            }

            scoreHandler = new ScoreHandler(this, chartInfo.notes.Length);
            game.addGameObject(scoreHandler);
            game.addGameObject(chartEventHandler);
            firstBPM = chartInfo.bpm;
            if (scriptLoader != null)
            {
                scriptLoader.songStart();
            }
            song = game.audioManager.addTrack(Path.Combine(chartPath, chartInfo.songPath));
            double tempbeat = beatstoADD + (((TimeConverterFactory.Instance.GetTimeConverterForSource(song.sampleSource).ToTimeSpan(song.sampleSource.WaveFormat, song.sampleSource.Length).TotalMilliseconds) * ((float)(firstBPM) / 60000)));

            VideoPlayer.LastBeat = (float)Math.Round(tempbeat, 2);
            //debug obj
            game.addGameObject(new ChartDebug(this));
            game.display.windowManager.CenterWindow();


            //song.sampleSource.SetPosition(TimeSpan.FromMilliseconds(220 / ((float)(chartInfo.bpm) / 60000)));
        }
Esempio n. 5
0
 // Use this for initialization
 void Start()
 {
     player = GameObject.Find ("Player").GetComponent<PlayerController>();
     sprite = this.gameObject.GetComponent<SpriteRenderer>();
     metronome = GameObject.Find ("AudioSource").GetComponent<MetronomeTimer>();
     scale = this.transform.localScale;
     position = this.transform.position;
     health = 50;
     enemyHeading = 0;
     theCamera = GameObject.Find ("Main Camera").GetComponent<Camera>();
     songScript = GameObject.Find ("SongScript").GetComponent<SongScript>();
     this.sprite.color = new Color(0f, 0f, 0f);
     controllerColor = this.sprite.color;
     surroundOneShot = GameObject.Find ("SurroundOneShot").GetComponent<AudioSource>();
     oneShotPlayed = false;
 }
Esempio n. 6
0
    // Use this for initialization
    void Start()
    {
        //AudioSettings.outputSampleRate = 44100;
        //Debug.Log(AudioSettings.outputSampleRate);

        /*
         * if (Application.loadedLevelName == "GlaciersScene")
         * {
         *      silence = GameObject.Find("AudioSource").GetComponent<AudioSource>();
         *      loop = GameObject.Find ("GlaciersLoop1").GetComponent<AudioSource>();
         *      loop2 = GameObject.Find ("GlaciersLoop2").GetComponent<AudioSource>();
         *      loop3 = GameObject.Find ("GlaciersLoop3").GetComponent<AudioSource>();
         *      loop4 = GameObject.Find ("GlaciersLoop4").GetComponent<AudioSource>();
         *      loop5 = GameObject.Find ("GlaciersLoop5").GetComponent<AudioSource>();
         *      loop6 = GameObject.Find ("GlaciersLoop6").GetComponent<AudioSource>();
         *      loop7 = GameObject.Find ("GlaciersLoop7").GetComponent<AudioSource>();
         *      loop8 = GameObject.Find ("GlaciersLoop8").GetComponent<AudioSource>();
         *      loop9 = GameObject.Find ("GlaciersLoop9").GetComponent<AudioSource>();
         *      loop10 = GameObject.Find ("GlaciersLoop10").GetComponent<AudioSource>();
         *      loop11 = GameObject.Find ("GlaciersLoop11").GetComponent<AudioSource>();
         *      loop12 = GameObject.Find ("GlaciersLoop12").GetComponent<AudioSource>();
         *      cubeKillAmount1 = 80;
         *      cubeKillAmount2 = 200;
         *      cubeKillAmount3 = 330;
         *      cubeKillAmount4 = 500;
         *      cubeKillAmount5 = 750;
         *      cubeKillAmount6 = 1000;
         *      cubeKillAmount7 = 1250;
         *      cubeKillAmount8 = 1450;
         *      cubeKillAmount8 = 2150;
         *      cubeKillAmount9 = 2550;
         *      cubeKillAmount10 = 3050;
         *      cubeKillAmount11 = 3250;
         *      loopArray = new AudioSource[]{loop, loop2, loop3, loop4, loop5, loop6, loop7, loop8, loop9, loop10, loop11, loop12};
         *      cubeKillArray = new int[]{cubeKillAmount1, cubeKillAmount2, cubeKillAmount3, cubeKillAmount4, cubeKillAmount5, cubeKillAmount6, cubeKillAmount7, cubeKillAmount8, cubeKillAmount9, cubeKillAmount10, cubeKillAmount11};
         *      numberOfSongSections = 11;
         * }*/

        silence              = GameObject.Find("AudioSource").GetComponent <AudioSource>();
        isStarted            = false;
        metronome            = GameObject.Find("AudioSource").GetComponent <MetronomeTimer>();
        loop                 = GameObject.Find("LoopLoop1").GetComponent <AudioSource>();
        spawnsKilled         = GameObject.Find("Player").GetComponent <PlayerController>().spawnsKilled;
        numberOfSongSections = 10;
        spawnKillAmount1     = 2;
        spawnKillAmount2     = 6;
        spawnKillAmount3     = 12;
        spawnKillAmount4     = 20;
        spawnKillAmount5     = 29;
        spawnKillAmount6     = 39;
        spawnKillAmount7     = 43;
        spawnKillAmount8     = 50;
        spawnKillAmount9     = 55;

        spawnKillArray = new int[] { spawnKillAmount1, spawnKillAmount2, spawnKillAmount3, spawnKillAmount4, spawnKillAmount5, spawnKillAmount6, spawnKillAmount7, spawnKillAmount8, spawnKillAmount9, spawnKillAmount10 };

        loopLoopNumber = 10;

        player      = GameObject.Find("Player").GetComponent <PlayerController>();
        shootingArp = GameObject.Find("ShootingArp").GetComponent <AudioSource>();


        loopArray          = new AudioSource[loopLoopNumber];
        kickArray          = new AudioSource[loopLoopNumber];
        snareArray         = new AudioSource[loopLoopNumber];
        clapArray          = new AudioSource[loopLoopNumber];
        hatArray           = new AudioSource[loopLoopNumber];
        glitchArray        = new AudioSource[loopLoopNumber];
        gb1Pul1Array       = new AudioSource[loopLoopNumber];
        gb1Pul2Array       = new AudioSource[loopLoopNumber];
        gb1WavArray        = new AudioSource[loopLoopNumber];
        gb2Pul1Array       = new AudioSource[loopLoopNumber];
        gb2Pul2AndWavArray = new AudioSource[loopLoopNumber];
        gb1NoiseArray      = new AudioSource[loopLoopNumber];

        SetUpLoopArrays();

        songScript = GameObject.Find("SongScript").GetComponent <SongScript>();

        //pauseScript = GameObject.Find ("Paused").GetComponent<PauseScript>();
        //StartCoroutine(waitUntilEnd());
    }