コード例 #1
0
    private void HandleActionInput()
    {
        if (charInput.actionInputs.Count == 0)
        {
            return;
        }

        if (charState.hitstunDuration > 0 || !charAnimations.IsCurStateTag("Idle"))//can't do things when in lag or hitstun
        {
            bufferCounter++;
            if (bufferCounter > GlobalParameterHelper.INPUT_BUFFER_SIZE)
            {
                Debug.Log("Clear Buffer");
                charInput.actionInputs.Clear();
                charAnimations.ResetAllTriggers();
                bufferCounter = 0;
            }

            return;
        }

        //not enough meter to do a special
        if (charInput.actionInputs[0] == CharActionInput.EXNeutralSpecial ||
            charInput.actionInputs[0] == CharActionInput.EXUpSpecial ||
            charInput.actionInputs[0] == CharActionInput.EXDownSpecial ||
            charInput.actionInputs[0] == CharActionInput.EXLeftSpecial ||
            charInput.actionInputs[0] == CharActionInput.EXRightSpecial)
        {
            if (charState.meter < charSettings.sizeOfEachMeterBar)
            {
                charInput.actionInputs.RemoveAt(0);
                return;
            }
        }


        switch (charInput.actionInputs[0])//consume input and do things
        {
        case CharActionInput.Jump:
            if (!charState.isGrounded && charState.airJumpsRemaining <= 0 && !charState.backIsOnWall && !charState.frontIsOnWall)
            {
                charInput.actionInputs.RemoveAt(0);
                return;
            }
            break;

        case CharActionInput.NeutralAttack:
            break;

        case CharActionInput.LeftAttack:
            break;

        case CharActionInput.RightAttack:
            break;

        case CharActionInput.UpAttack:
            break;

        case CharActionInput.DownAttack:
            break;

        case CharActionInput.NeutralSpecial:
            break;

        case CharActionInput.LeftSpecial:
            if (charState.isFacingRight)
            {
                charState.Flip();
            }

            break;

        case CharActionInput.RightSpecial:
            if (!charState.isFacingRight)
            {
                charState.Flip();
            }
            break;

        case CharActionInput.UpSpecial:
            break;

        case CharActionInput.DownSpecial:
            break;

        case CharActionInput.EXNeutralSpecial:
            charState.UseMeter(1);
            break;

        case CharActionInput.EXLeftSpecial:
            charState.UseMeter(1);
            if (charState.isFacingRight)
            {
                charState.Flip();
            }
            break;

        case CharActionInput.EXRightSpecial:
            charState.UseMeter(1);
            if (!charState.isFacingRight)
            {
                charState.Flip();
            }
            break;

        case CharActionInput.EXUpSpecial:
            charState.UseMeter(1);
            break;

        case CharActionInput.EXDownSpecial:
            charState.UseMeter(1);
            break;

        default:
            break;
        }

        bufferCounter = 0;
        TellCharAnimations(charInput.actionInputs[0]);
        //Debug.Log(charInput.actionInputs[0].ToString());
        charInput.actionInputs.RemoveAt(0);
    }