Пример #1
0
    public override void GetInputKey()
    {
        Debug.Log(UB_sword.GetIsPressedDown());
        Debug.Log(UB_sword.GetIsPressed());

        if (Input.GetKey(KeyCode.Z) || UB_sword.GetIsPressed())
        {
            isPressed = true;
        }
        else
        {
            isPressed = false;
        }

        if (isPressed)
        {
            pressTime += Time.deltaTime;
        }
        else
        {
            pressTime = 0;
        }
    }
Пример #2
0
    public override void ChangeState()
    {
        // 接地している場合
        if (animator.GetBool("isGround"))
        {
            //ため攻撃
            if ((state == "Slashing_R") && (Input.GetKeyUp(KeyCode.Z) || UB_sword.GetIsPressedUp()))
            {
                state     = "Slashing";
                isPressed = false;
            }
            //ため攻撃(準備)
            else if (isPressed && pressTime >= longPressIntervalTime)
            {
                if (!SkillLearned.GetSkillActive("Slashing"))
                {
                    return;
                }

                state = "Slashing_R";
            }
            //ポーション投げ
            else if (Input.GetKeyDown(KeyCode.A))
            {
                state = "Potion";
            }
            //上攻撃
            else if ((Input.GetKeyDown(KeyCode.Z) || UB_sword.GetIsPressedDown()) &&
                     (Input.GetKey(KeyCode.UpArrow) || UB_up.GetIsPressed()))
            {
                state = "HighSlash";
            }
            //横攻撃
            else if (((Input.GetKeyDown(KeyCode.Z) || UB_sword.GetIsPressedDown()) &&
                      (Input.GetKey(KeyCode.LeftArrow) || UB_left.GetIsPressed())) ||
                     ((Input.GetKeyDown(KeyCode.Z) || UB_sword.GetIsPressedDown()) &&
                      (Input.GetKey(KeyCode.RightArrow) || UB_right.GetIsPressed())))
            {
                state = "ThrowSword";
            }
            //下攻撃
            else if (((Input.GetKeyDown(KeyCode.Z) || UB_sword.GetIsPressedDown()) &&
                      (Input.GetKey(KeyCode.DownArrow) || UB_down.GetIsPressed())))
            {
                state = "Iai";
            }
            // 1コンボ
            else if ((Input.GetKeyDown(KeyCode.Z) || UB_sword.GetIsPressedDown()) && !isComboing)
            {
                state      = "ATTACK1";
                isComboing = true;
            }// 2コンボ
            else if (animator.GetCurrentAnimatorStateInfo(0).IsName("Attack1") && (Input.GetKeyDown(KeyCode.Z) || UB_sword.GetIsPressedDown()))
            {
                state = "ATTACK2";
            }// 3コンボ
            else if (animator.GetCurrentAnimatorStateInfo(0).IsName("Attack2") && (Input.GetKeyDown(KeyCode.Z) || UB_sword.GetIsPressedDown()) &&
                     isAttack3)
            {
                state = "ATTACK3";
            }// 派生コンボ(ハンマー)
            else if (animator.GetCurrentAnimatorStateInfo(0).IsName("Attack2") && (Input.GetKeyDown(KeyCode.Z) || UB_sword.GetIsPressedDown()) &&
                     isHamma)
            {
                state = "Hamma";
            }// 派生コンボ(鎌)
            else if (animator.GetCurrentAnimatorStateInfo(0).IsName("Hamma") && (Input.GetKeyDown(KeyCode.Z) || UB_sword.GetIsPressedDown()))
            {
                state = "Sickle";
            }
            else if (animator.GetCurrentAnimatorStateInfo(0).IsName("AirAttack3_loop"))
            {
                state = "AirATTACK3E";

                isAAttack3 = false;
            }
            else if (animator.GetCurrentAnimatorStateInfo(0).IsName("AirRaid"))
            {
                state = "IDLE";
                GetComponent <PlayerAttackCollider>().AttackEnd();
                boxCol.enabled = false;
                PC.UnFreezGravity();
                rb.velocity = new Vector2(0, 0);
            }
            else if (animator.GetCurrentAnimatorStateInfo(0).IsName("Idle"))
            {
                state      = "IDLE";
                isComboing = false;
            }
        }
        else//空中にいる場合
        {
            //
            if (animator.GetCurrentAnimatorStateInfo(0).IsName("AirHighSlash_loop") && rb.velocity.y < 0.5f)
            {
                state = "AHighSlashE";
                return;
            }

            //空中上攻撃
            if (((Input.GetKeyDown(KeyCode.Z) || UB_sword.GetIsPressedDown()) && Input.GetKey(KeyCode.UpArrow)))
            {
                if (!SkillLearned.GetSkillActive("HighSlash"))
                {
                    return;
                }

                state = "AirHighSlash";
            }
            //空中横攻撃
            else if (((Input.GetKeyDown(KeyCode.Z) || UB_sword.GetIsPressedDown()) && (Input.GetKey(KeyCode.LeftArrow) || UB_left.GetIsPressed())) ||
                     ((Input.GetKeyDown(KeyCode.Z) || UB_sword.GetIsPressedDown()) && (Input.GetKey(KeyCode.RightArrow) || UB_right.GetIsPressed())))
            {
                state = "AirRaid";
            }
            //空中兜割り
            else if (((Input.GetKeyDown(KeyCode.Z) || UB_sword.GetIsPressedDown()) && (Input.GetKey(KeyCode.DownArrow) || UB_down.GetIsPressed())) && !isAAttack3)
            {
                state       = "AirATTACK3S";
                rb.velocity = new Vector2(0, 2);
                isAAttack3  = true;
            }
            // 空中兜割り(落下)
            else if (animator.GetCurrentAnimatorStateInfo(0).IsName("AirAttack3_loop"))
            {
                rb.AddForce(new Vector2(0, -50));
            }// 空中1コンボ
            else if ((Input.GetKeyDown(KeyCode.Z) || UB_sword.GetIsPressedDown()) && !isComboing)
            {
                state       = "AirATTACK1";
                isComboing  = true;
                rb.velocity = new Vector2(0, 2);
            }
            // 空中2コンボ
            else if (animator.GetCurrentAnimatorStateInfo(0).IsName("AirAttack1") && (Input.GetKeyDown(KeyCode.Z) || UB_sword.GetIsPressedDown()))
            {
                state       = "AirATTACK2";
                rb.velocity = new Vector2(0, 2);
            }
            else if (animator.GetCurrentAnimatorStateInfo(0).IsName("Fall"))
            {
                state      = "FALL";
                isComboing = false;
                isAAttack3 = false;
            }
        }
    }