コード例 #1
0
    private void handleInputs()
    {
        motion = Vector3.zero;

        var x = Input.GetAxis("Horizontal");

        motion += x * Vector3.right * moveSpeed;
        var y = Input.GetAxis("Vertical");

        motion += y * Vector3.up * moveSpeed;

        if (motion.sqrMagnitude < sqrDeadzone)
        {
            motion = Vector3.zero;
        }

        if (motion.sqrMagnitude > sqrMoveSpeed)
        {
            motion = motion.normalized * moveSpeed;
        }

        if (Input.GetButtonDown("LongSyllable"))
        {
            if (syllableFinished)
            {
                return;
            }

            if (meterManager.IsOnLongSyllable())
            {
                stageManager.ActorSuccess();
                syllableFinished = true;
            }
            else
            {
                stageManager.ActorFail();
            }
        }

        if (Input.GetButtonDown("ShortSyllable"))
        {
            if (syllableFinished)
            {
                return;
            }

            if (meterManager.IsOnShortSyllable())
            {
                stageManager.ActorSuccess();
                syllableFinished = true;
                Debug.Log(meterManager.beatCount);
            }
            else
            {
                stageManager.ActorFail();
            }
        }
    }