예제 #1
0
        private void Update()
        {
            // Spawn a basic spawned object when I is pressed
            if (Input.GetKeyDown(KeyCode.I))
            {
                Vector3    position = Random.onUnitSphere * 2;
                Quaternion rotation = Random.rotation;

                SyncSpawnedObject spawnedObject = new SyncSpawnedObject();

                SpawnManager.Spawn(spawnedObject, position, rotation, SpawnParent, "SpawnedObject", false);
            }

            // Spawn a test sphere when O is pressed
            if (Input.GetKeyDown(KeyCode.O))
            {
                Vector3    position = Random.onUnitSphere * 2;
                Quaternion rotation = Random.rotation;

                SyncSpawnTestSphere spawnedObject = new SyncSpawnTestSphere();
                spawnedObject.TestFloat.Value = Random.Range(0f, 100f);

                SpawnManager.Spawn(spawnedObject, position, rotation, SpawnParent, "SpawnTestSphere", false);
            }
        }
        public void SpawnBasicSyncObject()
        {
            Quaternion rotation = Random.rotation;

            var spawnedObject = new SyncSpawnedObject();

            spawnManager.Spawn(spawnedObject, PositionCalibrator(Camera.main.transform.position, cameraHeight: true), rotation, spawnParentTransform.gameObject, "SpawnedObject", false);
        }
        public void SpawnBasicSyncObject()
        {
            Vector3    position = Random.onUnitSphere * 2;
            Quaternion rotation = Random.rotation;

            var spawnedObject = new SyncSpawnedObject();

            spawnManager.Spawn(spawnedObject, position, rotation, spawnParentTransform.gameObject, "SpawnedObject", false);
        }
예제 #4
0
        public void SpawnBasicSyncObject()
        {
//            Vector3 position = Random.onUnitSphere * 2;
            Quaternion rotation = Random.rotation;
            Vector3    position = Camera.main.transform.forward + new Vector3(Random.Range(-5, 5), Random.Range(0, 1), 2);

            var spawnedObject = new SyncSpawnedObject();

            spawnManager.Spawn(spawnedObject, position, rotation, spawnParentTransform.gameObject, "SpawnedObject", false);
        }
예제 #5
0
 protected void Spawn(SyncSpawnedObject spawnedObject, Vector3 position, Quaternion rotation, string baseName, bool isOwnedLocally)
 {
     spawnManager.Spawn(spawnedObject, position, rotation, spawnParentTransform.gameObject, baseName, isOwnedLocally);
 }
예제 #6
0
 /// <summary>
 /// Deletes any sync object that inherits from SyncSpawnObject.
 /// </summary>
 public void DeleteSyncObject(SyncSpawnedObject syncObject)
 {
     spawnManager.Delete(syncObject);
 }
예제 #7
0
 /// <summary>
 /// Spawn a sync object at the position and with the rotation you want.
 /// </summary>
 public bool SpawnSyncObject(SyncSpawnedObject syncObject, Vector3 position, Quaternion rotation)
 {
     return spawnManager.Spawn(syncObject, position, rotation, spawnParentTransform.gameObject, syncObject.Name.Value, false)
 }