Esempio n. 1
0
    void Move(int Number)
    {
        Attak  d1 = GetComponent <Attak>();
        Hisatu a1 = GetComponent <Hisatu>();

        //ボタン確認

        if (Input.GetButtonDown("Fire1_" + PlayerNum))
        {
            Debug.Log("Shot1_" + PlayerNum);
            d1.Kaiten();
            animator.SetBool("is_attack", true);
            Invoke("AnimatorBoolis_attack", 0.5f);
            _rigidBody.isKinematic = true;
            Invoke("RigidBodyfalse", 1.0f);
        }
        if (Input.GetButtonDown("Fire2_" + PlayerNum))
        {
            Debug.Log("Shot2_" + PlayerNum);
            d1.Syageki();
            animator.SetBool("is_attack", true);
            Invoke("AnimatorBoolis_attack", 0.5f);
            _rigidBody.isKinematic = true;
            Invoke("RigidBodyfalse", 1.0f);
        }
        if (Input.GetButtonDown("Fire3_" + PlayerNum))
        {
            a1.hisatuskill();
            Debug.Log("Shot3_" + PlayerNum);
            animator.SetBool("is_attack", true);
            Invoke("AnimatorBoolis_attack", 0.5f);
        }
        //移動許可待ち
        if (Mov_OK)
        {
            //アナログスティックで動かせると思う
            x = Input.GetAxis("Horizontal" + PlayerNum); //左右
            y = Input.GetAxis("Vertical" + PlayerNum);   //前後
        }


        //transform.Rotate(0, x, 0);//回転
        //transform.position += y * transform.forward * PlayerSpeed * Time.deltaTime;//前後移動

        var direction = new Vector3(x, 0, y);

        if (x != 0 || y != 0)
        {
            //方向を向く
            transform.localRotation = Quaternion.LookRotation(direction);
            //方向に移動
            transform.position += PlayerSpeed * direction * Time.deltaTime;
            //_rigidBody.AddForce(direction * 1000);
            animator.SetBool("is_go", true);
        }
        else
        {
            animator.SetBool("is_go", false);
        }
    }
Esempio n. 2
0
    public void HP(int Number, int amount)
    {
        Hisatu a1 = GetComponent <Hisatu>();

        //これのtrue,falseを切り替えて無敵時間の用意
        if (isCollision)
        {
            PlayerHP   -= amount;
            isCollision = false;
            if (PlayerHP >= 0)
            {
                //Debug.Log("プレイヤー" + Number + "が攻撃" + PlayerHP);
            }
            if (PlayerHP <= 0)
            {
                //死んだ時の音
                audioSource.PlayOneShot(Player3_SE4);
                //HP残量の確認をするためにSetActiveに変更
                this.gameObject.SetActive(false);
                Debug.Log("プレイヤー" + "死亡");
                //多分ここに死んだ時のアニメーション追加
            }
            //○○秒後trueにする
            Invoke("isCollisionfalse", invincible);
            //ここで受けるダメージをHisatu.csのSpecialGageに送る
            a1.SpecialGage(amount);
        }
    }