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); } }
void Update() { at = GameObject.Find(player); attak = at.GetComponent <Attak>(); //ここで弾数取得 int Pbulletcount = attak.BulletCount; //int Pbulletcount = at.GetComponent<Attak>().BulletCount; //BoolをPbulletcountに変更 if (Pbulletcount == 5) { Gage_5.gameObject.SetActive(true); Gage_4.gameObject.SetActive(true); Gage_3.gameObject.SetActive(true); Gage_2.gameObject.SetActive(true); Gage_1.gameObject.SetActive(true); } if (Pbulletcount == 4) { Gage_5.gameObject.SetActive(false); Gage_4.gameObject.SetActive(true); Gage_3.gameObject.SetActive(true); Gage_2.gameObject.SetActive(true); Gage_1.gameObject.SetActive(true); } if (Pbulletcount == 3) { Gage_5.gameObject.SetActive(false); Gage_4.gameObject.SetActive(false); Gage_3.gameObject.SetActive(true); Gage_2.gameObject.SetActive(true); Gage_1.gameObject.SetActive(true); } if (Pbulletcount == 2) { Gage_5.gameObject.SetActive(false); Gage_4.gameObject.SetActive(false); Gage_3.gameObject.SetActive(false); Gage_2.gameObject.SetActive(true); Gage_1.gameObject.SetActive(true); } if (Pbulletcount == 1) { Gage_5.gameObject.SetActive(false); Gage_4.gameObject.SetActive(false); Gage_3.gameObject.SetActive(false); Gage_2.gameObject.SetActive(false); Gage_1.gameObject.SetActive(true); } if (Pbulletcount == 0) { Gage_5.gameObject.SetActive(false); Gage_4.gameObject.SetActive(false); Gage_3.gameObject.SetActive(false); Gage_2.gameObject.SetActive(false); Gage_1.gameObject.SetActive(false); } //使わないから消した ////増える //if (Input.GetKeyDown(KeyCode.Z)) //{ // Bool += 1; // if (Bool >= 5) // { // Bool = 5; // } //} ////減る //if (Input.GetKeyDown(KeyCode.X)) //{ // Bool -= 1; // if (Bool <= 0) // { // Bool = 0; // } //} }