private void Spawn()
    {
        for (int i = 0; i < notecount; i++)
        {
            cube.name = System.Convert.ToString(i);
            cu[i]     = Instantiate(cube, x1.transform.position, x1.transform.rotation);
            cu[i].AddComponent <hatsnotes>();                     //attach "cube" script to the game object
        }
        GameObject handler = GameObject.Find("StickR");           //Access the gameObject SpawnPos which contains the script that has the notetimings array
        SyncMaster SM      = handler.GetComponent <SyncMaster>(); //REFERENCE the movewithtime script

        SM.status[3] = true;
    }
Exemple #2
0
    void Update()
    {
        GameObject resetManager = GameObject.Find("SM"); //Check if controller has hit the snare drum
        toRockR    sceneload    = resetManager.GetComponent <toRockR>();

        if (sceneload.DestroyHats)
        {
            Destroy(gameObject);
        }
        GameObject handler = GameObject.Find("StickR");           //Access the gameObject SpawnPos which contains the script that has the notetimings array
        SyncMaster SM      = handler.GetComponent <SyncMaster>(); //REFERENCE the movewithtime script

        if (SM.AllSystemsGo)
        {
            if (!ReachedEnd)
            {
                t += Time.deltaTime / (float)duration;
                transform.position = Vector3.Lerp(starttransform, endtransform, t);
            }
            // Destroy(gameObject);
            if (gameObject.transform.position == endtransform)
            {
                SM.MusicFlag = true;
                GameObject    handler3 = GameObject.Find("EndPos"); //Check if controller has hit the snare drum
                ScoreManSnare SMS      = handler3.GetComponent <ScoreManSnare>();
                //SMS.note = false;
                //SMS.passed = false;
                ReachedEnd = true;
                //Destroy(gameObject);
            }
            if (ReachedEnd && !destroyed)
            {
                GameObject handler2 = GameObject.Find("DestroyPlane"); //Check if controller has hit the snare drum
                transform.position = Vector3.MoveTowards(gameObject.transform.position, handler2.transform.position, 0.3f * Time.deltaTime);
                //Debug.Log("Move IT");
            }
        }

        /* ////////OLD
         * t += Time.deltaTime / (float)duration;
         *   float distancecovered = (Time.time - starttime) * speed;
         *   float perc = distancecovered / distance;
         *   transform.position = Vector3.Lerp(starttransform, endtransform, t);
         *   if (gameObject.transform.position == endtransform)
         *   {
         *       SM.MusicFlag = true;
         *      // Destroy(gameObject);
         *   }/////////OLDDD*/
    }
Exemple #3
0
        public MainWindow()
        {
            InitializeComponent();
            Game = new Game();

            #region UI
            Game.GuiInteraction          = new Gui_Interaction(this, Game);
            this.label_TIME.Content      = "PLAYTIME : " + System.Environment.NewLine + "00:00:00";
            this.label_Controls1.Content = "SYSTEM-CONTROLS : " + System.Environment.NewLine + " • ENTER = Start" + System.Environment.NewLine + " • SPACE = Pause" + System.Environment.NewLine +
                                           " • ESCAPE  = Quit ";

            this.label_Controls.Content = "MOVEMENT-CONTROLS : " + System.Environment.NewLine + " • LEFT = Move left" + System.Environment.NewLine +
                                          " • RIGHT = Move right" + System.Environment.NewLine + " • DOWN = Move down" + System.Environment.NewLine + " • UP = Rotate";
            //  Intro();


            this.KeyDown += new KeyEventHandler(Window_KeyDown);
            // Erstelle GameBoard
            Board_UI_GameBoard = new BoardUI(this, Game, Grid_GameBoard);
            Board_UI_GameBoard.ErstelleGrid(this.Game.Config.Width_GameBoard, this.Game.Config.Height_GameBoard);
            Board_UI_GameBoard.GenerateBoardFeldArray(this.Game.Config.Width_GameBoard, this.Game.Config.Height_GameBoard);

            // Erstelle PreviewBoard
            Board_UI_PreviewBoard = new BoardUI(this, Game, Grid_PreviewBoard);
            Board_UI_PreviewBoard.ErstelleGrid(this.Game.Config.Width_Preview, this.Game.Config.Height_Preview);
            Board_UI_PreviewBoard.GenerateBoardFeldArray(this.Game.Config.Width_Preview, this.Game.Config.Height_Preview);

            Sync       = new SyncMaster(Game, Board_UI_GameBoard, Board_UI_PreviewBoard, this);
            this.Timer = new Timer_GUI(this.Dispatcher, this, Sync, Game);

            //this.Width = 1468;
            //this.Height = 826;
            // 0,5626702997275204

            this.Width  = 1680;
            this.Height = 1680 * ((double)826 / 1468);

            //this.Height = 1050;
            // 0,625
            //    this.Show();
            //System.Windows.Forms.Screen screen = System.Windows.Forms.Screen.PrimaryScreen;
            //screen.Bounds
            #endregion UI
        }