示例#1
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);
            }
        }
    }
示例#2
0
    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;
        }
    }