private IEnumerator CheckNewBeat()
    {
        //yield return new WaitForSeconds(delayBeat);
        float current = 0;

        //Debug.Log("<color=blue>check new beat</color>");
        while (current < delayBeat / 1000)
        {
            current += Time.deltaTime;
            //Debug.Log(current);
            yield return(null);
        }
        //Debug.Log("<color=orange>check new beat <b>END</b></color>");

        if (_canDebug && comboStarted)
        {
            Debug.Log("beat: " + currentBeat);
        }

        if (skipBeat)
        {
            skipBeat = false;
            yield return(null);
        }

        //If user is waiting beats after performing a combo
        if (currentBeatsRemainingAfterCombo > 0)
        {
            currentBeatsRemainingAfterCombo--;

            if (currentBeatsRemainingAfterCombo == 0)
            {
                //TODO: feedback to show user recovers its input

                //Reset last combo performed
                performingCombo = null;
            }
        }
        else if (comboStarted)
        {
            if (CheckComboStep(true))
            {
                //currentComboStep++;

                //TODO: feedback

                //Check if combo was completed
                CheckComboCompleted();
            }
            else
            {
                ResetCurrentCombo(true);

                isAbleToPerformActions = false;

                //Back to idle when player fails
                StartCoroutine(Idle());
            }
        }
    }
    private IEnumerator ShowComboCompleteFeedback(ScriptableCombo actionCombo)
    {
        yield return(new WaitForSeconds(_timeDelayBeforeComboComplete));

        OnComboComplete(actionCombo, currentComboStep - 1);

        currentComboStep = 0;
    }
    private bool CheckComboStep(bool silence = false)
    {
        //Skip the checking if it is a beat to skip
        if (currentCombo.Length > 0)
        {
            string last = (currentCombo[currentCombo.Length - 1]).ToString().ToUpper();

            string current = currentBeat.ToString().ToUpper();

            if (current.Equals(last))
            {
                return(true);
            }
        }

        if (silence)
        {
            string lower = currentBeat.ToString().ToLower();
            currentBeat = lower[0];
        }

        //Append it to combo builder
        currentCombo.Append(currentBeat);

        for (int i = 0; i < _combos.Count; i++)
        {
            ScriptableCombo combo = _combos[i];

            //Check if current combo builder is prefix of combo
            int match = string.Compare(combo.beats, 0, currentCombo.ToString(), 0, currentCombo.Length);

            if (match == 0)
            {
                Debug.Log("<b><color=green>GOOD!!</color></b> - " + ((silence) ? "Silence" : "Action") + ", beat: " + currentBeat + ", current combo: " + currentCombo.ToString());

                if (!silence)
                {
                    //If it isn't the last step
                    if (currentCombo.Length < combo.beats.Length)
                    {
                        OnGoodComboStep(currentComboStep, combo.clipsFeedback[currentComboStep], (combo.keyAction == ActionType.Type.DODGE_DOWN) ? 0 : 1);//OnGoodComboStep(currentCombo.Length, combo.clipsFeedback[currentComboStep], (combo.keyAction == ActionType.Type.DODGE_DOWN)?0:1);
                    }
                }
            }

            if (match == 0)
            {
                return(true);
            }
        }

        OnBadComboStep(_combos[0]);

        return(false);
    }
Beispiel #4
0
    public void PerformCombo(ScriptableCombo actionCombo, int step)
    {
        currentTimeToHideFeedback = ((PlayerController)entityController).TimePerformingCombo;

        Debug.Log("Player::ComboComplete -- step: " + step);

        _anim.ResetTrigger("Idle");
        _anim.SetInteger("ComboStep", step);
        _anim.SetTrigger("ComboGood");
        _anim.SetInteger("ComboType", (actionCombo.keyAction == ActionType.Type.DODGE_DOWN)?0:1);
    }
    private void CheckComboCompleted()
    {
        //Check if one of the combos was completed
        for (int i = 0; i < _combos.Count; i++)
        {
            ScriptableCombo combo = _combos[i];

            if (currentCombo.ToString().Equals(combo.beats))
            {
                Debug.Log("<b><i><color=magenta>COMBOOOOOOOO!!!!</color></i></b> Action: " + combo.keyAction);

                //Reset current step and feedback fo combo completed
                SuccessfullCombo(combo);
            }
        }
    }
    private void SuccessfullCombo(ScriptableCombo actionCombo)
    {
        //Reset action started
        comboStarted = false;

        currentBeatsRemainingAfterCombo = actionCombo.beatsFreezingAfterCombo;

        performingCombo = actionCombo;

        //currentComboStep = 0;

        currentCombo.Remove(0, currentCombo.Length);

        StartCoroutine(ShowComboCompleteFeedback(actionCombo));

        isAbleToPerformActions = false;

        timePerformingComboRemains = _timePerformingCombo;
    }
Beispiel #7
0
 public void PerformCombo(ScriptableCombo actionCombo)
 {
 }
Beispiel #8
0
 public void NegativeFeedback(ScriptableCombo combo)
 {
 }
Beispiel #9
0
    private void PerformCombo(ScriptableCombo combo, int step)
    {
        int clipIndex = combo.clipsFeedback.Length - 1;

        Play(combo.clipsFeedback[clipIndex]);
    }
Beispiel #10
0
 private void BadComboStep(ScriptableCombo combo)
 {
     Play(combo.clipBadStep);
 }
Beispiel #11
0
 public void NegativeFeedback(ScriptableCombo combo)
 {
     _anim.ResetTrigger("Idle");
     _anim.SetTrigger("ComboMiss");
 }