Beispiel #1
0
    public void CreateCue()
    {
        Debug.Log("create cue");
        //determining which cue lane we're in (which cue type we're using)
        int cueLaneIndex = int.MaxValue;

        for (int i = 0; i < playerInputKeys.Length; i++)
        {
            if (playerInputKeys[i] == beatEvents[beatEventIndex].inputKey)
            {
                cueLaneIndex = i;
            }
        }

        if (cueLaneIndex == int.MaxValue)
        {
            Debug.LogWarning("beatmap input key doesn't match current inputs!");
        }
        GameObject newCue = Instantiate(cuePrefabs[cueLaneIndex], cueStartLocations[cueLaneIndex].transform.position, Quaternion.identity);

        FallingGem fallingGem = newCue.GetComponent <FallingGem>();

        fallingGem.bmEvent = beatEvents[beatEventIndex];

        //Set Window Timings
        fallingGem.OkWindowStart      = fallingGem.bmEvent.eventMBT.GetMilliseconds() - (0.5d * OkWindowMillis);
        fallingGem.OkWindowEnd        = fallingGem.bmEvent.eventMBT.GetMilliseconds() + (0.5d * OkWindowMillis);
        fallingGem.GoodWindowStart    = fallingGem.bmEvent.eventMBT.GetMilliseconds() - (0.5d * GoodWindowMillis);
        fallingGem.GoodWindowEnd      = fallingGem.bmEvent.eventMBT.GetMilliseconds() + (0.5d * GoodWindowMillis);
        fallingGem.PerfectWindowStart = fallingGem.bmEvent.eventMBT.GetMilliseconds() - (0.5d * PerfectWindowMillis);
        fallingGem.PerfectWindowEnd   = fallingGem.bmEvent.eventMBT.GetMilliseconds() + (0.5d * PerfectWindowMillis);
    }
    void ScoreGem(FallingGem gem)
    {
        switch (gem.gemCueState)
        {
        case FallingGem.CueState.OK:
            gameScore += 1;
            Debug.Log("OK!");
            Destroy(gem.gameObject);
            break;

        case FallingGem.CueState.Good:
            gameScore += 2;
            Debug.Log("Good!");
            Destroy(gem.gameObject);
            break;

        case FallingGem.CueState.Perfect:
            gameScore += 3;
            Debug.Log("Perfect!");
            Destroy(gem.gameObject);
            break;

        case FallingGem.CueState.Late:
            Debug.Log("Missed!");
            break;
        }
    }
Beispiel #3
0
    public void GeneratePCue()
    {
        GameObject newCue = Instantiate(fallingGemP.cuePrefab, fallingGemP.cueStartLocation.transform.position, Quaternion.identity);

        FallingGem fallingGem = newCue.GetComponent <FallingGem>();

        fallingGem.playerInput = fallingGemP.playerInput;

        SetGemTimings(fallingGem);
    }
Beispiel #4
0
    //We connect these next three methods to relevant events on our Note Highway Wwise Sync
    public void GenerateQCue()
    {
        //we need to instantiate the cue, set the desired player input accordingly, and then set the window timings
        GameObject newCue = Instantiate(fallingGemQ.cuePrefab, fallingGemQ.cueStartLocation.transform.position, Quaternion.identity);

        FallingGem fallingGem = newCue.GetComponent <FallingGem>();

        fallingGem.playerInput = fallingGemQ.playerInput;

        SetGemTimings(fallingGem);
    }
Beispiel #5
0
    void SetGemTimings(FallingGem fallingGem)
    {
        fallingGem.wwiseSync = wwiseSync;

        fallingGem.crossingTime = (float)wwiseSync.SetCrossingTimeInMS(cueBeatOffset);

        //Set Window Timings - we're going to use wwise for this
        fallingGem.OkWindowStart      = fallingGem.crossingTime - (0.5f * OkWindowMillis);
        fallingGem.OkWindowEnd        = fallingGem.crossingTime + (0.5f * OkWindowMillis);
        fallingGem.GoodWindowStart    = fallingGem.crossingTime - (0.5f * GoodWindowMillis);
        fallingGem.GoodWindowEnd      = fallingGem.crossingTime + (0.5f * GoodWindowMillis);
        fallingGem.PerfectWindowStart = fallingGem.crossingTime - (0.5f * PerfectWindowMillis);
        fallingGem.PerfectWindowEnd   = fallingGem.crossingTime + (0.5f * PerfectWindowMillis);
    }
Beispiel #6
0
    void ScoreGem(FallingGem gem)
    {
        GameObject newParticles;


        switch (gem.gemCueState)
        {
        case FallingGem.CueState.OK:
            gameScore += 1;
            Debug.Log("OK!");
            feedbackText.text  = "Ok!";
            feedbackText.color = okColor;
            Destroy(gem.gameObject);

            //deploy particles
            newParticles = Instantiate(goodParticles, gem.transform.position, Quaternion.identity);
            var main = newParticles.GetComponent <ParticleSystem>().main;
            main.startColor = okColor;
            Destroy(newParticles, 2f);

            break;

        case FallingGem.CueState.Good:
            gameScore += 2;
            Debug.Log("Good!");
            feedbackText.text  = "Good!";
            feedbackText.color = goodColor;
            Destroy(gem.gameObject);

            //deploy particles
            newParticles    = Instantiate(goodParticles, gem.transform.position, Quaternion.identity);
            main            = newParticles.GetComponent <ParticleSystem>().main;
            main.startColor = goodColor;
            Destroy(newParticles, 2f);

            break;

        case FallingGem.CueState.Perfect:
            gameScore += 3;
            Debug.Log("Perfect!");
            feedbackText.text  = "Perfect!";
            feedbackText.color = perfectColor;
            Destroy(gem.gameObject);

            newParticles    = Instantiate(goodParticles, gem.transform.position, Quaternion.identity);
            main            = newParticles.GetComponent <ParticleSystem>().main;
            main.startColor = perfectColor;
            Destroy(newParticles, 2f);

            break;

        case FallingGem.CueState.Late:
            feedbackText.text = "Missed!";
            Debug.Log(gem.playerInput);
            feedbackText.color = perfectColor;
            Debug.Log("Missed!");

            newParticles = Instantiate(badParticles, gem.transform.position, Quaternion.identity);
            Destroy(newParticles, 2f);

            break;
        }
    }