예제 #1
0
    public override void GetInputKey()
    {
        if (Input.GetKeyDown(KeyCode.C) || UB_magic.GetIsPressedDown())
        {
            isreroad = true;
        }

        if ((Input.GetKey(KeyCode.C) || UB_magic.GetIsPressed()) && isreroad)
        {
            isPressed = true;
        }
        else
        {
            isPressed = false;
        }

        if (isPressed)
        {
            pressTime += Time.deltaTime;
        }
        else
        {
            pressTime = 0;
        }
    }
예제 #2
0
    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";
            }
        }
    }