Example #1
0
        public SpawnCommand GetSpawnRequest()
        {
            List <string>          varNames  = GetSyncVarNames();
            List <NetworkSyncItem> varValues = GetSyncVarValues(varNames);

            NetworkSyncVarValue values = new NetworkSyncVarValue(varNames, varValues);

            SpawnCommand spawnCommand = new SpawnCommand(ownerId, instanceId, definitionName, _position, _rotation, values, _args);

            return(spawnCommand);
        }
Example #2
0
        private IEnumerator InitializeSyncVars(NetworkSyncVarValue values)
        {
            yield return(null);

            for (int i = 0; i < values.Names.Count; i++)
            {
                string          name  = values.Names[i];
                NetworkSyncItem value = values.Value[i];

                Debug.Log("Received syncvar update for variable " + name);

                syncVarDictionary[name].Assign(value);
            }
        }
Example #3
0
 public void ReceiveSyncVarUpdate(NetworkSyncVarValue values)
 {
     StartCoroutine(InitializeSyncVars(values));
 }
Example #4
0
        public SpawnCommand(int ownerId, NetworkInstanceId id, string name, NetworkSyncVector3 position, NetworkSyncQuaternion rotation, NetworkSyncVarValue syncVarValues, NetworkSpawnArgs args)
        {
            this.id      = id;
            this.ownerId = ownerId;
            this.name    = name;

            this.position = position;
            this.rotation = rotation;

            this.syncVarValues = syncVarValues;
            this.arguments     = args;
        }