예제 #1
0
 public override void Clear(NoteGrading grading)
 {
     base.Clear(grading);
     if (connectedNoteView == null && chainHead != null) // Last chain note
     {
         Destroy(chainHead.gameObject);
     }
 }
예제 #2
0
 public virtual void Clear(NoteGrading grading)
 {
     cleared = true;
     // Add to play data
     game.PlayData.ClearNote(this);
     particleManager.PlayClearFX(this, grading, this is HoldNoteView ? ((HoldNoteView)this).note.time + ((HoldNoteView)this).note.duration - game.TimeElapsed: TimeUntil, game.showEarlyLateIndicator);
     ringSpriteRenderer.enabled = false;
     fillSpriteRenderer.enabled = false;
     circleCollider.enabled     = false;
     // Add to ranked play data
     game.RankedPlayData.notes.Add(rankedNoteData);
     StartCoroutine(DestroyLater());
 }
예제 #3
0
    public static float ScoreWeight(this NoteGrading grading, bool ranked)
    {
        if (!ranked)
        {
            switch (grading)
            {
            case NoteGrading.Perfect:
                return(1f);

            case NoteGrading.Great:
                return(1f);

            case NoteGrading.Good:
                return(0.7f);

            case NoteGrading.Bad:
                return(0.3f);

            case NoteGrading.Miss:
                return(0f);
            }
        }
        else
        {
            switch (grading)
            {
            case NoteGrading.Perfect:
                return(1f);

            case NoteGrading.Great:
                return(0.9f);

            case NoteGrading.Good:
                return(0.5f);

            case NoteGrading.Bad:
                return(0.1f);

            case NoteGrading.Miss:
                return(0f);
            }
        }
        return(0f);
    }
예제 #4
0
 public override void Clear(NoteGrading grading)
 {
     if (cleared)
     {
         Debug.LogError("This note is cleared already.");
     }
     base.Clear(grading);
     if (holdRail != null)
     {
         Destroy(holdRail.gameObject);
     }
     if (holdCart != null)
     {
         Destroy(holdCart.gameObject);
     }
     if (mask != null)
     {
         Destroy(mask.gameObject);
     }
 }
예제 #5
0
    public static float TpWeight(this NoteGrading grading)
    {
        switch (grading)
        {
        case NoteGrading.Perfect:
            return(1f);

        case NoteGrading.Great:
            return(0.7f);

        case NoteGrading.Good:
            return(0.3f);

        case NoteGrading.Bad:
            return(0f);

        case NoteGrading.Miss:
            return(0f);
        }
        return(0f);
    }
예제 #6
0
    public void PlayClearFX(NoteView noteView, NoteGrading grading, float timeUntilComplete, bool earlyLateIndicator)
    {
        var at      = noteView.transform.position;
        var clearFX = this.clearFX;

        if (noteView is ChainNoteView)
        {
            clearFX = clearChainFX;
        }
        if (noteView.note.type == NoteType.Hold)
        {
            at = new Vector3(at.x, ScannerView.Instance.transform.position.y, at.z);
        }
        if (grading == NoteGrading.Miss)
        {
            var fx = Instantiate(missFX, at, Quaternion.identity);
            fx.Stop();

            var mainModule = fx.main;
            mainModule.simulationSpeed = 0.3f;
            mainModule.duration        = mainModule.duration / 0.3f;
            mainModule.startColor      = theme.missColor;

            /*var childFx = fx.transform.GetChild(0).GetComponent<ParticleSystem>();
             * var childMainModule = childFx.main;
             * childMainModule.startColor = noteView.fillColor;*/

            if (noteView.note.type == NoteType.Chain)
            {
                fx.transform.localScale = new Vector3(2, 2, 2);
            }

            fx.Play();
            Destroy(fx.gameObject, fx.main.duration);
        }
        else
        {
            var fx = Instantiate(clearFX, at, Quaternion.identity);
            fx.Stop();

            if (!(noteView is ChainNoteView))
            {
                if (earlyLateIndicator)
                {
                    if (grading != NoteGrading.Perfect)
                    {
                        fx.transform.GetChild(0).GetChild(timeUntilComplete > 0 ? 1 : 0).gameObject.SetActive(false);

                        /*var system = fx.transform.GetChild(0).GetChild(timeUntilComplete > 0 ? 1 : 0).GetComponent<ParticleSystem>();
                         * var colorOverLifetime = system.colorOverLifetime;
                         * colorOverLifetime.color = new ParticleSystem.MinMaxGradient();*/
                    }
                    else
                    {
                        fx.transform.GetChild(0).GetChild(0).gameObject.SetActive(false);
                        fx.transform.GetChild(0).GetChild(1).gameObject.SetActive(false);
                    }
                }
                else
                {
                    fx.transform.GetChild(0).GetChild(0).gameObject.SetActive(false);
                    fx.transform.GetChild(0).GetChild(1).gameObject.SetActive(false);
                }
            }

            var speed = 1f;
            var color = theme.perfectColor;
            switch (grading)
            {
            case NoteGrading.Great:
                speed = 0.9f;
                color = theme.greatColor;
                break;

            case NoteGrading.Good:
                speed = 0.7f;
                color = theme.goodColor;
                break;

            case NoteGrading.Bad:
                speed = 0.5f;
                color = theme.badColor;
                break;
            }

            var mainModule = fx.main;
            mainModule.simulationSpeed = speed;
            mainModule.duration        = mainModule.duration / speed;
            mainModule.startColor      = color;

            if (noteView.note.type == NoteType.Chain)
            {
                fx.transform.localScale = new Vector3(3f, 3f, 3f);
            }

            /*var childFx = fx.transform.GetChild(0).GetComponent<ParticleSystem>();
             * var childMainModule = childFx.main;
             * childMainModule.startColor = noteView.fillColor;*/

            fx.Play();
            Destroy(fx.gameObject, fx.main.duration);
        }
    }