// Update is called once per frame
    void Update()
    {
        //Time control
        if (bullet_time < b_t_limit)
        {
            bullet_time += Time.deltaTime;
        }
        pressTime += Time.deltaTime;
        dashTC    -= Time.deltaTime;

        if (charaState == State.Die)
        {
            return;
        }
        if (isInv)
        {
            invincible();
        }

        if (Input.GetKeyUp("a") || Input.GetKeyUp("s") || Input.GetKeyUp("d") || Input.GetKeyUp("w"))
        {
            if (!Input.GetKey("a") && !Input.GetKey("s") && !Input.GetKey("d") && !Input.GetKey("w"))
            {
                charaState = State.Idle;
                charaAnimator.SetFloat(stateID, 0);
                audioControl.CharaStop();
                if (Input.GetKeyUp("d"))
                {
                    gameObject.transform.localScale = new Vector3(0.42f, 0.42f, 0);
                }
            }
        }
//		if (Input.GetKeyUp ("left") || Input.GetKeyUp ("right") || Input.GetKeyUp ("down") || Input.GetKeyUp ("up")) {
//
//			charaAnimator.SetFloat (idleSID, 0);
//
//
//		}
        if (Input.anyKey)
        {
            control();

            if (bullet_time >= b_t_limit && Input.GetKey("j"))
            {
                shoot();
            }
        }
        if (Input.GetKeyUp("j"))
        {
            charaAnimator.SetFloat(idleSID, 0);
        }
    }
    // Update is called once per frame
    void FixedUpdate()
    {
        if (isEX)
        {
            moveToEnd();
            return;
        }
        if (isDie)
        {
            return;
        }
        if (isInv)
        {
            InvTC += Time.deltaTime;
            if (InvTC > 2)
            {
                isInv = false;
            }
            InvC++;
            if (InvC > 8)
            {
                gameObject.GetComponent <SpriteRenderer>().color = new Vector4(1, 1, 1, 1f);
                InvC = 0;
            }
            else if (InvC > 4)
            {
                gameObject.GetComponent <SpriteRenderer>().color = new Vector4(1, 1, 1, 0.5f);
            }
        }
        if (isHitNow)
        {
            return;
        }


        if (bullet_time < b_t_limit)
        {
            bullet_time += Time.deltaTime;
        }
        if (Input.GetKeyUp("a") || Input.GetKeyUp("d"))
        {
            audioControl.CharaStop();
            if (!isJump)
            {
                if (Input.GetKey("j"))
                {
                    charaAnimator.SetFloat(stateID, 3);
                }
                else
                {
                    charaAnimator.SetFloat(stateID, 0);
                }

                setMirror(false);
            }
        }
        if (Input.GetKeyUp("j"))
        {
            if (charaAnimator.GetFloat(stateID) == 3)
            {
                charaAnimator.SetFloat(stateID, 0);
            }
        }
        if (Input.anyKey)
        {
            Control();
        }

        if (bullet_time >= b_t_limit && Input.GetKey("j"))
        {
            if (charaAnimator.GetFloat(stateID) == 0)
            {
                charaAnimator.SetFloat(stateID, 3);
            }
            Shoot();
            if (!canEX)
            {
                EXMask.transform.Translate(0, 0.03f, 0);
                EXenergy += 0.1f;
                if (EXenergy > 4.8)
                {
                    canEX = true;
                    EXok.SetActive(true);
                }
            }
        }
        if (isJump)
        {
            switch (jumpState)
            {
            case 1:
                if (charaRigid.velocity.y < 0)
                {
                    charaAnimator.SetFloat(jumpID, 2);
                    jumpState = 2;
                }
                break;

            case 2:
                if (charaRigid.velocity.y < 0.2 && charaRigid.velocity.y > -0.2)
                {
                    charaAnimator.SetFloat(jumpID, 3);
                    isJump    = false;
                    jumpState = 3;
                    setMirror(false);
                }
                break;
            }

            //charaRigid.d
        }
    }