コード例 #1
0
    public override void ChangeAnimation()
    {
        try
        {
            if (!SkillLearned.GetSkillActive(state))
            {
                state = prevState;
            }
        }
        catch { }

        // 状態が変わった場合のみアニメーションを変更する
        //Debug.Log(state);
        if (prevState != state)
        {
            switch (state)
            {
            case "Fireball":
                animator.SetBool("isFireball", true);
                break;

            case "AirFireball":
                animator.SetBool("isAFireball", true);
                break;

            case "FireTower":
                animator.SetBool("isFiretower", true);
                break;

            case "WaterMasic":
                animator.SetBool("isWaterMasic", true);
                break;

            case "AirWaterMasic":
                animator.SetBool("isAWaterMasic", true);
                break;

            case "Tyoson":
                animator.SetBool("isTyoson", true);
                break;

            case "Lightning-Strike":
                animator.SetBool("isLightningstrike", true);
                break;

            case "BlackHole":
                animator.SetBool("isBlackhole", true);
                break;

            default:
                animator.SetBool("isFireball", false);
                animator.SetBool("isAFireball", false);
                animator.SetBool("isFiretower", false);
                animator.SetBool("isWaterMasic", false);
                animator.SetBool("isAWaterMasic", false);
                animator.SetBool("isTyoson", false);
                animator.SetBool("isLightningstrike", false);
                animator.SetBool("isBlackhole", false);
                break;
            }
            //状態の変更を判定するために状態を保存しておく
            prevState = state;
        }
    }
コード例 #2
0
    public override void ChangeAnimation()
    {
        try
        {
            if (!SkillLearned.GetSkillActive(state))
            {
                state = prevState;
            }
        }
        catch { }

        // 状態が変わった場合のみアニメーションを変更する
        if (prevState != state)
        {
            switch (state)
            {
            case "GunATTACK1":
                animator.SetBool("isGunAttack1", true);
                animator.SetBool("isGunAttack2", false);
                break;

            case "GunATTACK2":
                animator.SetBool("isGunAttack2", true);
                animator.SetBool("isGunAttack1", false);
                break;

            case "AirGunATTACK1":
                animator.SetBool("isAGunAttack1", true);
                animator.SetBool("isAGunAttack2", false);
                animator.SetBool("isJump", false);
                break;

            case "AirGunATTACK2":
                animator.SetBool("isAGunAttack2", true);
                animator.SetBool("isAGunAttack1", false);
                animator.SetBool("isJump", false);
                break;

            case "RailGun":
                animator.SetBool("isRailGun", true);
                break;

            case "MachineGun":
                animator.SetBool("isMachineGun", true);
                break;

            case "ShotGun":
                animator.SetBool("isShotGun", true);
                break;

            case "ShotGun_Down":
                animator.SetBool("isShotGunD", true);
                break;

            case "Midareuti":
                animator.SetBool("isMidareuti", true);
                break;

            default:
                animator.SetBool("isGunAttack1", false);
                animator.SetBool("isGunAttack2", false);
                animator.SetBool("isAGunAttack1", false);
                animator.SetBool("isAGunAttack2", false);
                animator.SetBool("isRailGun", false);
                animator.SetBool("isMachineGun", false);
                animator.SetBool("isShotGun", false);
                animator.SetBool("isShotGunD", false);
                animator.SetBool("isMidareuti", false);
                ResetPressTIme();
                break;
            }
            //状態の変更を判定するために状態を保存しておく
            prevState = state;
        }
    }
コード例 #3
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;
            }
        }
    }
コード例 #4
0
    public void ChangeState()
    {
        //taka

        if ((UB_summon.GetIsPressedDown() || Input.GetKeyDown(KeyCode.V)) && (UB_up.GetIsPressed() || Input.GetKey(KeyCode.UpArrow)) && SkillLearned.GetSkillActive("SummonTaka"))
        {
            if (judge[0])
            {
                judge[0] = false;
                Instantiate(taka, new Vector3(player.transform.position.x - 10, player.transform.position.y + 10, player.transform.position.z), Quaternion.identity);
                StartCoroutine("TukaimaCT", 0);
            }
        }
        //yousei
        else if ((UB_summon.GetIsPressedDown() || Input.GetKeyDown(KeyCode.V)) && (UB_down.GetIsPressed() || Input.GetKey(KeyCode.DownArrow)) && SkillLearned.GetSkillActive("SummonYosei"))
        {
            if (judge[1])
            {
                judge[1] = false;
                Instantiate(fairly, new Vector3(player.transform.position.x + 2, player.transform.position.y, player.transform.position.z), Quaternion.identity);
                StartCoroutine("TukaimaCT", 1);
            }
        }
        else if ((UB_summon.GetIsPressedDown() || Input.GetKeyDown(KeyCode.V)) && (UB_right.GetIsPressed() || UB_left.GetIsPressed() || Input.GetKey(KeyCode.RightArrow) || Input.GetKey(KeyCode.LeftArrow)) && judge[2] && SkillLearned.GetSkillActive("SummonSaboten"))
        {
            if (judge[2])
            {
                judge[2] = false;
                Instantiate(saboten, new Vector3(player.transform.position.x + 2, player.transform.position.y, player.transform.position.z), Quaternion.identity);
                StartCoroutine("TukaimaCT", 2);
            }
        }
        else if ((UB_summon.GetIsPressedDown() || Input.GetKeyDown(KeyCode.V)) && judge[3] && SkillLearned.GetSkillActive("SummonOokami"))
        {
            if (judge[3])
            {
                judge[3] = false;
                Instantiate(ookami, new Vector3(player.transform.position.x - 0.1f, player.transform.position.y - 0.4f, player.transform.position.z), Quaternion.identity);
                StartCoroutine("TukaimaCT", 3);
            }
        }
    }
コード例 #5
0
ファイル: PlayerController.cs プロジェクト: muinus/ActionGame
    public override void ChangeAnimation()
    {
        try
        {
            if (!SkillLearned.GetSkillActive(state))
            {
                state = prevState;
            }
        }
        catch { }

        // 状態が変わった場合のみアニメーションを変更する
        if (prevState != state)
        {
            switch (state)
            {
            case "JUMP":
                animator.SetBool("isJump", true);
                animator.SetBool("isFall", false);
                animator.SetBool("isMove", false);
                animator.SetBool("isALanding_E", false);
                stateEffect = 0.5f;
                break;

            case "DJUMP":
                animator.SetBool("isDJump", true);
                animator.SetBool("isJump", false);
                animator.SetBool("isFall", false);
                animator.SetBool("isMove", false);
                stateEffect = 0.5f;
                break;

            case "FALL":
                animator.SetBool("isDJump", false);
                animator.SetBool("isFall", true);
                animator.SetBool("isJump", false);
                animator.SetBool("isMove", false);
                animator.SetBool("isADrift", false);
                //dJumpCount = 0;
                stateEffect = 0.5f;
                break;

            case "RUN_right":
                animator.SetBool("isMove", true);
                animator.SetBool("isFall", false);
                animator.SetBool("isJump", false);
                stateEffect          = 1f;
                transform.localScale = new Vector3(key * 3, 3, 3);     // 向きに応じてキャラクターを反転
                break;

            case "RUN_left":
                animator.SetBool("isMove", true);
                animator.SetBool("isFall", false);
                animator.SetBool("isJump", false);
                stateEffect          = 1f;
                transform.localScale = new Vector3(key * 3, 3, 3);     // 向きに応じてキャラクターを反転
                break;

            case "ALanding":
                animator.SetBool("isALanding_S", true);
                break;

            case "ADrift":
                animator.SetBool("isADrift", true);
                transform.localScale = new Vector3(key * 3, 3, 3);     // 向きに応じてキャラクターを反転
                break;

            case "Roling":
                animator.SetBool("isRoling", true);
                transform.localScale = new Vector3(key * 3, 3, 3);     // 向きに応じてキャラクターを反転
                break;

            default:
                animator.SetBool("isDJump", false);
                animator.SetBool("isFall", false);
                animator.SetBool("isMove", false);
                animator.SetBool("isJump", false);
                animator.SetBool("isALanding_S", false);
                animator.SetBool("isALanding_E", false);
                animator.SetBool("isADrift", false);
                animator.SetBool("isRoling", false);
                stateEffect = 1f;
                break;
            }
            // 状態の変更を判定するために状態を保存しておく
            prevState = state;
        }
    }
コード例 #6
0
ファイル: PlayerController.cs プロジェクト: muinus/ActionGame
    public override void ChangeState()
    {
        // 空中にいるかどうかの判定。上下の速度(rigidbody.velocity)が一定の値を超えている場合、空中とみなす
        if (Mathf.Abs(rb.velocity.y) > jumpThreshold)
        {
            animator.SetBool("isGround", false);
        }

        // 接地している場合
        if (animator.GetBool("isGround"))
        {
            if ((isDublePress && (pressedKey == KeyCode.RightArrow || UB_clone.Equals(UB_right) ||
                                  pressedKey == KeyCode.LeftArrow || UB_clone.Equals(UB_left))))
            {
                Roling();
                isDublePress = false;
                state        = "Roling";
            }
            // 走行中
            else if (key == 1)
            {
                state = "RUN_right";
                //待機状態
            }
            else if (key == -1)
            {
                state = "RUN_left";
                //待機状態
            }
            else
            {
                state = "IDLE";
            }
        } // 空中にいる場合
        else
        {
            if (isDublePress && (pressedKey == KeyCode.DownArrow || UB_clone.Equals(UB_down)))
            {
                isDublePress = false;
                state        = "ALanding";
            }
            else if ((isDublePress && (pressedKey == KeyCode.RightArrow || UB_clone.Equals(UB_right) ||
                                       pressedKey == KeyCode.LeftArrow || UB_clone.Equals(UB_left))) &&
                     aDriftCount == 0)
            {
                if (!SkillLearned.GetSkillActive("ADrift"))
                {
                    return;
                }

                AirDrift();
                isDublePress = false;
                state        = "ADrift";
                aDriftCount++;
            }
            // ダブルジャンプか
            else if (isDoubleJump && dJumpCount == 0)
            {
                state = "DJUMP";
            }
            // 上昇中
            else if (rb.velocity.y > 0 && !animator.GetBool("isHighSlash") && !animator.GetBool("isShotGun"))
            {
                state = "JUMP";
            }// 下降中
            else if (rb.velocity.y < 0)
            {
                state = "FALL";
            }
        }
    }
コード例 #7
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;
            }
        }
    }
コード例 #8
0
    public override void ChangeAnimation()
    {
        try
        {
            if (!SkillLearned.GetSkillActive(state))
            {
                state = prevState;
            }
        }
        catch { }

        // 状態が変わった場合のみアニメーションを変更する
        if (prevState != state)
        {
            switch (state)
            {
            case "ATTACK1":
                animator.SetBool("isAttack1", true);
                animator.SetBool("isAttack2", false);
                animator.SetBool("isAttack3", false);
                break;

            case "ATTACK2":
                animator.SetBool("isAttack2", true);
                animator.SetBool("isAttack1", false);
                animator.SetBool("isAttack3", false);
                break;

            case "ATTACK3":
                animator.SetBool("isAttack3", true);
                animator.SetBool("isAttack1", false);
                animator.SetBool("isAttack2", false);
                break;

            case "AirATTACK1":
                animator.SetBool("isAAttack1", true);
                animator.SetBool("isAAttack2", false);
                break;

            case "AirATTACK2":
                animator.SetBool("isAAttack2", true);
                animator.SetBool("isAAttack1", false);
                break;

            case "AirATTACK3S":
                animator.SetBool("isAAttack3_S", true);
                break;

            case "AirATTACK3E":
                animator.SetBool("isAAttack3_E", true);
                animator.SetBool("isAAttack3_S", false);
                break;

            case "AirHighSlash":
                animator.SetBool("isAHighSlash", true);
                break;

            case "AirRaid":
                animator.SetBool("isARaid", true);
                break;

            case "HighSlash":
                animator.SetBool("isHighSlash", true);
                break;

            case "AHighSlashE":
                animator.SetBool("isAHighSlash_end", true);
                break;

            case "Slashing_R":
                animator.SetBool("isSlashing_R", true);
                break;

            case "Slashing":
                animator.SetBool("isSlashing", true);
                break;

            case "ThrowSword":
                animator.SetBool("isThrowSword", true);
                break;

            case "Hamma":
                animator.SetBool("isHamma", true);
                break;

            case "Sickle":
                animator.SetBool("isSickle", true);
                break;

            case "Iai":
                animator.SetBool("isIai", true);
                break;

            case "Potion":
                animator.SetBool("isPotion", true);
                break;

            default:
                animator.SetBool("isAAttack3_S", false);
                animator.SetBool("isAAttack3_E", false);
                animator.SetBool("isAAttack1", false);
                animator.SetBool("isAAttack2", false);
                animator.SetBool("isAttack1", false);
                animator.SetBool("isAttack2", false);
                animator.SetBool("isAttack3", false);
                animator.SetBool("isAHighSlash", false);
                animator.SetBool("isHighSlash", false);
                animator.SetBool("isAHighSlash_end", false);
                animator.SetBool("isARaid", false);
                animator.SetBool("isThrowSword", false);
                animator.SetBool("isThrowSword_E", false);
                animator.SetBool("isSlashing", false);
                animator.SetBool("isSlashing_R", false);
                animator.SetBool("isHamma", false);
                animator.SetBool("isSickle", false);
                animator.SetBool("isIai", false);
                animator.SetBool("isPotion", false);
                isAttack3      = false;
                isHamma        = false;
                cirCol.enabled = true;
                break;
            }
            // 状態の変更を判定するために状態を保存しておく
            prevState = state;
        }
    }