Exemplo n.º 1
0
    void Update()
    {
        for (int i = 0; i < lights.Length; i++)
        {
            lights[i].GetComponent <HDAdditionalLightData>().lightDimmer = lightCurve.Evaluate((one - (float)BeatManager.OffBeatPercent()));
            //   lights[i].spotAngle = lightAngle[i] * lightAngleCurve.Evaluate((one - (float)BeatManager.OffBeatPercent()));
        }

        foreach (Material mat in mats)
        {
            mat.SetFloat(materailref, materialCurve.Evaluate((one - (float)BeatManager.OffBeatPercent())));
        }
    }
Exemplo n.º 2
0
    public RhythmGrade GetGrade()
    {
        if (timeOfLastHit == Time.time)
        {
            return(thisFrameGrade);
        }


        bool mashing = Time.time - timeOfLastHit < MashSafeTime;

        timeOfLastHit = Time.time;

        if (mashing)
        {
            thisFrameGrade = RhythmGrade.Miss;
            return(thisFrameGrade);
        }

        double beatPercentage = BeatManager.OffBeatPercent();

        if (beatPercentage > 0.5d)
        {
            beatPercentage = 1 - beatPercentage;
        }

        beatPercentage *= 2d;

        if (beatPercentage > GoodPercentage)
        {
            thisFrameGrade = RhythmGrade.Miss;
        }
        else if (beatPercentage > GreatPercentage)
        {
            thisFrameGrade = RhythmGrade.Good;
        }
        else if (beatPercentage > ExcellentPercentage)
        {
            thisFrameGrade = RhythmGrade.Great;
        }
        else if (beatPercentage > SuperPercentage)
        {
            thisFrameGrade = RhythmGrade.Excellent;
        }
        else
        {
            thisFrameGrade = RhythmGrade.Super;
        }

        return(thisFrameGrade);
    }
Exemplo n.º 3
0
    void Update()
    {
        AudioEvent.getPlaybackState(out PLAYBACK_STATE state);
        if (state != PLAYBACK_STATE.PLAYING)
        {
            GamePad.SetVibration(PlayerIndex.One, 0f, 0f);
            return;
        }


        beatTimer += Time.unscaledDeltaTime;
        trackTime += Time.unscaledDeltaTime;
        if (settingUp)
        {
            AudioEvent.getTimelinePosition(out int pos);
            if (pos < 2000)
            {
                return;
            }
            beatTimer = (pos - 2000) * 0.001f;
            trackTime = (float)beatTimer;
            settingUp = false;
        }

        AudioEvent.getPlaybackState(out playbackState);
        if (playbackState != PLAYBACK_STATE.PLAYING)
        {
            return;
        }


        if (beatTimer >= 0.5f)
        {
            Debug.Log("Beat!");
            OnBeat?.Invoke();
            beatTimer -= 0.5f;
        }



        if (Input.GetKeyDown(KeyCode.F))
        {
            SetIntensity(CombatIntensity + 0.1f);
        }

        rumbleForce = rumbleCurve.Evaluate((one - (float)BeatManager.OffBeatPercent()));
        GamePad.SetVibration(PlayerIndex.One, rumbleForce, rumbleForce);
    }
Exemplo n.º 4
0
    void Update()
    {
        float piceOfMovement = startDistance / BeatsCount;

        for (int i = 1; i <= BeatsCount; i++)
        {
            rightImage[i - 1].rectTransform.anchoredPosition = Vector2.Lerp(new Vector2(piceOfMovement * i, 0), new Vector2(piceOfMovement * (i - 1), 0), BeatManager.GetTimeToQuarterNote());
            lefImage[i - 1].rectTransform.anchoredPosition   = Vector2.Lerp(new Vector2(-piceOfMovement * i, 0), new Vector2(-piceOfMovement * (i - 1), 0), BeatManager.GetTimeToQuarterNote());

            if (i == BeatsCount)
            {
                rightImage[i - 1].color = new Color(startColor.r, startColor.g, startColor.b, BeatManager.GetTimeToQuarterNote());
                lefImage[i - 1].color   = new Color(startColor.r, startColor.g, startColor.b, BeatManager.GetTimeToQuarterNote());
            }
        }
        float currentBeatTime = (float)BeatManager.OffBeatPercent();
        bool  showCircle      = currentBeatTime <= PostBeatVisualzsion || currentBeatTime > 1 - PreBeatVisualzsion;

        BeatCircle.SetActive(showCircle);
    }
Exemplo n.º 5
0
    // Update is called once per frame
    void Update()
    {
        if (!BeatManager.IsSetup())
        {
            return;
        }
        switch (beatCounter)
        {
        case 0:
            if (BeatManager.OffBeatPercent() >= 0.25)
            {
                CentreBeat.enabled = false;
                Outer.SetImageActive(true);
                beatCounter = 1;
            }
            break;

        case 1:
            if (BeatManager.OffBeatPercent() >= 0.5)
            {
                Outer.SetImageActive(false);
                Middle.SetImageActive(true);
                beatCounter = 2;
            }
            break;

        case 2:
            if (BeatManager.OffBeatPercent() >= 0.75)
            {
                Middle.SetImageActive(false);
                Inner.SetImageActive(true);
                beatCounter = 3;
            }
            break;

        default:
            break;
        }
    }
Exemplo n.º 6
0
 // Update is called once per frame
 void Update()
 {
     slider.value = (float)BeatManager.OffBeatPercent();
 }