//チョコボール発射(リロード方式) void RespawnChoco() { stat.nowReloadTime -= Time.deltaTime; if (stat.IsReload() == true || !iController.GetFireButton()) { return; } // チョコが0の時 if (stat.bulletRemain <= 0) { stat.nowReloadTime = FIX_RELOAD_TIME; stat.ResetBullet(); return; } // チョコが1以上の時 // 発射処理 Vector3 _pos = this.transform.position + this.transform.forward * 3F + Vector3.up; GameObject _objBullet = Instantiate(bulletPrefab, _pos, Quaternion.identity); Destroy(_objBullet, 3F); // コンポーネントにアタッチ ChocoStatics _chocoStat = _objBullet.GetComponent <ChocoStatics>(); _chocoStat.SetOwnPlayer(stat.playerTag); // 力を加える Rigidbody rg = _objBullet.GetComponent <Rigidbody>(); rg.AddForce(this.transform.forward * 20F, ForceMode.Impulse); stat.bulletRemain--; //SE_BALL.Play(); }