public DespawnTimer(float time, bool unscaled, IEntityPool pool, bool autoStart = true) { Time = time; Unscaled = unscaled; Pool = pool; _autoStart = autoStart; }
/// <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)); }
public override void Start(IEntityPool container) { var value = Game.CurrentGame.Player.ItemQuantity(itemName); Set(value); Game.CurrentGame.Player.InventoryChanged += Player_InventoryChanged; }
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)); }
public override void Start(IEntityPool container) { var value = Game.CurrentGame.Player.ItemQuantity(itemName); Set(value); Game.CurrentGame.Player.InventoryChanged += Player_InventoryChanged; }
public virtual void StartHandler(IEntityPool entityPool) { Entities = entityPool; BeforeStart(); ResumeHandler(); StartDrawing(); }
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)); }
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 override void StartHandler(IEntityPool entityPool) { base.StartHandler(entityPool); this.state = this.info.States[0]; RunCommands(this.state.Commands); ResetState(); }
public override void StartHandler(IEntityPool entityPool) { base.StartHandler(entityPool); this.state = this.info.States[0]; RunCommands(this.state.Commands); ResetState(); }
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; }
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); }
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); }
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); }
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; }
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; }
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; } }
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)); }
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); } }
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)); }
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); }
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; }
public void Destroy(IEntityPool pool) { if (_toDeleteList.Contains(this) || IsDestroyed()) { return; } if (pool != null) { pool.Store(this); } else { _toDeleteList.Add(this); } }
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; } }
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; }
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; }
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; }
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; } }
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; } }
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; }
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; }
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; }
public override void StartHandler(IEntityPool entityPool) { frame = 0; base.StartHandler(entityPool); }
/// <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; }
public StageFactory(IEntityPool entityPool, IEntityRespawnTracker respawnTracker) { _entityPool = entityPool; _respawnTracker = respawnTracker; }
public SceneEntityPoolDecorator(IEntityPool basePool) { _basePool = basePool; _additionalEntities = new List<GameEntity>(); }
public virtual void StartHandler(IEntityPool entityPool) { Entities = entityPool; BeforeStart(); ResumeHandler(); StartDrawing(); }
public abstract void Start(IEntityPool entityPool);
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; }
public GameStateMachine(IEntityPool entityPool, StageFactory stageFactory) { _handlerStack = new Stack<IGameplayContainer>(); _entityPool = entityPool; _stageFactory = stageFactory; }
public BaseEntityPool(IEntityPool <IPlayer> playerPool, IEntityPool <IVehicle> vehiclePool) { this.playerPool = playerPool; this.vehiclePool = vehiclePool; }
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); } }