Ejemplo n.º 1
0
    private void HandleRythmKey(RythmKey key)
    {
        if (!inputActive)
        {
            return;
        }

        spotLight.SetActive(true);
        arrow.enabled = true;
        switch (Inputs[currentInputIndex])
        {
        case RythmKey.Down:
            arrow.rectTransform.localEulerAngles = new Vector3(0, 0, 0);
            break;

        case RythmKey.Up:
            arrow.rectTransform.localEulerAngles = new Vector3(0, 0, 180);
            break;

        case RythmKey.Left:
            arrow.rectTransform.localEulerAngles = new Vector3(0, 0, 270);
            break;

        case RythmKey.Right:
            arrow.rectTransform.localEulerAngles = new Vector3(0, 0, 90);
            break;

        default:
            break;
        }

        if (key == Inputs[currentInputIndex])
        {
            currentInputIndex++;
            arrow.color = _rightColor;
            source.clip = right;
            source.Play();
            if (currentInputIndex >= Inputs.Count)
            {
                StartCoroutine(NextRound(true));
            }
        }
        else
        {
            arrow.color = _wrongColor;
            source.clip = wrong;
            source.Play();
            StartCoroutine(NextRound(false));
        }
    }
Ejemplo n.º 2
0
    public void HandleRythmKey(bool wasPressed, RythmKey side)
    {
        if (RythmManager.Instance.KeysQueue.Count == 0)
        {
            return;
        }

        canPlayKeyThisFrame = false;

        RythmKey rightSide = RythmManager.Instance.KeysQueue.Peek().rythmKey;

        if (BattleController.Instance != null)
        {
            if (canPlayKey && wasPressed && (rightSide == side))
            {
                //print("Acertou");
                BattleController.Instance.UpdateHype(true);
                BattleController.Instance.currentmoveScore++;
            }
            else
            {
                //print("Errou");
                BattleController.Instance.SchratchSource.Play();
                BattleController.Instance.UpdateHype(false);
            }
        }
        else
        {
            if (canPlayKey && wasPressed && (rightSide == side))
            {
                RythmManager.Instance.CurrentMoveRight++;
            }
            else
            {
                RythmManager.Instance.Scratch.Play();
            }
        }



        switch (side)
        {
        case RythmKey.Up:
            RythmManager.Instance.KeysQueue.Dequeue();
            break;

        case RythmKey.Down:
            RythmManager.Instance.KeysQueue.Dequeue();
            break;

        case RythmKey.Left:
            RythmManager.Instance.KeysQueue.Dequeue();
            break;

        case RythmKey.Right:
            RythmManager.Instance.KeysQueue.Dequeue();
            break;
        }


        RythmManager.Instance.CurrentMoveCount++;
        if (RythmManager.Instance.CurrentMoveCount == RythmManager.Instance.RythmToPlay.rythmData.Length)
        {
            if (BattleController.Instance != null)
            {
                BattleController.Instance.SetBattleStage(EBattleStage.DamageStep);
            }
            else
            {
                RythmManager.Instance.MoveDone = true;
            }
        }
        Destroy(this.gameObject);
    }