예제 #1
0
    public override void GetInputKey()
    {
        if (Input.GetKeyUp(KeyCode.X) || UB_gun.GetIsPressedUp())
        {
            isreload = true;
        }

        if (Input.GetKey(KeyCode.X) || UB_gun.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 (animator.GetCurrentAnimatorStateInfo(0).IsName("MachineGun") && (Input.GetKeyUp(KeyCode.X) || UB_gun.GetIsPressedUp()))
            {
                state = "IDLE";
            }
            // 銃長押し攻撃
            else if (isPressed && pressTime >= longPressIntervalTime)
            {
                if (pressTime >= 3.0f)
                {
                    state = "IDLE";
                    return;
                }

                if (isreload)
                {
                    state    = "MachineGun";
                    isreload = false;
                }
            }// 横銃(レールガン)
            else if (((Input.GetKeyDown(KeyCode.X) || UB_gun.GetIsPressedDown()) && (Input.GetKey(KeyCode.LeftArrow) || UB_left.GetIsPressed())) ||
                     ((Input.GetKeyDown(KeyCode.X) || UB_gun.GetIsPressedDown()) && (Input.GetKey(KeyCode.RightArrow) || UB_right.GetIsPressed())))
            {
                state = "RailGun";
            }//上銃(ファンネル)
            else if ((Input.GetKeyDown(KeyCode.X) || UB_gun.GetIsPressedDown()) && (Input.GetKey(KeyCode.UpArrow) || UB_up.GetIsPressed()))
            {
                if (!SkillLearned.GetSkillActive("Fannel"))
                {
                    return;
                }

                var gameobject = GameObject.Find("fannel(Clone)");
                if (gameobject == null)
                {
                    InstanceFannel();
                }
            }// 下銃(乱れうち)
            else if ((Input.GetKeyDown(KeyCode.X) || UB_gun.GetIsPressedDown()) && (Input.GetKey(KeyCode.DownArrow) || UB_down.GetIsPressed()))
            {
                state = "Midareuti";
            }
            // 銃コンボ1
            else if (((Input.GetKeyDown(KeyCode.X) || UB_gun.GetIsPressedDown()) && !isComboing) ||
                     (animator.GetCurrentAnimatorStateInfo(0).IsName("GunAttack2") && (Input.GetKeyDown(KeyCode.X) || UB_gun.GetIsPressedDown())))
            {
                state      = "GunATTACK1";
                isComboing = true;
                GunAttack();
            }// 銃コンボ2
            else if (animator.GetCurrentAnimatorStateInfo(0).IsName("GunAttack1") && (Input.GetKeyDown(KeyCode.X) || UB_gun.GetIsPressedDown()))
            {
                state = "GunATTACK2";
                GunAttack();
            }
            else if (animator.GetCurrentAnimatorStateInfo(0).IsName("Idle"))
            {
                state      = "IDLE";
                isComboing = false;
            }
        }
        else//空中にいる場合
        {
            //空中横銃攻撃(ショットガン横)
            if (((Input.GetKeyDown(KeyCode.X) || UB_gun.GetIsPressedDown()) && (Input.GetKey(KeyCode.LeftArrow) || UB_left.GetIsPressed())) ||
                ((Input.GetKeyDown(KeyCode.X) || UB_gun.GetIsPressedDown()) && (Input.GetKey(KeyCode.RightArrow) || UB_right.GetIsPressed())))
            {
                state = "ShotGun";
            }
            //空中下銃攻撃(ショットガン下)
            else if ((Input.GetKeyDown(KeyCode.X) || UB_gun.GetIsPressedDown()) && (Input.GetKey(KeyCode.DownArrow) || UB_down.GetIsPressed()))
            {
                if (!SkillLearned.GetSkillActive("ShotGun"))
                {
                    return;
                }

                state = "ShotGun_Down";
            }
            //空中上銃(ファンネル)
            else if ((Input.GetKeyDown(KeyCode.X) || UB_gun.GetIsPressedDown()) && (Input.GetKey(KeyCode.UpArrow) || UB_up.GetIsPressed()))
            {
                if (!SkillLearned.GetSkillActive("Fannel"))
                {
                    return;
                }

                var gameobject = GameObject.Find("fannel(Clone)");
                if (gameobject == null)
                {
                    InstanceFannel();
                }
            }
            // 空中銃1コンボ
            else if (((Input.GetKeyDown(KeyCode.X) || UB_gun.GetIsPressedDown()) && !isComboing) ||
                     (animator.GetCurrentAnimatorStateInfo(0).IsName("AirGunAttack2") && (Input.GetKeyDown(KeyCode.X) || UB_gun.GetIsPressedDown())))
            {
                state       = "AirGunATTACK1";
                isComboing  = true;
                rb.velocity = new Vector2(0, 1);
                GunAttack();
            }
            // 空中銃2コンボ
            else if ((animator.GetCurrentAnimatorStateInfo(0).IsName("AirGunAttack1") && (Input.GetKeyDown(KeyCode.X) || UB_gun.GetIsPressedDown())))
            {
                state       = "AirGunATTACK2";
                rb.velocity = new Vector2(0, 1);
                GunAttack();
            }
            else if (animator.GetCurrentAnimatorStateInfo(0).IsName("Fall"))
            {
                state      = "FALL";
                isComboing = false;
            }
        }
    }