Exemplo n.º 1
0
    // Use this for initialization
    void Start()
    {
        try
        {
            xmlReader = this.GetComponent <XMLReaderMusic>();
            if (FileName != null)
            {
                xmlReader.ReadLocalFile(FileName);
                musicSheet = xmlReader.musicSheet;
            }
        }
        catch { }

        initPositionNotes = musicSheet.InitPositionNotes;
        Tempo             = musicSheet.Tempo;
        TotalMeasures     = musicSheet.TotalMeasures;
        BeatsPerMeasure   = musicSheet.BeatsPerMeasure;
        actualBeat        = 1;
        actualMeasure     = 1;
        tempoSong         = 60f / Tempo;
        sw          = new Stopwatch();
        this.speed  = -0.0945f * (Tempo / 60f);
        actualScore = 0;
        partBeat    = 1;
        sw.Start();
        UpdateTimmer();
    }
Exemplo n.º 2
0
    // Update is called once per frame
    void Update()
    {
        if (LvlState != PreviousState)
        {
            PreviousState = LvlState;
            switch (LvlState)
            {
                #region NONE STATE
            case State.ScanQR:
#if !UNITY_EDITOR
                aux = Instantiate(ScanQRLvl, this.transform);
#endif
                break;

                #endregion
                #region LOADXML STATE
            case State.LoadXML:
#if !UNITY_EDITOR
                Destroy(aux);
#endif

#if UNITY_EDITOR
                xmlReader.ReadLocalFile(FileName);
                NextState();
#endif
                break;

                #endregion
                #region READYPLAY STATE
            case State.ReadyPlay:
                Debug.Log("Playing Impored LVL");
                aux      = Instantiate(MenuReadyImported, this.transform);
                aux.name = aux.transform.name.Replace("(Clone)", "");
                aux.transform.position = GameObject.FindGameObjectWithTag("Piano").GetComponent <Transform>().position;
                aux.transform.rotation = GameObject.FindGameObjectWithTag("Piano").GetComponent <Transform>().rotation;
                break;

                #endregion
                #region PLAYING STATE
            case State.Playing:
                Debug.Log("Playing Impored LVL");
                aux      = Instantiate(LvlImported, this.transform);
                aux.name = aux.transform.name.Replace("(Clone)", "");
                aux.transform.position = GameObject.FindGameObjectWithTag("Piano").GetComponent <Transform>().position;
                aux.transform.rotation = GameObject.FindGameObjectWithTag("Piano").GetComponent <Transform>().rotation;
                GameObject.FindGameObjectWithTag("SheetManager").GetComponent <MusicSheetManager>().musicSheet = xmlReader.musicSheet;
                break;

                #endregion
                #region MENU STATE
            case State.Menu:
                aux      = Instantiate(MenuImportLvl, this.transform);
                aux.name = aux.transform.name.Replace("(Clone)", "");
                aux.transform.position = GameObject.FindGameObjectWithTag("Piano").GetComponent <Transform>().position;
                aux.transform.rotation = GameObject.FindGameObjectWithTag("Piano").GetComponent <Transform>().rotation;
                break;

                #endregion
                #region EXIT
            case State.Exit:
                GameObject.FindGameObjectWithTag("AppManager").GetComponent <StageManager>().ChangeState(StageManager.State.MenuGame);
                Destroy(this.gameObject);
                break;
                #endregion
            }
        }
    }