Beispiel #1
0
        /// <summary>
        /// Initializes a new <see cref="ComponentizedEntity"/>.
        /// <para>
        /// Componentized entities are entities which automatically support the attachment
        /// of updatable and renderable components (<see cref="IUpdatableComponent"/> and
        /// <see cref="IRenderableComponent"/> respectively).
        /// </para>
        /// </summary>
        public ComponentizedEntity()
        {
            LocalMatrix = Matrix.Identity;

            _update = RegisterCallable <IUpdatableComponent, IGameContext, IUpdateContext>((t, g, u) => t.Update(this, g, u));
            _render = RegisterCallable <IRenderableComponent, IGameContext, IRenderContext>((t, g, r) => t.Render(this, g, r));

            RegisterPrivateComponent(this); // Register this as IPositionComponent.
        }
Beispiel #2
0
        /// <summary>
        /// Initializes a new <see cref="ComponentizedEntity"/>.
        /// <para>
        /// Componentized entities are entities which automatically support the attachment
        /// of updatable and renderable components (<see cref="IUpdatableComponent"/> and
        /// <see cref="IRenderableComponent"/> respectively).
        /// </para>
        /// </summary>
        protected ComponentizedEntity()
        {
            Transform = new DefaultTransform();

            _handleEvent = RegisterCallable <IEventfulComponent, IGameContext, IEventEngine <IGameContext>, Event, EventState>(EventCallback);
            _handleMessageRecievedClient = RegisterCallable <INetworkedComponent, IGameContext, IUpdateContext, MxDispatcher, MxClient, byte[], uint, EventState>(ClientMessageCallback);
            _handleMessageRecievedServer = RegisterCallable <INetworkedComponent, IServerContext, IUpdateContext, MxDispatcher, MxClient, byte[], uint, EventState>(ServerMessageCallback);
            _networkIdentifiableClient   = RegisterCallable <INetworkIdentifiable, IGameContext, IUpdateContext, int, int>((c, g, u, i, ft) => c.ReceiveNetworkIDFromServer(g, u, i, ft));
            _networkIdentifiableServer   = RegisterCallable <INetworkIdentifiable, IServerContext, IUpdateContext, MxClient, int>((c, s, u, mc, i) => c.ReceivePredictedNetworkIDFromClient(s, u, mc, i));
            _getLights = RegisterCallable <ILightableComponent, List <ILight> >(GetLightCallback);

            OnComponentsChanged();
        }
 /// <summary>
 /// Initializes a new <see cref="ComponentizedEntity"/>.
 /// <para>
 /// Componentized entities are entities which automatically support the attachment
 /// of updatable and renderable components (<see cref="IUpdatableComponent"/> and
 /// <see cref="IRenderableComponent"/> respectively).
 /// </para>
 /// </summary>
 public ComponentizedEntity()
 {
     _update = RegisterCallable<IUpdatableComponent, IGameContext, IUpdateContext>((t, g, u) => t.Update(this, g, u));
     _render = RegisterCallable<IRenderableComponent, IGameContext, IRenderContext>((t, g, r) => t.Render(this, g, r));
 }
 /// <summary>
 /// Initializes a new <see cref="ComponentizedEntity"/>.
 /// <para>
 /// Componentized entities are entities which automatically support the attachment
 /// of updatable and renderable components (<see cref="IUpdatableComponent"/> and
 /// <see cref="IRenderableComponent"/> respectively).
 /// </para>
 /// </summary>
 public ComponentizedEntity()
 {
     _update = RegisterCallable <IUpdatableComponent, IGameContext, IUpdateContext>((t, g, u) => t.Update(this, g, u));
     _render = RegisterCallable <IRenderableComponent, IGameContext, IRenderContext>((t, g, r) => t.Render(this, g, r));
 }