Beispiel #1
0
 void OnMouseOver()
 {
     if (Input.GetMouseButtonDown(1))
     {
         MC.getDataJockey().UpdateSong(null, row, rowIndex, "DELETE_BLOCK");
         Destroy(gameObject);
     }
 }
Beispiel #2
0
 void OnMouseOver()
 {
     if (Input.GetMouseButtonDown(0))
     {
         if (!EventSystem.current.IsPointerOverGameObject())
         {
             m_Renderer.material.color = Color.green;
             if (MC.getDataJockey().IsSongLoaded())
             {
                 Block current = MC.getBlockManager().placeCellBlock(m_Position, row, rowIndex);
                 MC.getDataJockey().UpdateSong(current, row, rowIndex, "ADD_BLOCK");
             }
         }
     }
     else if (Input.GetMouseButtonUp(0))
     {
         //m_Renderer.material = Resources.Load<Material>("Materials/Blocks" + MC.getBlockManager().GetCurrentlySelected().getMaterial());
     }
 }
Beispiel #3
0
    void OnTriggerEnter(Collider target)
    {
        if (target.gameObject.tag.Equals("Block"))
        {
            // get cellblock from target collider
            CellBlock c = target.gameObject.GetComponent <CellBlock>();
            ToggleCellLight(c, true);

            // only play sound if this is a new row
            if (c.row > currentRow)
            {
                currentRow = c.row;
                Debug.Log(currentRow);

                // get all music blocks in current row and play simultaneously
                Block[] blocks = MC.getDataJockey().GetAllBlocksInRow(c.row);
                Block   loop   = CheckForLoop(blocks);

                if (loop != null)
                {
                    Debug.Log("Found a loop block!");

                    // IF the loop has been set to complete and this is a NEW loop block, start a new loop
                    if (loopCompleted && loop != loopTail && loop != loopHead)
                    {
                        ResetLoop();
                    }

                    if (loopTail == null)
                    {
                        loopTail = loop;
                    }

                    // the loop is only complete IF :
                    // current loop block is not loop head or tail

                    if (!loopCompleted && loop != loopTail && loopHead == null)
                    {
                        Debug.Log("Returning to loop tail...");
                        loopHead = loop;

                        // take the music wall back to position of previous loop block
                        transform.position = new Vector3(loopTail.x, transform.position.y, transform.position.z);
                        currentRow         = -1;
                        // loop is now complete
                        loopCompleted = true;
                    }
                }

                PlayNotes(blocks);
            }
        }
    }
Beispiel #4
0
    public void ExitButtonPressed()
    {
        Debug.Log("Exiting...");
        // if exit button is pressed and main menu is loaded, quit the game.
        // otherwise quit the song and return to main menu.

        if (mainButtonsCanvasGroup.alpha == 1f)
        {
            Debug.Log("quitting game");
            Application.Quit();
        }
        else
        {
            Debug.Log("first erase all spawned cell blocks, unload song from data, then show main menu - also change title header");
            MC.getDataJockey().UnloadSong();
            MC.getBlockManager().CleanUpCellBlocks();
            ShowMainMenu();
            UnloadExistingSongs();
            TitleHeader.text = "cloudsynth";
        }
    }