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); }
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); } }
public void ReceiveSyncVarUpdate(NetworkSyncVarValue values) { StartCoroutine(InitializeSyncVars(values)); }
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; }