public override void ChangeState() { // 接地している場合 if (animator.GetBool("isGround")) { // 魔法長押し攻撃 if (isPressed && pressTime >= longPressIntervalTime) { state = "BlackHole"; isPressed = false; isreroad = false; } //下魔法(土) else if ((Input.GetKeyDown(KeyCode.C) || UB_magic.GetIsPressedDown()) && (Input.GetKey(KeyCode.DownArrow) || UB_down.GetIsPressed())) { state = "Tyoson"; } //上魔法(水) else if ((Input.GetKeyDown(KeyCode.C) || UB_magic.GetIsPressedDown()) && (Input.GetKey(KeyCode.UpArrow) || UB_up.GetIsPressed())) { state = "WaterMasic"; } //横魔法(火柱) else if (((Input.GetKeyDown(KeyCode.C) || UB_magic.GetIsPressedDown()) && (Input.GetKey(KeyCode.LeftArrow) || UB_left.GetIsPressed())) || ((Input.GetKeyDown(KeyCode.C) || UB_magic.GetIsPressedDown()) && (Input.GetKey(KeyCode.RightArrow) || UB_right.GetIsPressed()))) { state = "FireTower"; } // 魔法(火球) else if (Input.GetKeyDown(KeyCode.C) || UB_magic.GetIsPressedDown()) { state = "Fireball"; } else if (animator.GetCurrentAnimatorStateInfo(0).IsName("Idle")) { state = "IDLE"; } } else//空中にいる場合 { //空中魔法(水) if ((Input.GetKeyDown(KeyCode.C) || UB_magic.GetIsPressedDown()) && (Input.GetKey(KeyCode.UpArrow) || UB_up.GetIsPressed())) { state = "AirWaterMasic"; }//空中魔法(雷) else if ((Input.GetKeyDown(KeyCode.C) || UB_magic.GetIsPressedDown()) && (Input.GetKey(KeyCode.DownArrow) || UB_down.GetIsPressed())) { state = "Lightning-Strike"; } // 空中魔法(火球) else if (Input.GetKeyDown(KeyCode.C) || UB_magic.GetIsPressedDown()) { state = "AirFireball"; } else if (animator.GetCurrentAnimatorStateInfo(0).IsName("Fall")) { state = "FALL"; } } }
public override void GetInputKey() { key = 0; isDoubleJump = false; if (Input.GetKey(KeyCode.RightArrow) || UB_right.GetIsPressed()) //右 { key = 1; } if (Input.GetKey(KeyCode.LeftArrow) || UB_left.GetIsPressed()) //左 { key = -1; } if ((Input.GetKeyDown(KeyCode.Space) || UB_move.GetIsPressedDown()) && (!animator.GetBool("isGround")) && (state != "DJUMP"))//ジャンプボタン { isDoubleJump = true; } if (key != 0) { drec = key; } isDublePress = false; if ((Input.GetKeyDown(pressedKey) || UB_clone.GetIsPressedDown()) && pressedTime < 0.5f && isPress) { isDublePress = true; isPress = false; pressedTime = 0; } else if (Input.GetKeyDown(KeyCode.DownArrow) || UB_down.GetIsPressedDown() || Input.GetKeyDown(KeyCode.RightArrow) || UB_right.GetIsPressedDown() || Input.GetKeyDown(KeyCode.LeftArrow) || UB_left.GetIsPressedDown()) { if (UB_up.GetIsPressed()) { UB_clone = UB_up; isPress = true; } else if (UB_down.GetIsPressed()) { UB_clone = UB_down; isPress = true; } else if (UB_left.GetIsPressed()) { UB_clone = UB_left; isPress = true; } else if (UB_right.GetIsPressed()) { UB_clone = UB_right; isPress = true; } else { foreach (KeyCode code in Enum.GetValues(typeof(KeyCode))) { if (Input.GetKeyDown(code)) { pressedKey = code; isPress = true; } } } pressedTime = 0; } if (isPress) { pressedTime += Time.deltaTime; } }
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; } } }
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; } } }