Beispiel #1
0
    // Update is called once per frame
    void FixedUpdate()
    {
        //ゲーム終了時は動きを止める
        if (gameSetFlg)
        {
            rb.velocity = new Vector2(0f, 0f);
            anim.Play("die");
            Destroy(this.gameObject, 3f);
            gameSetText.text = "YOU LOSE";

            return;
        }
        //接地判定
        isGround = ground.IsGround();

        //各種座標軸の速度を求める
        float xSpeed = GetXSpeed();
        float ySpeed = GetYSpeed();

        // 攻撃できるか判定
        if (JudgeAttack())
        {
            if (Input.GetKey(KeyCode.Space) || isAckButtonDown == true)
            {
                Ibarst();
            }
            if (Input.GetKeyDown(KeyCode.E))
            {
                specialAttack.SpecialAttack();
            }
        }

        //移動速度を設定
        rb.velocity = new Vector2(xSpeed, ySpeed);

        //アニメーションを適用
        SetAnimation();
    }