public void CreateSpeakers()
    {
        int        nullObjsRemovedFromPool;
        GameObject recorder         = SpeakerPool.Get(out nullObjsRemovedFromPool);
        Handler    recorderIdentity = recorder.GetComponent <Handler>();

        recorderIdentity.Identity               = new NetworkIdentity();
        recorderIdentity.Identity.NetworkId     = (ulong)Client.MyID;
        recorderIdentity.Identity.IsLocalPlayer = true;
        recorderIdentity.Identity.IsInitialized = true;
        recorderIdentity.ForceInitializzation();

        foreach (User user in Client.Users)
        {
            if (user.SteamID != Client.MyID)
            {
                GameObject speaker         = SpeakerPool.Get(out nullObjsRemovedFromPool);
                Handler    speakerIdentity = speaker.GetComponent <Handler>();
                speakerIdentity.Identity               = new NetworkIdentity();
                speakerIdentity.Identity.NetworkId     = (ulong)user.SteamID;
                speakerIdentity.Identity.IsLocalPlayer = false;
                speakerIdentity.Identity.IsInitialized = true;
                speakerIdentity.ForceInitializzation();
            }
        }
    }
    void Fire()
    {
        int nullObjsRemovedFromPool;

        GameObject bullet = bulletPool.Get(null, bulletSpawn.position, bulletSpawn.rotation, out nullObjsRemovedFromPool);

        bullet.GetComponent <Rigidbody>().velocity = bullet.transform.forward * 10;
    }
 void Update()
 {
     if (Input.GetKeyDown(ShootKey))
     {
         Ray ray = Camera.ScreenPointToRay(Input.mousePosition);
         int nullObjsRemovedFromPool;
         Pool.Get(null, ray.origin, Quaternion.LookRotation(ray.direction, this.transform.up), out nullObjsRemovedFromPool);
     }
 }
Example #4
0
    public void Shoot()
    {
        int nullObjsRemovedFromPool;

        PrefabPool.Get(null, Muzzle.position, Muzzle.rotation, out nullObjsRemovedFromPool);
    }