public void SetBullet(string newBulletName) { bulletName = newBulletName; GameObject newBullet = bulletsManager.GetBulletByName(newBulletName); Bullet bulletDetail = newBullet.GetComponent <Bullet>(); shootDelay = bulletDetail.delay; }
void CmdFire(Vector3 firePos, Quaternion fireRotation, string id, string bulletName) { GameObject bulletPrefab = bulletsManager.GetBulletByName(bulletName); //Debug.Log(bulletName); var bullet = (GameObject)Instantiate(bulletPrefab, firePos, fireRotation); bullet.GetComponent <Bullet>().OnInstantiateSetPlayerID(id); //Debug.Log("playerid " + id); bullet.GetComponent <Rigidbody>().velocity = bullet.transform.forward * bullet.GetComponent <Bullet>().speed; NetworkServer.Spawn(bullet); bullet.transform.parent = bulletsParent.transform; //TODO: fix this, not working on clients preFireTime = Time.timeSinceLevelLoad; }