/// <summary> /// Some remote object was created /// </summary> private void OnPacketCreateRemoteActor(ref CreateRemoteActor p) { int index = p.Index; if ((index & 0xff) == localPlayerIndex) { return; } if (remoteActors.ContainsKey(index)) { return; } Vector3 pos = p.Pos; string metadataPath = p.MetadataPath; CollisionFlags collisionFlags = p.CollisionFlags; Await.NextAfterUpdate().OnCompleted(() => { RemoteActor actor = new RemoteActor(); actor.OnActivated(this, pos, metadataPath, collisionFlags); //actor.Index = index; remoteActors[index] = actor; AddActor(actor); }); }
public ActorInstance Select(Uri actorAddress) { string key = actorAddress.GetComponents(UriComponents.HttpRequestUrl, UriFormat.Unescaped); RemoteActor result; if (_actors.TryGetValue(key, out result)) return result; Node node = _nodes.GetNode(actorAddress); result = new RemoteActor(node, actorAddress); _actors.Add(key, result); return result; }