Ejemplo n.º 1
0
    /**
     * Called when the Game starts
     */
    public bool Initialize(SongData song)
    {
        ResetGameTime();

        //OHCamera ohCam = FindObjectOfType<OHCamera>();
        inputMaster    = FindObjectOfType <InputHandler>().inputMaster;
        uIManager      = FindObjectOfType <UIManager>();
        songController = FindObjectOfType <SongController>();
        paddleManager  = FindObjectOfType <PaddleManager>();
        track          = FindObjectOfType <Track>();
        ballDropper    = FindObjectOfType <BallDropper>();

        // ENVIRONMENT
        track.Initialize(this);
        //ohCam.Initialize();

        // LOAD SONG
        this.songData = song;
        songController.Initialize(this, inputMaster);
        songController.LoadSong(song);
        songController.onSongEnd += EndGame;

        // PADDLES
        paddleManager.Initialize(this, track);

        // BALLS
        balls = LoadBallData(song.name);
        SortBalls();

        // BALL DROPPER
        ballDropper.Initialize(this, songController, track);
        ballDropper.ballMapName = song.songName;
        waitTimeBeats           = ballDropper.GetTimeToFallBeats();

        // UI
        uIManager.Initialize();
        replayButton = FindObjectOfType <ReplayButton>();
        replayButton.onReplayButtonClicked += RestartGame;

        StartGame();

        return(true);
    }