示例#1
0
        public void SetState(HoloNetObjectState state)
        {
            oid   = state.oid;
            pid   = state.pid;
            owner = HoloNetPlayer.FindPlayer(state.ownerId);

            foreach (var componentState in state.componentStates)
            {
                //TODO add cache for observables
                var observable = _observables.FirstOrDefault(o => o.id == componentState.componentId);
                observable?.stateSyncable?.ApplySyncState(componentState);
            }
        }
示例#2
0
        public HoloNetObject SpawnObjectLocal(HoloNetObjectId oid, int prefabId, int ownerId,
                                              Vector3 position    = new Vector3(),
                                              Quaternion rotation = new Quaternion())
        {
            var prefab = GetPrefabById(prefabId);
            var result = Object.Instantiate(prefab, position, rotation).GetComponent <HoloNetObject>();

            result.transform.position = position;
            result.transform.rotation = rotation;

            RegisterObject(oid, result);
            result.LocalInit(oid, prefabId, HoloNetPlayer.FindPlayer(ownerId));

            return(result);
        }
示例#3
0
 public object SetObjectData(object obj, SerializationInfo info, StreamingContext context,
                             ISurrogateSelector selector)
 {
     return(HoloNetPlayer.FindPlayer(info.GetInt32("uniqueId")));
 }