コード例 #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);
            }
        }
コード例 #2
0
        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);
        }
コード例 #3
0
        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
    // Use this for initialization

    public void SyncSpawnPrefab()
    {
        SyncSpawnedObject spawnedObject = new SyncSpawnedObject();
        Vector3           position      = syncPrefab.gameObject.transform.position;

        spawnManager.Spawn(spawnedObject, position, syncPrefab.gameObject.transform.rotation, null, "syncPrefab", true);
    }
コード例 #6
0
 protected void Spawn(SyncSpawnedObject spawnedObject, Vector3 position, Quaternion rotation, string baseName, bool isOwnedLocally)
 {
     spawnManager.Spawn(spawnedObject, position, rotation, spawnParentTransform.gameObject, baseName, isOwnedLocally);
 }
コード例 #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)
 }