コード例 #1
0
    void normalSwordAttackCoolTimeCount()
    {
        if (playerMoveScript.state != PlayerState.attack)
        {
            isCool      = false;
            onceCheck02 = false;
            onceCheck03 = false;

            noOfClicks = 0;
            playerSwordBoxCollider.enabled = false;

            attackCoolTime = false;
            //  playerAnimationScript.playerAniAttackLeftCombo(0);
            maxComboDelay = 2f;
        }
        else if (Time.time - lastClickedTime > maxComboDelay)
        {
            onceCheck02 = false;
            onceCheck03 = false;

            noOfClicks = 0;
            playerSwordBoxCollider.enabled = false;
            attackCoolTime = false;
            playerAnimationScript.playerAniAttackLeftCombo(0);
            maxComboDelay = 2f;

            playerMoveScript.state = PlayerState.idle;
        }
        else if (Time.time - lastClickedTime < maxComboDelay)
        {
            if (noOfClicks >= 2 && onceCheck02 == false)
            {
                onceCheck02 = true;
                playerSwordBoxCollider.enabled = true;

                playerAnimationScript.playerAniAttackLeftCombo(2);
                SoundManager.Instance.playerAttackSound(0);

                maxComboDelay = 0.8f;
            }
            else if (noOfClicks == 3 && onceCheck03 == false)
            {
                playerSpConScript.spDown();

                isCool      = true;
                onceCheck03 = true;
                playerSwordBoxCollider.enabled = true;

                playerAnimationScript.playerAniAttackLeftCombo(3);
                SoundManager.Instance.playerAttackSound(1);
            }
        }
    }
コード例 #2
0
    //  상태에 따라 입력 가능이 바뀜
    #region
    void inputProcessIdleAndNormalAttacked()
    {
        if (PlayerUI == PlayerUI.invenOn)
        {
            return;
        }

        checkRotationAndKeyDownToAniCon();

        if (Input.GetMouseButtonDown(1))
        {
            if (playerWeaponUIScript.isWeaponChangeCoolTime == true)
            {
                return;
            }
            playerWeaponUIScript.playerWeaponUISelect();
        }

        // 그냥 이동함?
        if (Input.GetKey(KeyCode.D) || Input.GetKey(KeyCode.A) || Input.GetKey(KeyCode.W) || Input.GetKey(KeyCode.S))
        {
            hAxis = Input.GetAxisRaw("Horizontal");
            vAxis = Input.GetAxisRaw("Vertical");

            transform.position += new Vector3(hAxis, 0, vAxis) * speed * Time.deltaTime;
            playerAnimationScript.playerAniWalk();

            SoundManager.Instance.playerWalkSound();
        }
        // 가만히 있음?
        else if (Input.GetKeyUp(KeyCode.D) || Input.GetKeyUp(KeyCode.A) || Input.GetKeyUp(KeyCode.W) || Input.GetKeyUp(KeyCode.S))
        {
            playerAnimationScript.playerAniWait();
        }

        // 기력은 충분하니?
        if (playerSpConScript.isPlayerSpZero == true)
        {
            return;
        }

        // 공격 함?
        if (Input.GetMouseButtonDown(0))
        {
            if (playerAttackConScript.isCool == true)
            {
                return;
            }

            playerAttackConScript.whenAttackCheckWeapon();
        }
        //구르기 위한 조건을 만족 하니?
        if (playerDodgeConScript.playerDodgeCoolTime == true || state == PlayerState.stunAttacked ||
            state == PlayerState.airborneAttacked || state == PlayerState.stunAttacked)
        {
            return;
        }
        else if (Input.GetKeyDown(KeyCode.Space) && Input.GetKey(KeyCode.A))
        {
            playerDodgeConScript.dodgeAndGetKeyA(); playerSpConScript.spDown();
        }
        else if (Input.GetKeyDown(KeyCode.Space) && Input.GetKey(KeyCode.D))
        {
            playerDodgeConScript.dodgeAndGetKeyD(); playerSpConScript.spDown();
        }
        else if (Input.GetKeyDown(KeyCode.Space) && Input.GetKey(KeyCode.S))
        {
            playerDodgeConScript.dodgeAndGetKeyS(); playerSpConScript.spDown();
        }
        else if (Input.GetKeyDown(KeyCode.Space) && Input.GetKey(KeyCode.W))
        {
            playerDodgeConScript.dodgeAndGetKeyW(); playerSpConScript.spDown();
        }
    }