Ejemplo n.º 1
0
 public DespawnTimer(float time, bool unscaled, IEntityPool pool, bool autoStart = true)
 {
     Time       = time;
     Unscaled   = unscaled;
     Pool       = pool;
     _autoStart = autoStart;
 }
Ejemplo n.º 2
0
        /// <inheritdoc />
        public IVehicle CreateVehicle(
            Core.Natives.Samp.Vehicle model,
            Vector3 position,
            float rotation,
            int color1,
            int color2,
            TimeSpan respawnDelay,
            bool addSiren,
            IEntityPool <IVehicle> .RemoveEntityDelegate entityRemoval)
        {
            var vehicleId = this.sampNatives.AddStaticVehicleEx(
                (int)model,
                position.X,
                position.Y,
                position.Z,
                rotation,
                color1,
                color2,
                (int)respawnDelay.TotalSeconds,
                addSiren);

            if (vehicleId == SampConstants.InvalidVehicleId)
            {
                throw new EntityLimitReachedException(typeof(IVehicle));
            }

            return(new Vehicle(vehicleId, entityRemoval, this.vehiclesNatives));
        }
Ejemplo n.º 3
0
        public override void Start(IEntityPool container)
        {
            var value = Game.CurrentGame.Player.ItemQuantity(itemName);
            Set(value);

            Game.CurrentGame.Player.InventoryChanged += Player_InventoryChanged;
        }
Ejemplo n.º 4
0
 public virtual IBaseBaseObjectPool GetBaseBaseObjectPool(IEntityPool <IPlayer> playerPool,
                                                          IEntityPool <IVehicle> vehiclePool, IBaseObjectPool <IBlip> blipPool,
                                                          IBaseObjectPool <ICheckpoint> checkpointPool, IBaseObjectPool <IVoiceChannel> voiceChannelPool,
                                                          IBaseObjectPool <IColShape> colShapePool)
 {
     return(new BaseBaseObjectPool(playerPool, vehiclePool, blipPool, checkpointPool, voiceChannelPool,
                                   colShapePool));
 }
Ejemplo n.º 5
0
        public override void Start(IEntityPool container)
        {
            var value = Game.CurrentGame.Player.ItemQuantity(itemName);

            Set(value);

            Game.CurrentGame.Player.InventoryChanged += Player_InventoryChanged;
        }
Ejemplo n.º 6
0
        public virtual void StartHandler(IEntityPool entityPool)
        {
            Entities = entityPool;

            BeforeStart();
            ResumeHandler();
            StartDrawing();
        }
Ejemplo n.º 7
0
 public virtual Module GetModule(IServer server, CSharpNativeResource cSharpNativeResource,
                                 IBaseBaseObjectPool baseBaseObjectPool,
                                 IBaseEntityPool baseEntityPool, IEntityPool <IPlayer> playerPool, IEntityPool <IVehicle> vehiclePool,
                                 IBaseObjectPool <IBlip> blipPool,
                                 IBaseObjectPool <ICheckpoint> checkpointPool, IBaseObjectPool <IVoiceChannel> voiceChannelPool)
 {
     return(new Module(server, cSharpNativeResource, baseBaseObjectPool, baseEntityPool, playerPool, vehiclePool,
                       blipPool, checkpointPool, voiceChannelPool));
 }
Ejemplo n.º 8
0
        private static IEnumerable <IEntity> GetFilteredEntities(IEntityPool pool, EntityFilterInfo filter)
        {
            var entities = pool.GetAll();

            if (filter.Type != null)
            {
                entities = entities.Where(e => e.Name == filter.Type);
            }

            if (filter.Direction != null)
            {
                entities = entities.Where(e => e.Direction == filter.Direction);
            }

            if (filter.Position != null)
            {
                if (filter.Position.X != null)
                {
                    if (filter.Position.X.Min.HasValue)
                    {
                        entities = entities.Where(e => {
                            var pos = e.GetComponent <PositionComponent>();
                            return(pos == null || pos.X >= filter.Position.X.Min.Value);
                        });
                    }

                    if (filter.Position.X.Max.HasValue)
                    {
                        entities = entities.Where(e => {
                            var pos = e.GetComponent <PositionComponent>();
                            return(pos == null || pos.X <= filter.Position.X.Max.Value);
                        });
                    }
                }

                if (filter.Position.Y != null)
                {
                    if (filter.Position.Y.Min.HasValue)
                    {
                        entities = entities.Where(e => {
                            var pos = e.GetComponent <PositionComponent>();
                            return(pos == null || pos.Y >= filter.Position.Y.Min.Value);
                        });
                    }

                    if (filter.Position.Y.Max.HasValue)
                    {
                        entities = entities.Where(e => {
                            var pos = e.GetComponent <PositionComponent>();
                            return(pos == null || pos.Y <= filter.Position.Y.Max.Value);
                        });
                    }
                }
            }

            return(entities);
        }
Ejemplo n.º 9
0
        public override void StartHandler(IEntityPool entityPool)
        {
            base.StartHandler(entityPool);

            this.state = this.info.States[0];
            RunCommands(this.state.Commands);

            ResetState();
        }
Ejemplo n.º 10
0
        public override void StartHandler(IEntityPool entityPool)
        {
            base.StartHandler(entityPool);

            this.state = this.info.States[0];
            RunCommands(this.state.Commands);

            ResetState();
        }
Ejemplo n.º 11
0
 public BaseBaseObjectPool(IEntityPool <IPlayer> playerPool, IEntityPool <IVehicle> vehiclePool,
                           IBaseObjectPool <IBlip> blipPool,
                           IBaseObjectPool <ICheckpoint> checkpointPool, IBaseObjectPool <IVoiceChannel> voiceChannelPool)
 {
     this.playerPool       = playerPool;
     this.vehiclePool      = vehiclePool;
     this.blipPool         = blipPool;
     this.checkpointPool   = checkpointPool;
     this.voiceChannelPool = voiceChannelPool;
 }
Ejemplo n.º 12
0
        public static T Create <T> (GameObject go, IEntityPool pool, object param = null) where T : EntityBase
        {
            var instance = go.AddComponent <T>();

            instance.PoolInstance = pool;
            instance.Register();
            instance.OnCreate(param);
            instance.RegisterReceiveActions();
            return(instance);
        }
Ejemplo n.º 13
0
        private static void LoadForInheritedType <T>(IEntityPool entityPool, IPropertyAccessor <T> accessor, List <TClass> propertyEntities, IQueryable <TClass> query)
            where T : class
        {
            var accessorImpl = (PropertyAccessor <T>)accessor;

            var entitiesOfType = propertyEntities.OfType <T>().ToList();
            var queryOfType    = query.OfType <T>();

            accessorImpl.Load(entityPool, entitiesOfType, queryOfType);
        }
Ejemplo n.º 14
0
 public AsyncModule(IServer server, CSharpNativeResource cSharpNativeResource,
                    IBaseBaseObjectPool baseBaseObjectPool, IBaseEntityPool baseEntityPool, IEntityPool <IPlayer> playerPool,
                    IEntityPool <IVehicle> vehiclePool,
                    IBaseObjectPool <IBlip> blipPool,
                    IBaseObjectPool <ICheckpoint> checkpointPool,
                    IBaseObjectPool <IVoiceChannel> voiceChannelPool) : base(server, cSharpNativeResource, baseBaseObjectPool,
                                                                             baseEntityPool, playerPool, vehiclePool, blipPool,
                                                                             checkpointPool, voiceChannelPool)
 {
     AltAsync.Setup(this);
 }
Ejemplo n.º 15
0
 public BlocksPattern(BlockPatternInfo info, IGameplayContainer container, IEntityPool entityPool)
 {
     this.info        = info;
     length           = info.Length;
     leftBoundary     = info.LeftBoundary;
     rightBoundary    = info.RightBoundary;
     blocks           = new List <BlockInfo>();
     running          = false;
     frame            = 0;
     this.container   = container;
     this._entityPool = entityPool;
 }
Ejemplo n.º 16
0
 public BlocksPattern(BlockPatternInfo info, IGameplayContainer container, IEntityPool entityPool)
 {
     this.info = info;
     length = info.Length;
     leftBoundary = info.LeftBoundary;
     rightBoundary = info.RightBoundary;
     blocks = new List<BlockInfo>();
     running = false;
     frame = 0;
     this.container = container;
     this._entityPool = entityPool;
 }
Ejemplo n.º 17
0
        public override void Start(IEntityPool entityPool)
        {
            var entity = entityPool.GetEntityById(_entityId);
            if (entity == null) return;

            _health = entity.GetComponent<HealthComponent>();
            if (_health != null)
            {
                Set(_health.Health / _health.MaxHealth);
                _health.HealthChanged += health_HealthChanged;
            }
        }
Ejemplo n.º 18
0
 public override Core GetCore(IntPtr nativePointer, IntPtr resourcePointer, AssemblyLoadContext assemblyLoadContext, ILibrary library, IBaseBaseObjectPool baseBaseObjectPool,
                              IBaseEntityPool baseEntityPool,
                              IEntityPool <IPlayer> playerPool,
                              IEntityPool <IVehicle> vehiclePool,
                              IBaseObjectPool <IBlip> blipPool,
                              IBaseObjectPool <ICheckpoint> checkpointPool,
                              IBaseObjectPool <IVoiceChannel> voiceChannelPool,
                              IBaseObjectPool <IColShape> colShapePool,
                              INativeResourcePool nativeResourcePool)
 {
     return(new AsyncCore(nativePointer, resourcePointer, assemblyLoadContext, library, baseBaseObjectPool, baseEntityPool, playerPool, vehiclePool, blipPool, checkpointPool, voiceChannelPool, colShapePool, nativeResourcePool));
 }
Ejemplo n.º 19
0
        public HandlerText(SceneTextCommandInfo info, IEntityPool entityPool)
        {
            this.Content    = info.Content ?? String.Empty;
            this.speed      = info.Speed ?? 0;
            this.position   = new MegaMan.Common.Geometry.Point(info.X, info.Y);
            this.entityPool = entityPool;
            this.font       = info.Font ?? "Default";

            if (info.Binding != null)
            {
                this.binding = Binding.Create(info.Binding, this);
            }
        }
Ejemplo n.º 20
0
 public virtual Module GetModule(IServer server,
                                 AssemblyLoadContext assemblyLoadContext,
                                 INativeResource cSharpNativeResource,
                                 IBaseBaseObjectPool baseBaseObjectPool,
                                 IBaseEntityPool baseEntityPool, IEntityPool <IPlayer> playerPool, IEntityPool <IVehicle> vehiclePool,
                                 IBaseObjectPool <IBlip> blipPool,
                                 IBaseObjectPool <ICheckpoint> checkpointPool, IBaseObjectPool <IVoiceChannel> voiceChannelPool,
                                 IBaseObjectPool <IColShape> colShapePool,
                                 INativeResourcePool nativeResourcePool)
 {
     return(new Module(server, assemblyLoadContext, cSharpNativeResource, baseBaseObjectPool, baseEntityPool, playerPool, vehiclePool,
                       blipPool, checkpointPool, voiceChannelPool, colShapePool, nativeResourcePool));
 }
Ejemplo n.º 21
0
 public AsyncModule(IServer server, AssemblyLoadContext assemblyLoadContext, INativeResource moduleResource,
                    IBaseBaseObjectPool baseBaseObjectPool, IBaseEntityPool baseEntityPool, IEntityPool <IPlayer> playerPool,
                    IEntityPool <IVehicle> vehiclePool,
                    IBaseObjectPool <IBlip> blipPool,
                    IBaseObjectPool <ICheckpoint> checkpointPool,
                    IBaseObjectPool <IVoiceChannel> voiceChannelPool,
                    IBaseObjectPool <IColShape> colShapePool,
                    INativeResourcePool nativeResourcePool) : base(server, assemblyLoadContext, moduleResource,
                                                                   baseBaseObjectPool,
                                                                   baseEntityPool, playerPool, vehiclePool, blipPool,
                                                                   checkpointPool, voiceChannelPool, colShapePool, nativeResourcePool)
 {
     AltAsync.Setup(this);
 }
Ejemplo n.º 22
0
        public override void Start(IEntityPool entityPool)
        {
            this._entityPool = entityPool;

            var player = entityPool.GetEntityById("Player");
            if (player == null) return;

            var component = player.GetComponent<WeaponComponent>();
            var value = component.Ammo(weaponName);
            var max = component.MaxAmmo(weaponName);
            Set(value / (float)max);

            player.GetComponent<WeaponComponent>().AmmoChanged += WeaponAmmo_Changed;
        }
Ejemplo n.º 23
0
 public void Destroy(IEntityPool pool)
 {
     if (_toDeleteList.Contains(this) || IsDestroyed())
     {
         return;
     }
     if (pool != null)
     {
         pool.Store(this);
     }
     else
     {
         _toDeleteList.Add(this);
     }
 }
Ejemplo n.º 24
0
        public override void Start(IEntityPool entityPool)
        {
            var entity = entityPool.GetEntityById(_entityId);

            if (entity == null)
            {
                return;
            }

            _health = entity.GetComponent <HealthComponent>();
            if (_health != null)
            {
                Set(_health.Health / _health.MaxHealth);
                _health.HealthChanged += health_HealthChanged;
            }
        }
Ejemplo n.º 25
0
 internal MockServer(IntPtr nativePointer, IBaseBaseObjectPool baseBaseObjectPool,
                     IBaseEntityPool baseEntityPool, IEntityPool <IPlayer> playerPool,
                     IEntityPool <IVehicle> vehiclePool,
                     IBaseObjectPool <IBlip> blipPool,
                     IBaseObjectPool <ICheckpoint> checkpointPool,
                     IBaseObjectPool <IVoiceChannel> voiceChannelPool)
 {
     this.nativePointer      = nativePointer;
     this.baseBaseObjectPool = baseBaseObjectPool;
     this.baseEntityPool     = baseEntityPool;
     this.playerPool         = playerPool;
     this.vehiclePool        = vehiclePool;
     this.blipPool           = blipPool;
     this.checkpointPool     = checkpointPool;
     this.voiceChannelPool   = voiceChannelPool;
 }
Ejemplo n.º 26
0
 public Module(IServer server, CSharpNativeResource cSharpNativeResource, IBaseBaseObjectPool baseBaseObjectPool,
               IBaseEntityPool baseEntityPool, IEntityPool <IPlayer> playerPool,
               IEntityPool <IVehicle> vehiclePool,
               IBaseObjectPool <IBlip> blipPool,
               IBaseObjectPool <ICheckpoint> checkpointPool,
               IBaseObjectPool <IVoiceChannel> voiceChannelPool)
 {
     Alt.Init(this);
     Server = server;
     CSharpNativeResource = cSharpNativeResource;
     BaseBaseObjectPool   = baseBaseObjectPool;
     BaseEntityPool       = baseEntityPool;
     PlayerPool           = playerPool;
     VehiclePool          = vehiclePool;
     BlipPool             = blipPool;
     CheckpointPool       = checkpointPool;
     VoiceChannelPool     = voiceChannelPool;
 }
Ejemplo n.º 27
0
        public override void Start(IEntityPool entityPool)
        {
            this._entityPool = entityPool;

            var player = entityPool.GetEntityById("Player");

            if (player == null)
            {
                return;
            }

            var component = player.GetComponent <WeaponComponent>();
            var value     = component.Ammo(weaponName);
            var max       = component.MaxAmmo(weaponName);

            Set(value / (float)max);

            player.GetComponent <WeaponComponent>().AmmoChanged += WeaponAmmo_Changed;
        }
Ejemplo n.º 28
0
        public BossDoorHandler(Join join, IGameplayContainer container, IEntityPool entityPool, int tileSize, int height, int width, string name)
            : base(join, tileSize, height, width, name)
        {
            this.container = container;
            _entityPool    = entityPool;

            if (direction == Direction.Down)
            {
                doorOneX = join.offsetOne * tileSize;
                doorOneY = height - tileSize;

                doorTwoX = join.offsetOne * tileSize;
                doorTwoY = height;
            }
            else if (direction == Direction.Left)
            {
                doorOneX = 0;
                doorOneY = join.offsetTwo * tileSize;

                doorTwoX = -tileSize;
                doorTwoY = join.offsetTwo * tileSize;
            }
            else if (direction == Direction.Right)
            {
                doorOneX = width - tileSize;
                doorOneY = join.offsetOne * tileSize;

                doorTwoX = width;
                doorTwoY = join.offsetOne * tileSize;
            }
            else if (direction == Direction.Up)
            {
                doorOneX = join.offsetTwo * tileSize;
                doorOneY = 0;

                doorTwoX = join.offsetTwo * tileSize;
                doorTwoY = -tileSize;
            }
        }
Ejemplo n.º 29
0
        public BossDoorHandler(Join join, IGameplayContainer container, IEntityPool entityPool, int tileSize, int height, int width, string name)
            : base(join, tileSize, height, width, name)
        {
            this.container = container;
            _entityPool = entityPool;

            if (direction == Direction.Down)
            {
                doorOneX = join.offsetOne * tileSize;
                doorOneY = height - tileSize;

                doorTwoX = join.offsetOne * tileSize;
                doorTwoY = height;
            }
            else if (direction == Direction.Left)
            {
                doorOneX = 0;
                doorOneY = join.offsetTwo * tileSize;

                doorTwoX = -tileSize;
                doorTwoY = join.offsetTwo * tileSize;
            }
            else if (direction == Direction.Right)
            {
                doorOneX = width - tileSize;
                doorOneY = join.offsetOne * tileSize;

                doorTwoX = width;
                doorTwoY = join.offsetOne * tileSize;
            }
            else if (direction == Direction.Up)
            {
                doorOneX = join.offsetTwo * tileSize;
                doorOneY = 0;

                doorTwoX = join.offsetTwo * tileSize;
                doorTwoY = -tileSize;
            }
        }
Ejemplo n.º 30
0
 public Server(IntPtr nativePointer, INativeResource resource, IBaseBaseObjectPool baseBaseObjectPool,
               IBaseEntityPool baseEntityPool,
               IEntityPool <IPlayer> playerPool,
               IEntityPool <IVehicle> vehiclePool,
               IBaseObjectPool <IBlip> blipPool,
               IBaseObjectPool <ICheckpoint> checkpointPool,
               IBaseObjectPool <IVoiceChannel> voiceChannelPool,
               IBaseObjectPool <IColShape> colShapePool,
               INativeResourcePool nativeResourcePool)
 {
     NativePointer           = nativePointer;
     this.baseBaseObjectPool = baseBaseObjectPool;
     this.baseEntityPool     = baseEntityPool;
     this.playerPool         = playerPool;
     this.vehiclePool        = vehiclePool;
     this.blipPool           = blipPool;
     this.checkpointPool     = checkpointPool;
     this.voiceChannelPool   = voiceChannelPool;
     this.colShapePool       = colShapePool;
     this.nativeResourcePool = nativeResourcePool;
     Resource = resource;
 }
Ejemplo n.º 31
0
        public Server(IntPtr nativePointer, CSharpNativeResource resource, IBaseBaseObjectPool baseBaseObjectPool, IBaseEntityPool baseEntityPool,
                      IEntityPool <IPlayer> playerPool,
                      IEntityPool <IVehicle> vehiclePool,
                      IBaseObjectPool <IBlip> blipPool,
                      IBaseObjectPool <ICheckpoint> checkpointPool,
                      IBaseObjectPool <IVoiceChannel> voiceChannelPool,
                      IBaseObjectPool <IColShape> colShapePool)
        {
            NativePointer           = nativePointer;
            this.baseBaseObjectPool = baseBaseObjectPool;
            this.baseEntityPool     = baseEntityPool;
            this.playerPool         = playerPool;
            this.vehiclePool        = vehiclePool;
            this.blipPool           = blipPool;
            this.checkpointPool     = checkpointPool;
            this.voiceChannelPool   = voiceChannelPool;
            this.colShapePool       = colShapePool;
            var ptr = IntPtr.Zero;

            AltNative.Server.Server_GetRootDirectory(nativePointer, ref ptr);
            RootDirectory = Marshal.PtrToStringUTF8(ptr);
            Resource      = resource;
        }
Ejemplo n.º 32
0
 public Core(IntPtr nativePointer, IntPtr resourcePointer, AssemblyLoadContext assemblyLoadContext, ILibrary library, IBaseBaseObjectPool baseBaseObjectPool,
             IBaseEntityPool baseEntityPool,
             IEntityPool <IPlayer> playerPool,
             IEntityPool <IVehicle> vehiclePool,
             IBaseObjectPool <IBlip> blipPool,
             IBaseObjectPool <ICheckpoint> checkpointPool,
             IBaseObjectPool <IVoiceChannel> voiceChannelPool,
             IBaseObjectPool <IColShape> colShapePool,
             INativeResourcePool nativeResourcePool) : base(nativePointer, library)
 {
     this.assemblyLoadContext   = new WeakReference <AssemblyLoadContext>(assemblyLoadContext);
     this.BaseBaseObjectPool    = baseBaseObjectPool;
     this.BaseEntityPool        = baseEntityPool;
     this.PlayerPool            = playerPool;
     this.VehiclePool           = vehiclePool;
     this.BlipPool              = blipPool;
     this.CheckpointPool        = checkpointPool;
     this.VoiceChannelPool      = voiceChannelPool;
     this.ColShapePool          = colShapePool;
     this.NativeResourcePool    = nativeResourcePool;
     this.vehicleModelInfoCache = new();
     nativeResourcePool.GetOrCreate(this, resourcePointer, out var resource);
     Resource = resource;
 }
 public BaseBaseObjectPool(
     IEntityPool <IPlayer> playerPool,
     IEntityPool <IVehicle> vehiclePool,
     IBaseObjectPool <IBlip> blipPool,
     IBaseObjectPool <ICheckpoint> checkpointPool,
     IBaseObjectPool <IAudio> audioPool,
     IBaseObjectPool <IHttpClient> httpClientPool,
     IBaseObjectPool <IWebSocketClient> webSocketClientPool,
     IBaseObjectPool <IWebView> webViewPool,
     IBaseObjectPool <IRmlElement> rmlElementPool,
     IBaseObjectPool <IRmlDocument> rmlDocumentPool
     )
 {
     this.playerPool          = playerPool;
     this.vehiclePool         = vehiclePool;
     this.blipPool            = blipPool;
     this.checkpointPool      = checkpointPool;
     this.audioPool           = audioPool;
     this.httpClientPool      = httpClientPool;
     this.webSocketClientPool = webSocketClientPool;
     this.webViewPool         = webViewPool;
     this.rmlElementPool      = rmlElementPool;
     this.rmlDocumentPool     = rmlDocumentPool;
 }
Ejemplo n.º 34
0
 public override void StartHandler(IEntityPool entityPool)
 {
     frame = 0;
     base.StartHandler(entityPool);
 }
Ejemplo n.º 35
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Vehicle"/> class.
 /// </summary>
 /// <param name="id">Id for this vehicle.</param>
 /// <param name="entityRemoval">Delegate that should be used to remove this entity from the <see cref="IVehiclePool"/>.</param>
 /// <param name="vehiclesNatives">Natives which are needed for this entity.</param>
 public Vehicle(int id, IVehiclePool.RemoveEntityDelegate entityRemoval, IVehiclesNatives vehiclesNatives)
     : base(id)
 {
     this.entityRemoval   = entityRemoval;
     this.vehiclesNatives = vehiclesNatives;
 }
Ejemplo n.º 36
0
 public StageFactory(IEntityPool entityPool, IEntityRespawnTracker respawnTracker)
 {
     _entityPool = entityPool;
     _respawnTracker = respawnTracker;
 }
Ejemplo n.º 37
0
 public SceneEntityPoolDecorator(IEntityPool basePool)
 {
     _basePool = basePool;
     _additionalEntities = new List<GameEntity>();
 }
Ejemplo n.º 38
0
        public virtual void StartHandler(IEntityPool entityPool)
        {
            Entities = entityPool;

            BeforeStart();
            ResumeHandler();
            StartDrawing();
        }
Ejemplo n.º 39
0
 public abstract void Start(IEntityPool entityPool);
Ejemplo n.º 40
0
        private static IEnumerable<IEntity> GetFilteredEntities(IEntityPool pool, EntityFilterInfo filter)
        {
            var entities = pool.GetAll();

            if (filter.Type != null)
                entities = entities.Where(e => e.Name == filter.Type);

            if (filter.Direction != null)
                entities = entities.Where(e => e.Direction == filter.Direction);

            if (filter.Position != null)
            {
                if (filter.Position.X != null)
                {
                    if (filter.Position.X.Min.HasValue)
                        entities = entities.Where(e => {
                            var pos = e.GetComponent<PositionComponent>();
                            return pos == null || pos.X >= filter.Position.X.Min.Value;
                        });

                    if (filter.Position.X.Max.HasValue)
                        entities = entities.Where(e => {
                            var pos = e.GetComponent<PositionComponent>();
                            return pos == null || pos.X <= filter.Position.X.Max.Value;
                        });
                }

                if (filter.Position.Y != null)
                {
                    if (filter.Position.Y.Min.HasValue)
                        entities = entities.Where(e => {
                            var pos = e.GetComponent<PositionComponent>();
                            return pos == null || pos.Y >= filter.Position.Y.Min.Value;
                        });

                    if (filter.Position.Y.Max.HasValue)
                        entities = entities.Where(e => {
                            var pos = e.GetComponent<PositionComponent>();
                            return pos == null || pos.Y <= filter.Position.Y.Max.Value;
                        });
                }
            }

            return entities;
        }
 public MockColShapeModule(IEntityPool <IPlayer> playerPool, IEntityPool <IVehicle> vehiclePool)
 {
     this.playerPool  = playerPool;
     this.vehiclePool = vehiclePool;
 }
Ejemplo n.º 42
0
 public GameStateMachine(IEntityPool entityPool, StageFactory stageFactory)
 {
     _handlerStack = new Stack<IGameplayContainer>();
     _entityPool = entityPool;
     _stageFactory = stageFactory;
 }
Ejemplo n.º 43
0
 public BaseEntityPool(IEntityPool <IPlayer> playerPool, IEntityPool <IVehicle> vehiclePool)
 {
     this.playerPool  = playerPool;
     this.vehiclePool = vehiclePool;
 }
Ejemplo n.º 44
0
        public HandlerText(SceneTextCommandInfo info, IEntityPool entityPool)
        {
            this.Content = info.Content ?? String.Empty;
            this.speed = info.Speed ?? 0;
            this.position = new MegaMan.Common.Geometry.Point(info.X, info.Y);
            this.entityPool = entityPool;
            this.font = info.Font ?? "Default";

            if (info.Binding != null)
            {
                this.binding = Binding.Create(info.Binding, this);
            }
        }