public void Initialize() { // add a couple -- this is not where this would normally be ofc for (int i = 0; i < 10; i++) { Entities[i] = Object.Instantiate(EntityPrefab, new Vector3(0, (i + 1) * 10, 0), new Quaternion()); REntities[i] = new ReplicatableGameObject(); } }
private void OnUpdate() { if (_currentState != State.Playing) { return; } Client.PacketStream.UpdateIncoming(); Client.ControlledObjectSys.UpdateControlledObject(); // Update game foreach (ReplicationRecord r in Client.Replication.ReplicatedObjects.Values) { if (!RGameObjects.ContainsKey(r.Id)) { RGameObjects[r.Id] = Object.Instantiate(EntityPrefab); } ReplicatableGameObject rgo = (ReplicatableGameObject)r.Entity; RGameObjects[r.Id].transform.SetPositionAndRotation(rgo.Position, new Quaternion()); } Client.PacketStream.UpdateOutgoing(); }