public void StoreNoteScript(NoteScript noteToStore)
 {
     noteToStore.GetComponent <Image>().color = encounterConstants.initialNoteColor;
     noteToStore.transform.SetParent(unusedNotePool);
     noteToStore.gameObject.SetActive(false);
     noteToStore.transform.localScale = Vector3.one;
 }
    public override void OnButtonTouch(Touch touch, RectTransform buttonTrans)
    {
        base.OnButtonTouch(touch, buttonTrans);
        switch (GameplayManager.instance.mGameplayState)
        {
        case GameplayManager.GameplayState.PLAYING:
            AudioInstance.instance.GetComponent <SimpleMusicPlayer>().Pause();
            GameplayManager.instance.mGameplayState = GameplayManager.GameplayState.PAUSED;
            RhythmManager.instance.enabled          = false;
            foreach (KeyValuePair <char, Queue <GameObject> > lane in RhythmManager.instance.mSpawnedNotes)
            {
                foreach (GameObject note in lane.Value)
                {
                    NoteScript ns = note.GetComponent <NoteScript>();
                    ns.enabled = false;
                    mPausedNotes.Add(ns);
                }
            }
            break;

        //This may change or not be here later when this function is moved to another button
        case GameplayManager.GameplayState.PAUSED:
            AudioInstance.instance.GetComponent <SimpleMusicPlayer>().Play();
            GameplayManager.instance.mGameplayState = GameplayManager.GameplayState.PLAYING;
            RhythmManager.instance.enabled          = true;
            foreach (NoteScript note in mPausedNotes)
            {
                note.enabled = true;
            }
            mPausedNotes.Clear();
            break;
        }
    }
    void OnTriggerStay2D(Collider2D collision)
    {
        NoteScript collNoteScript = collision.GetComponent <NoteScript>();

        if (collNoteScript == null || collNoteScript.isCollected)
        {
            return;
        }

        if (noteGenManager.GetCurrentState() == NotesGameStates.Playing || noteGenManager.GetCurrentState() == NotesGameStates.Hyped)
        {
            if (!isPressed)
            {
                return;
            }
            if (!noteCollected)
            {
                noteCollected = true;
            }
            noteGenManager.CollectPlayerNote(collNoteScript);
        }
        else if (noteGenManager.GetCurrentState() == NotesGameStates.Enemy)
        {
            noteGenManager.CollectEnemyNote(collNoteScript);
        }

        SelectorUnPressed();
    }
    public void CallNoteGenerator(int noteGeneratorID)
    {
        NoteScript newNote   = GetUnusedNote(noteGeneratorID);
        Image      noteImage = newNote.GetComponent <Image>();

        // select note generator as parent
        newNote.noteTypeID = noteGeneratorID;
        newNote.transform.SetParent(noteGenerators[noteGeneratorID].transform.parent);
        newNote.GetComponent <RectTransform>().localPosition = noteGenerators[noteGeneratorID].GetComponent <RectTransform>().localPosition;
        //noteImage.color = FretColors[noteGeneratorID];

        // Reset for animation
        newNote.isCollected            = false;
        noteImage.sprite               = buttonImages[noteGeneratorID];
        noteImage.color                = new Color(noteImage.color.r, noteImage.color.g, noteImage.color.b, 0f);
        noteImage.transform.localScale = Vector3.zero;

        newNote.gameObject.SetActive(true);
        // Do Fade In Animation
        Sequence createSequence = DOTween.Sequence();

        createSequence.Insert(0f, noteImage.DOFade(1.0f, 0.3f));
        createSequence.Insert(0f, newNote.transform.DOScale(Vector3.one, 0.5f).SetEase(Ease.InOutBack)).OnComplete(() =>
        {
        });

        createSequence.Play();
    }
Exemplo n.º 5
0
 public Note read(NoteScript script)
 {
     return(new Note().setEstablishSample(script.sample)
            .setLineNo(script.lineNo).
            setType(script.type)
            .setShowSample(shift(script.sample))
            .setPrepareSample(shiftPrepare(script.sample)));
 }
Exemplo n.º 6
0
 public Note(GameObject _NoteTimeLine, NoteScript _NoteToPlay, int _page, int _indexInPartition, int _nbFourth)
 {
     NoteTimeLine = _NoteTimeLine;
     NoteToPlay   = _NoteToPlay;
     page         = _page;
     setIndexInPartition(_indexInPartition);
     nbFourth = _nbFourth;
 }
Exemplo n.º 7
0
 private void OnTriggerEnter2D(Collider2D col)
 {
     if (col.tag == "Note")
     {
         NoteScript nS = col.GetComponent <NoteScript>();
         nextBounceHeight = nS.getHighestPoint();                     // this shit works (Sort of!)
     }
 }
Exemplo n.º 8
0
    /// <summary>
    /// Spawn a note in the given parent
    /// </summary>
    /// <param name="notePrefab">Note Prefab</param>
    /// <param name="parent">Parent of the note</param>
    /// <param name="toAssign">Note to assign</param>
    public static GameObject SpawnNote(GameObject notePrefab, Transform parent, Notes toAssign)
    {
        var        obj  = GameObject.Instantiate(notePrefab, parent, false);
        NoteScript note = obj.GetComponent <NoteScript>();

        note.AssignNote(toAssign);

        return(obj);
    }
Exemplo n.º 9
0
    private void spawnNote(char color, float velocity, int start_time)
    {
        GameObject newNote = Instantiate(mNotePrefab);

        NoteScript newScript = newNote.GetComponent <NoteScript>();

        newScript.Initialize(velocity, start_time, color, GameObjectsScript.instance.mNoteCrunchers[color].transform);
        mSpawnedNotes[color].Enqueue(newNote);
    }
Exemplo n.º 10
0
    /// <summary>
    /// Spawns a note in the history holder and adds them to the history sequence
    /// Also checks if the last note spawned matches the position in the sequence
    /// </summary>
    /// <param name="note">Note to spawn</param>
    public void AddHistoryNote(Notes note)
    {
        HistorySequence.Add(note);

        GameObject spawn = NoteScript.SpawnNote(NotePrefab, Sequence_History, note);

        currentNotes_History.Add(spawn);

        CheckLastNoteMatch();
    }
Exemplo n.º 11
0
    public void ButtonAction(int num)
    {
        Transform  laneObj;
        GameObject effectObj;

        switch (num)
        {
        case 1:
            laneObj   = laneObj1;
            effectObj = effect1;
            break;

        case 2:
            laneObj   = laneObj2;
            effectObj = effect2;
            break;

        case 3:
            laneObj   = laneObj3;
            effectObj = effect3;
            break;

        default:
            laneObj   = laneObj4;
            effectObj = effect4;
            break;
        }

        if (laneObj.childCount > 0)
        {
            Transform  note = laneObj.GetChild(0);
            NoteScript ns   = note.GetComponent <NoteScript>();
            if (Mathf.Abs(ns.time - accurTime) < 0.1)
            {
                effectObj.GetComponent <EffectScript>().Show(mGreat);
                //Common.Log("Great" + (ns.time - accurTime));
                Destroy(note.gameObject);
            }
            else if (Mathf.Abs(ns.time - accurTime) < 0.2)
            {
                effectObj.GetComponent <EffectScript>().Show(mGood);
                //Common.Log("Good" + (ns.time - accurTime));
                Destroy(note.gameObject);
            }
            else if (Mathf.Abs(ns.time - accurTime) < 0.5)
            {
                effectObj.GetComponent <EffectScript>().Show(mBad);
                //Common.Log("Bad" + (ns.time - accurTime));
                Destroy(note.gameObject);
            }
        }
    }
Exemplo n.º 12
0
    public void BuildBar()
    {
        Tools.Note nextNote = NextNote();
        Dictionary <string, float> barToUse = nextNote.clef == lastClef ? BarLayouts.noClef : BarLayouts.clefAfterBarline;

        lastClef = nextNote.clef;
        float barWidth = BarLayouts.beatSpacing * BarLayouts.beatsPerBar;

        foreach (KeyValuePair <string, float> value in barToUse)
        {
            if (value.Key == "BarLine")
            {
                GameObject barLine = Instantiate(barLinePrefab, transform.position + new Vector3(startX + (barWidth * value.Value), 0, 0), Quaternion.identity);
                barLine.transform.parent     = transform;
                barLine.transform.localScale = new Vector3(Tools.lineWidth, Tools.lineGap * 4, 0.2f);
            }
            if (value.Key == "Note")
            {
                GameObject note = Instantiate(notePrefab, transform.position + new Vector3(startX + (barWidth * value.Value), 0, 0), Quaternion.identity);
                note.transform.parent = transform;
                NoteScript noteScript = note.GetComponent <NoteScript>();
                string     acc        = "";
                if (nextNote.sharp == true)
                {
                    acc = "sharp";
                }
                if (nextNote.flat == true)
                {
                    acc = "flat";
                }
                noteScript.NoteStartup(nextNote.position, acc);
            }
            if (value.Key == "Clef")
            {
                lastClef = nextNote.clef;
                GameObject clef = Instantiate(clefPrefab, transform.position + new Vector3(startX + (barWidth * value.Value), 0, 0), Quaternion.identity);
                clef.transform.parent = transform;
                ClefScript clefScript = clef.GetComponent <ClefScript>();
                clefScript.ShowClef(nextNote.clef);
            }
            if (value.Key == "CRest")
            {
                GameObject crotchetRest = Instantiate(crotchetRestPrefab, transform.position + new Vector3(startX + (barWidth * value.Value), 0, 0), Quaternion.identity);
                crotchetRest.transform.parent = transform;
            }
            if (value.Key == "MRest")
            {
                GameObject minimRest = Instantiate(minimRestPrefab, transform.position + new Vector3(startX + (barWidth * value.Value), 0, 0.5f), Quaternion.identity);
                minimRest.transform.parent = transform;
            }
        }
    }
Exemplo n.º 13
0
 public static NoteScript[]  read(string path)
 {
     string[]     lines   = System.IO.File.ReadAllLines(path);
     NoteScript[] scripts = new NoteScript[lines.Length];
     for (int i = 0; i < lines.Length; i++)
     {
         string[] line = lines[i].Split(',');
         scripts[i] = new NoteScript()
                      .setType((NoteType)int.Parse(line[0]))
                      .setSample(Int32.Parse(line[1]))
                      .setLineNo(Int32.Parse(line[2]));
     }
     return(scripts);
 }
    //Note_Move()
    private void Note_Move(LaneScript lane, NoteScript note)
    {
        Vector3 newPos;

        float road1Length     = Mathf.Abs(Vector3.Magnitude(lane.startPos - lane.lanePos));
        float road2Length     = Mathf.Abs(Vector3.Magnitude(lane.lanePos - lane.endPos));
        float road2Percentage = road2Length / (road1Length + road2Length);

        note.lerpFactor = (secondsInAdvance - (note.songPosition - measuredTime)) / secondsInAdvance;
        if (note.lerpFactor <= 1f)
        {
            newPos = Vector3.Lerp(lane.startPos, lane.lanePos, note.lerpFactor);
        }
        else
        {
            newPos = Vector3.Lerp(lane.lanePos, lane.endPos, (note.lerpFactor - 1f) / road2Percentage);
        }

        note.transform.position = newPos;
    }
Exemplo n.º 15
0
    public void OpenNotePanel()
    {
        if (panelNote == null)
        {
            try
            {
                panelNote = Instantiate(NotePanel);

                panelNote.transform.SetParent(Canvas.transform, false);
                panelNote.transform.position = Input.mousePosition;
                panelNote.transform.position = currentPanel.transform.position;
                // panelNote.transform.position = new Vector3(panelNote.transform.position.x +100, panelNote.transform.position.y - 100, panelNote.transform.position.z);
                noteScript = panelNote.GetComponent <NoteScript>();
                noteScript.SetNote(note);
            }
            catch (Exception ex)
            {
                string exep = ex.ToString();
            }
        }
    }
Exemplo n.º 16
0
    public void AddNote(NoteScript noteS, int Octave, string addon)
    {
        if (selected && !GetComponentInChildren <MenuPrefScript>())
        {
            if (gs.tutoInc == 3)
            {
                gs.audioSource.Stop();
                gs.audioSource.PlayOneShot(gs.audioClip [3]);
                gs.tutoInc = 4;
            }
            // show the last page (here by giving the partition length, we know it would be over the number of pages)
            if (indexToInsert == -1)
            {
                showPage(partition.Count);
            }

            GameObject newNoteGO = Instantiate(NoteTimeLineRef, transform, false);
            newNoteGO.transform.localPosition = new Vector3(startX + spaceX * (nbFourth + (selected.value * 2) - 1), Ypos, Z1);
            newNoteGO.transform.localScale    = new Vector3(0.02f * (selected.value * 4), 1, 0.4f);
            if (addon != "")
            {
                newNoteGO.GetComponentInChildren <TextMesh>().text = "" + Octave + "\n" + addon;
            }
            else
            {
                newNoteGO.GetComponentInChildren <TextMesh>().text = "" + Octave;
            }
            newNoteGO.GetComponent <Renderer>().material = noteS.idleMaterial;

            Note newNote = new Note(newNoteGO, noteS, pageShown, partition.Count, (int)(selected.value * 4));

            if (Error)
            {
                GameObject corr = Instantiate(NoteTimeLineRef, transform.FindChild("resultsContainer"), false);
                corr.transform.localPosition                  = new Vector3(newNote.NoteTimeLine.transform.localPosition.x, Ypos, Z2);
                corr.transform.localScale                     = newNote.NoteTimeLine.transform.localScale;
                corr.GetComponent <Renderer>().material       = NoRes;
                corr.GetComponentInChildren <TextMesh>().text = "";
                newNote.corr = corr;
            }
            if (indexToInsert > -1)
            {
                AddAt(newNote, indexToInsert);
                if (gs.tutoInc == 4)
                {
                    gs.audioSource.Stop();
                    gs.audioSource.PlayOneShot(gs.audioClip [4]);
                    gs.tutoInc = 5;
                }
            }

            else
            {
                partition.Add(newNote);
                if (nbFourth + newNote.nbFourth > nbFourthMax)
                {
                    newNote.NoteTimeLine.SetActive(false);
                    showPage(pageShown + 1);
                }
                else
                {
                    nbFourth += newNote.nbFourth;
                }
            }
        }
    }
    private void Lane_UpdateInput(LaneScript lane, bool input, float audioTime)
    {
        //Handling the actual input
        if (input)
        {
            if (lane.holdCounter < 5)
            {
                lane.ChangeHoldColor(true);
                lane.IncrementHoldCounter();
            }
            else
            {
                lane.ChangeHoldColor(false);
            }
        }
        else
        {
            lane.ChangeHoldColor(false);
            lane.ResetHoldCounter();
        }

        //Spawning New Notes
        for (int num = 0; num < lane.noteCount; num++)
        {
            float notePos = lane.NoteTimes[num];

            if (audioTime + beatsInAdvance > notePos)
            {
                NoteScript newNote = Instantiate(notePrefab, lane.startPos, Quaternion.identity).GetComponent <NoteScript>();
                newNote.SetProperties(notePos);
                lane.NoteObjects.Add(newNote);
                lane.NoteTimes.Remove(notePos);
                num--;
            }
        }

        //Moving/Deleting the Note Objects
        for (int num = 0; num < lane.NoteObjects.Count; num++)
        {
            bool destroyNote = false;
            Note_Move(lane, lane.NoteObjects[num]);
            float msDiff = lane.NoteObjects [num].songPosition - audioTime;

            if (lane.NoteObjects[num].lerpFactor >= 1.15f)
            {
                lane.ChangeHitText(false, 0f);
                destroyNote = true;
            }

            if (lane.holdCounter % 5 > 0 && Mathf.Abs(msDiff) < 5f * (1f / 60f))
            {
                lane.ChangeHitText(true, msDiff * 1000f);
                destroyNote = true;
            }

            if (destroyNote)
            {
                NoteScript copy = lane.NoteObjects[num];
                lane.NoteObjects.Remove(copy);
                Destroy(copy.gameObject);
                num--;
            }
        }
    }
Exemplo n.º 18
0
    // Update is called once per frame
    void Update()
    {
        if (!isActive)
        {
            isActive = true;
            this.transform.GetChild(0).gameObject.SetActive(true);
        }

        float dist = 100f;

        SteamVR_TrackedController controller = GetComponent <SteamVR_TrackedController>();

        Ray        raycast = new Ray(transform.position, transform.forward);
        RaycastHit hit;
        bool       bHit = Physics.Raycast(raycast, out hit);

        if (previousContact && previousContact != hit.transform)
        {
            PointerEventArgs args = new PointerEventArgs();
            if (controller != null)
            {
                args.controllerIndex = controller.controllerIndex;
            }
            args.distance = 0f;
            args.flags    = 0;
            args.target   = previousContact;
            OnPointerOut(args);
            previousContact = null;
        }
        if (bHit && previousContact != hit.transform)
        {
            PointerEventArgs argsIn = new PointerEventArgs();
            if (controller != null)
            {
                argsIn.controllerIndex = controller.controllerIndex;
            }
            argsIn.distance = hit.distance;
            argsIn.flags    = 0;
            argsIn.target   = hit.transform;
            OnPointerIn(argsIn);
            previousContact = hit.transform;
        }
        if (!bHit)
        {
            previousContact = null;
        }
        if (bHit && hit.distance < 100f)
        {
            dist = hit.distance;
        }

        // user can play notes by keeping trigger pressed if they have nothing selected for note duration.

        NoteScript NS = hit.transform.GetComponent <NoteScript>();

        if (hit.transform)
        {
            if (NS && !NS.transform.parent.parent.GetComponent <OctaveScript> ().TimeLine.GetComponent <TimeLineScript> ().selected)
            {
                gs.triggerPressedBefore = false;
            }

            if (controller != null && controller.triggerPressed && !gs.triggerPressedBefore)
            {
                gs.triggerPressedBefore = true;
                LengthBtnScript    LB  = hit.transform.GetComponent <LengthBtnScript> ();
                MusicBtnScript     MB  = hit.transform.GetComponent <MusicBtnScript> ();
                NoteTimeLineScript NTL = hit.transform.GetComponent <NoteTimeLineScript> ();
                MenuPrefScript     MP  = hit.transform.GetComponent <MenuPrefScript> ();
                LevelSelectScript  LS  = hit.transform.GetComponent <LevelSelectScript> ();

                if (NS)
                {
                    NS.Play();
                }
                if (LB)
                {
                    LB.Select();
                }
                if (MB)
                {
                    MB.DoAction();
                }
                if (NTL)
                {
                    NTL.openMenu();
                }
                if (MP)
                {
                    MP.doAct();
                }
                if (LS)
                {
                    LS.EnterLevel();
                }
                pointer.transform.localScale = new Vector3(thickness * 5f, thickness * 5f, dist);
            }
            else
            {
                if (controller != null && !controller.triggerPressed && !gs.waitForSceneLoad)
                {
                    gs.triggerPressedBefore = false;
                }
            }
        }
        if (!(controller != null && controller.triggerPressed && !gs.triggerPressedBefore))
        {
            pointer.transform.localScale = new Vector3(thickness, thickness, dist);
        }

        if (controller != null && controller.gripped)
        {
            gs.waitForSceneLoad = true;
            SceneManager.LoadScene(0);
        }

        SteamVR_Controller.Device device = SteamVR_Controller.Input((int)controller.controllerIndex);
        //If finger is on touchpad
        if (device.GetTouch(SteamVR_Controller.ButtonMask.Touchpad) && !touchedBefore)
        {
            touchedBefore = true;
            //Read the touchpad values
            Vector2 touchpad = device.GetAxis(EVRButtonId.k_EButton_SteamVR_Touchpad);

            // handle rotation via touchpad
            if (TLS)
            {
                if (touchpad.x > 0.3f)
                {
                    TLS.pageToShow++;
                }
                else
                {
                    if (touchpad.x < -0.3f)
                    {
                        TLS.pageToShow--;
                    }
                }
            }
            else if (CFS)
            {
                if (touchpad.y > 0.3f)
                {
                    CFS.showPrev();
                }
                else
                {
                    if (touchpad.y < -0.3f)
                    {
                        CFS.showNext();
                    }
                }
            }
        }
        else
        {
            if (!device.GetTouch(SteamVR_Controller.ButtonMask.Touchpad))
            {
                touchedBefore = false;
            }
        }
        pointer.transform.localPosition = new Vector3(0f, 0f, dist / 2f);
    }
    NoteScript GetUnusedNote(int noteGeneratorID)
    {
        NoteScript newNote = unusedNotePool.GetComponentInChildren <NoteScript>(true);

        return(newNote);
    }
    public void CollectPlayerNote(NoteScript noteToStore)
    {
        // Calculate Score
        float          accuracyRating = Mathf.Abs(noteToStore.transform.position.x - selectors[noteToStore.noteTypeID].transform.position.x);
        AccuracyRating currRating     = AccuracyRating.OK;

        if (accuracyRating < encounterConstants.accuracyPerfect)
        {
            currRating = AccuracyRating.Perfect;
        }
        else if (accuracyRating < encounterConstants.accuracyGood)
        {
            currRating = AccuracyRating.Good;
        }

        Color  gradeColor      = encounterConstants.missedNoteColor;
        Sprite noteSprite      = noteOK;
        int    scoreMultiplier = 0;

        switch (currRating)
        {
        case AccuracyRating.Perfect:
            gradeColor      = encounterConstants.PlayerGradeColors[0];
            noteSprite      = notePerfect;
            scoreMultiplier = encounterConstants.scorePerfectMultiplier;

            audioManager.PlaySoundEffect(SoundEffects.Perfect);
            break;

        case AccuracyRating.Good:
            gradeColor      = encounterConstants.PlayerGradeColors[1];
            noteSprite      = noteGood;
            scoreMultiplier = encounterConstants.scoreGoodMultiplier;

            audioManager.PlaySoundEffect(SoundEffects.Good);
            break;

        case AccuracyRating.OK:
            gradeColor      = encounterConstants.PlayerGradeColors[2];
            noteSprite      = noteOK;
            scoreMultiplier = encounterConstants.scoreOKMultiplier;
            break;
        }

        float score = (scoreMultiplier * playerMoves[currentPlayer][currentMove].score);

        if (currentState == NotesGameStates.Hyped)
        {
            score *= 2;
        }
        else
        {
            if (gameManager.movesActive[MoveEffects.Amplifier])
            {
                gameManager.AnimateEffectAction(MoveEffects.Amplifier);
                score *= encounterConstants.amplifierMultiplier;
            }
        }


        if (currentState == NotesGameStates.Playing)
        {
            hypeMeterUI.IncrementHypeValue((int)playerMoves[currentPlayer][currentMove].hypeRate);
        }
        gameManager.TurnScoreIncrement((int)score);

        audioManager.PlayMusicEffect(MusicEffects.PlayerCorrect, currentPlayer);
        noteToStore.PlaySuccessAnimation(gradeColor, noteSprite);
    }
    public void CollectEnemyNote(NoteScript noteToStore)
    {
        bool hasMissed = false; // Set to true for move effect

        // Calculate random accuracy
        float accuracyRating = UnityEngine.Random.Range(10 * (1 - encounterConstants.enemyDifficulty), 100f - (20 * encounterConstants.enemyDifficulty));

        AccuracyRating currRating = AccuracyRating.OK;

        if (accuracyRating < encounterConstants.accuracyPerfect)
        {
            currRating = AccuracyRating.Perfect;
        }
        else if (accuracyRating < encounterConstants.accuracyGood)
        {
            currRating = AccuracyRating.Good;
        }
        else
        {
            if (accuracyRating > encounterConstants.enemyMissThreshold)
            {
                hasMissed = true;
            }
        }

        Color  gradeColor     = encounterConstants.missedNoteColor;
        int    scoreDecrement = 0;
        Sprite noteSprite     = noteOK;

        switch (currRating)
        {
        case AccuracyRating.Perfect:
            gradeColor     = encounterConstants.EnemyGradeColors[0];
            noteSprite     = notePerfect;
            scoreDecrement = encounterConstants.scorePerfectMultiplier;

            audioManager.PlaySoundEffect(SoundEffects.Perfect);
            break;

        case AccuracyRating.Good:
            gradeColor     = encounterConstants.EnemyGradeColors[1];
            noteSprite     = noteGood;
            scoreDecrement = encounterConstants.scoreGoodMultiplier;

            audioManager.PlaySoundEffect(SoundEffects.Good);
            break;

        case AccuracyRating.OK:
            gradeColor     = encounterConstants.EnemyGradeColors[2];
            noteSprite     = noteOK;
            scoreDecrement = encounterConstants.scoreOKMultiplier;
            break;
        }

        // Add handicap based on difficulty
        if (!hasMissed)
        {
            float handicapScore = scoreDecrement - (scoreDecrement * (0.2f * (1f - encounterConstants.enemyDifficulty)));

            if (gameManager.movesActive[MoveEffects.Rhythm])
            {
                gameManager.AnimateEffectAction(MoveEffects.Rhythm);
                handicapScore *= encounterConstants.rhythmMultiplier;
            }

            noteToStore.PlaySuccessAnimation(gradeColor, noteSprite);
            gameManager.EnemyScoreDecrement((int)handicapScore);
        }
        else
        {
            noteToStore.isCollected = true;
            noteToStore.PlayFailureAnimation();
        }
    }
Exemplo n.º 22
0
    void GameStart()
    {
        Common.Log("start game");

        for (int i = 0; i < MusicData.laneList1.Count; i++)
        {
            Vector3    originScale = noteObject.transform.localScale;
            GameObject obj         = Instantiate(noteObject);
            obj.transform.parent     = laneObj1;
            obj.transform.localScale = originScale;
            obj.SetActive(true);
            NoteScript sc = obj.GetComponent <NoteScript>();
            sc.audioSource = audioSource;
            sc.manager     = this;
            sc.time        = MusicData.laneList1[i];
            sc.line        = -1;
        }

        for (int i = 0; i < MusicData.laneList2.Count; i++)
        {
            Vector3    originScale = noteObject.transform.localScale;
            GameObject obj         = Instantiate(noteObject);
            obj.transform.parent     = laneObj2;
            obj.transform.localScale = originScale;
            obj.SetActive(true);
            NoteScript sc = obj.GetComponent <NoteScript>();
            sc.audioSource = audioSource;
            sc.manager     = this;
            sc.time        = MusicData.laneList2[i];
            sc.line        = 1;
        }

        for (int i = 0; i < MusicData.laneList3.Count; i++)
        {
            Vector3    originScale = noteObject.transform.localScale;
            GameObject obj         = Instantiate(noteObject);
            obj.transform.parent     = laneObj3;
            obj.transform.localScale = originScale;
            obj.SetActive(true);
            NoteScript sc = obj.GetComponent <NoteScript>();
            sc.audioSource = audioSource;
            sc.manager     = this;
            sc.time        = MusicData.laneList3[i];
            sc.line        = 1;
        }

        for (int i = 0; i < MusicData.laneList4.Count; i++)
        {
            Vector3    originScale = noteObject.transform.localScale;
            GameObject obj         = Instantiate(noteObject);
            obj.transform.parent     = laneObj4;
            obj.transform.localScale = originScale;
            obj.SetActive(true);
            NoteScript sc = obj.GetComponent <NoteScript>();
            sc.audioSource = audioSource;
            sc.manager     = this;
            sc.time        = MusicData.laneList4[i];
            sc.line        = 1;
        }

        startTime = Time.time;
        Common.Log("start music");
        audioSource.Play();
    }
Exemplo n.º 23
0
    private void SpawnTargetNote(Notes note)
    {
        GameObject spawn = NoteScript.SpawnNote(NotePrefab, Sequence_Holder, note);

        currentNotes_Holder.Add(spawn);
    }