Beispiel #1
0
        protected EntityBase(
            EntityDefinition definition,
            IResourceLibrary resources,
            IAvatarFactory avatarFactory,
            IControllerFactory[] controllerFactories,
            ControllerConfig[] customControllers,
            Vector3D position,
            Vector3D direction,
            Vector3D velocity)
            : base(
                resources.GetSerializedResource <AvatarDefinition>(definition.AvatarId),
                definition.Mass,
                controllerFactories,
                definition.Controllers,
                customControllers)
        {
#if LOG_VERBOSE
            Log.Trace("Creating entity '{0}' at {1}...", definition.Id, position);
#endif
            this.Avatar = avatarFactory.Create(this.AvatarDefinition);

            this.Position  = position;
            this.Direction = direction;
            this.Velocity  = velocity;

#if LOG_VERBOSE
            Log.Trace("Created '{0}' at {1}.", this.Avatar.Id, this.Avatar.Position);
#endif
        }
Beispiel #2
0
 /// <summary>Initializes a new instance of the WorldBase class</summary>
 public WorldBase(
     LevelDefinition definition,
     IResourceLibrary resources,
     IControllerManager controllerManager,
     IControllerFactory[] controllerFactories,
     IEntityFactory entityFactory)
     : base(definition.Id, controllerFactories, definition.Controllers)
 {
     this._controllerManager = controllerManager;
     this._entities          = definition.Entities
                               .Select(entity =>
                                       entityFactory.Create(
                                           resources.GetSerializedResource <EntityDefinition>(entity.EntityId),
                                           entity.Controllers,
                                           entity.Position,
                                           entity.Direction,
                                           entity.Velocity))
                               .ToList();
     this.Summary = definition.Summary;
 }