public override void OnDeserialize(byte[] buffer, int index) { // object id uint objectId; Serializer.DeserializeData(buffer, ref index, out objectId); GameObjectId = objectId; // object type EObjectType type = (EObjectType)((int)buffer[index]); index++; bool isLocalPlayer = false; Serializer.DeserializeData(buffer, ref index, out isLocalPlayer); IsLocalPlayer = isLocalPlayer; // player linked id uint playerId = 0; Serializer.DeserializeData(buffer, ref index, out playerId); PlayerLinked = playerId; // Deserialize components byte componentsNumber = buffer[index]; index++; for (int i = 0; i < componentsNumber; i++) { ISerializableComponent tmpComponent = GameComponentFactory.DeserializeComponent(buffer, ref index); Components.Add(tmpComponent); } }
public DiagnosticsManager(Game game) { ui = new DiagnosticsUI(game, this); host = new DiagnosticsCommandHost(ui); fps = new FPSCounter(game, this); ruler = new TimeRuler(game, this); factory = new GameComponentFactory(game, this); InitBasicCommands(); }
public DeusGameObject CreateGameObject(GameObjectCreateArgs args) { // Create all the components List <DeusComponent> components = new List <DeusComponent>(); foreach (var component in args.ComponentsInfos) { components.Add(GameComponentFactory.CreateComponent(component, args.GameObjectId)); } // Create the gameobject DeusGameObject gameObject = new DeusGameObject(args, components); // notify the view that there is a new object to display PacketCreateViewObject packet = new PacketCreateViewObject(); packet.LinkedGameObject = gameObject; packet.ObjectId = gameObject.UniqueIdentifier; EventManager.Get().EnqueuePacket(0, packet); return(gameObject); }