public override void Serialize(Archive archive)
        {
            archive.Serialize(ref _levelName);

            int numIds = (_travelActorNetIDs != null) ? _travelActorNetIDs.Values.Count : 0;

            archive.Serialize(ref numIds);

            if (archive.isLoading)
            {
                if (_travelActorNetIDs != null)
                {
                    _travelActorNetIDs.Clear();
                }
                else
                {
                    _travelActorNetIDs = new HashSetList <int>();
                }

                for (int i = 0; i < numIds; ++i)
                {
                    _travelActorNetIDs.Add(archive.ReadInt());
                }
            }
            else if (numIds > 0)
            {
                for (int i = 0; i < numIds; ++i)
                {
                    archive.Write(_travelActorNetIDs.Values[i]);
                }
            }
        }
Exemple #2
0
	public void ActorWasDestroyed(Actor actor, bool isTraveling) {
		if (actor.netID != 0) {
			if (actor.internal_GetReplicator(connection) != null) {
				actor.internal_SetReplicator(connection, null);
				Assert.IsFalse(actor.netTornOff);

				for (int i = 0; i < actor.numComponents; ++i) {
					var component = actor.GetComponent(i);
					component.internal_SetReplicator(connection, null);
				}

				if (!isTraveling && isServer) {
					if (this.isTraveling) {
						garbage.Add(actor.netID);
					} else {
						connection.SendReliable(NetMsgs.DestroyActor.New(actor.netID));
                    }
				}
			}
		}
	}
Exemple #3
0
	public void SerializeSubobject(SerializableObject obj) {
		if (obj.replicates) {
			objectRefs.Add(obj.netIDHashCode);
			obj.SerializeSubobjects(this);
		}
	}