コード例 #1
0
ファイル: hatsnotes.cs プロジェクト: vinylcrackle/DrummerVR
    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*/
    }
コード例 #2
0
    void SoundLevel()
    {
        GameObject   Hat = GameObject.Find("HatsEnd");        //Get SoundLevel info. from Hats Score Manager
        ScoreManager SM  = Hat.GetComponent <ScoreManager>(); //Link to ScoreManager Script which handles detection of Hats hits

        HatsPlayer.volume = SM.HatsSoundLevel;

        GameObject    Snare = GameObject.Find("EndPos");            //Get SoundLevel info. from Hats Score Manager
        ScoreManSnare SMS   = Snare.GetComponent <ScoreManSnare>(); //Link to ScoreManSnare Script which handles detection of Snare hits

        SnarePlayer.volume = SMS.SnareSoundLevel;                   //Access the variable that stores sound level info. and apply it to the corresponding player

        GameObject Kick = GameObject.Find("KickEnd");               //Get SoundLevel info. from Hats Score Manager
        KickScore  KS   = Kick.GetComponent <KickScore>();          //Link to KickScore Script which handles detection of Kick hits

        KickPlayer.volume = KS.KickSoundLevel;                      //Access the variable that stores sound level info. and apply it to the corresponding player
    }
コード例 #3
0
    // Update is called once per frame
    void Update()
    {
        GameObject    Hat        = GameObject.Find("HatsEnd");      //Script Name ScoreManager , Variable name HatsScore
        GameObject    Snare      = GameObject.Find("EndPos");       //Script Name ScoreManSnare , Variable name SnareScore
        GameObject    Kick       = GameObject.Find("Bass");         //Script Name KickScore, Variable name KickScore
        GameObject    Cymbal     = GameObject.Find("CymbalDetect"); //Script Name CymbalScore
        ScoreManager  HatsScore  = Hat.GetComponent <ScoreManager>();
        ScoreManSnare SnareScore = Snare.GetComponent <ScoreManSnare>();
        KickScore     KScore2    = Kick.GetComponent <KickScore>();
        CymbalScore   CScore     = Cymbal.GetComponent <CymbalScore>();

        CurrentScore = SnareScore.SnareScore + HatsScore.HatsScore + KScore2.KScore + CScore.CrashScore;
        MissedScore  = SnareScore.Snaremissed + HatsScore.HatsMissed + KScore2.KickMissed + CScore.CrashMissed;
        if (MissedScore > HighestMissed)
        {
            HighestMissed = MissedScore;
        }
        Combo();
        MissedScoreOld  = MissedScore;
        CurrentScoreOld = CurrentScore;
        //Debug.Log(CurrentScore);
    }