public MapSystem(Contexts contexts) : base(contexts.game) { rnd = new System.Random(); _gameContext = contexts.game; _removableEntitiesGroup = _gameContext.GetGroup(GameMatcher.AllOf(GameMatcher.Position).NoneOf(GameMatcher.Player)); _playerGroup = _gameContext.GetGroup(GameMatcher.Player); _groundTiles = _gameContext.GetGroup(GameMatcher.AllOf(GameMatcher.Position, GameMatcher.Tile).NoneOf(GameMatcher.Blocking)); _blockingEntities = _gameContext.GetGroup(GameMatcher.AllOf(GameMatcher.Position, GameMatcher.Blocking).NoneOf(GameMatcher.Tile)); }
protected override void DoInit() { _destroyedGroup = contexts.game.GetGroup(GameMatcher.AllOf( GameMatcher.Destroyed, GameMatcher.EntityId, GameMatcher.ItemType)); _allEnmey = contexts.game.GetGroup(GameMatcher.AllOf( GameMatcher.EntityId, GameMatcher.TagEnemy)); }
public TraceSystem(Contexts contexts) { //移动 __traceGroup = Contexts.sharedInstance.game.GetGroup( GameMatcher.AllOf( GameMatcher.Trace, GameMatcher.Movement, GameMatcher.Transform )); }
public ViewEditorTransformSystem(Contexts contexts) { //移动 __editorTransformGroup = Contexts.sharedInstance.game.GetGroup( GameMatcher.AllOf( GameMatcher.View, GameMatcher.Transform, GameMatcher.EditorEntity )); }
public static GameEntity[] GetInfluencialPeople(GameContext gameContext) { var investors = gameContext .GetEntities(GameMatcher.AllOf(GameMatcher.Shareholder, GameMatcher.Human)) .Where(e => GetInvestorCapitalCost(gameContext, e) > 0) .OrderByDescending(e => GetInvestorCapitalCost(gameContext, e)) .ToArray(); return(investors); }
public RenderNonTilesGridPositionToPosition(GameContext game) { this.game = game; entities = game.GetGroup(GameMatcher .AllOf( GameMatcher.GridPosition, GameMatcher.Position) .NoneOf( GameMatcher.Tile)); }
public BuildCommands(Contexts contexts) : base(contexts.input) { _game = contexts.game; _grid = UnityEngine.GameObject.FindObjectOfType <HexGridBehaviour>(); _presets = new Presets(_game, _grid); _UICommands = contexts.input.GetGroup(InputMatcher.AnyOf(InputMatcher.UIBuildBarracks, InputMatcher.UIBuildTower)); _selectedBarracksBuilders = _game.GetGroup(GameMatcher.AllOf(GameMatcher.Selected, GameMatcher.CanBuildBarracks)); _selectedTowerBuilders = _game.GetGroup(GameMatcher.AllOf(GameMatcher.Selected, GameMatcher.CanBuildBarracks)); }
public ItemCleanupSystem(Contexts contexts) { _contexts = contexts; // Every item that is neither in a storage on placed in the world _items = contexts.game.GetGroup( GameMatcher .AllOf(GameMatcher.Item) .NoneOf(GameMatcher.StorageSource, GameMatcher.Position)); }
public ShootWeaponOnPressFireSystem(Contexts contexts) : base(contexts) { game = contexts.game; weaponMatcher = GameMatcher.AllOf( GameMatcher.Transform, GameMatcher.ProjectileSpeed, GameMatcher.Damage ); }
public FollowTargetSystem(Contexts contexts) { _contexts = contexts; _group = contexts.game.GetGroup(GameMatcher.AllOf( GameMatcher.TargetComp, GameMatcher.VelComp, GameMatcher.RotComp, GameMatcher.StatsComp )); }
public FollowSystem(Contexts contexts) { //移动 __followGroup = Contexts.sharedInstance.game.GetGroup( GameMatcher.AllOf( GameMatcher.Follow, GameMatcher.Movement, GameMatcher.Transform )); }
public override void DoStart() { base.DoStart(); _config = Resources.Load <GameConfig>(GameConfig.ConfigPath); _assetBindGroup = _gameContext.GetGroup(GameMatcher.AllOf( GameMatcher.LocalId, GameMatcher.Asset, GameMatcher.Pos, GameMatcher.Dir)); }
public CreateMapTileFromPrefab(GameContext game, GameObject mapTilePrefab) { this.game = game; this.mapTilePrefab = mapTilePrefab; tiles = game.GetGroup(GameMatcher .AllOf( GameMatcher.Tile) .NoneOf( GameMatcher.GameObject)); }
public FadeObstructingObjectsSystem(Contexts contexts) { _contexts = contexts; _seethrough = contexts.game.GetGroup(GameMatcher.AllOf( GameMatcher.Seethrough, GameMatcher.View )); _faded = contexts.game.GetGroup(GameMatcher.Fade); _obstructing = new HashSet <GameEntity>(); }
public StartNewGameSystem(Contexts contexts) { gameContext = contexts.game; inputContext = contexts.input; newGameButtonGroup = gameContext.GetGroup(GameMatcher.AllOf(GameMatcher.NewGameButton, GameMatcher.View)); buttonGroup = gameContext.GetGroup(GameMatcher.NewGameButton); scoreGroup = gameContext.GetGroup(GameMatcher.AnyOf(GameMatcher.Player1Score, GameMatcher.Player2Score)); uiGroup = gameContext.GetGroup(GameMatcher.UiElement); disableInputGroup = inputContext.GetGroup(InputMatcher.DisableInput); }
public SystemExecuteMovePlayer(Contexts contexts, IServiceContainer serviceContainer) : base(contexts, serviceContainer) { _moveRequest = contexts.game.GetGroup(GameMatcher.AllOf( GameMatcher.LocalId, GameMatcher.MoveRequest, GameMatcher.Move, GameMatcher.ActorId )); }
public void InitializePieceEntityIndices() { game.AddEntityIndex(new PrimaryEntityIndex <GameEntity, Vector2Int>( Piece, game.GetGroup(GameMatcher .AllOf(GameMatcher.Piece, GameMatcher.Position) .NoneOf(GameMatcher.Destroyed) ), (e, c) => (c as PositionComponent)?.value ?? e.position.value)); }
private void ShutDown() { foreach (var item in _contexts.GetEntities(GameMatcher.AllOf(GameMatcher.BalloonPosition))) { if (!item.isBalloonPopped) { item.AddComponent(GameComponentsLookup.BalloonPopped, new BalloonPoppedComponent()); } } }
private int CalculateCellItemLeftToGenerate(CellItemTypeInBoard type) { var cellItemCountInBoard = _contexts.game.GetEntities(GameMatcher.AllOf(GameMatcher.CellItem)) .Count(e => Equals(e.cellItemType.Value, type.CellItemType)); var cellItemReservations = _contexts.game.GetEntities(GameMatcher.CellItemReservation) .Count(e => Equals(e.cellItemReservation.CellItemType, type)); var cellItemCountLeftInGoal = CalculateItemCountLeftInGoal(type.GoalType); return(cellItemCountLeftInGoal - (cellItemCountInBoard + cellItemReservations)); }
public AuraDamageSystem(Contexts contexts) { gameContext = contexts.game; var matcher = GameMatcher.AllOf(GameMatcher.Aura, GameMatcher.Position, GameMatcher.CircleCollider); auraGroup = gameContext.GetGroup(matcher); var damagableMatcher = GameMatcher.AllOf(GameMatcher.Position, GameMatcher.Collidable, GameMatcher.HealthPoints); damagableGroup = gameContext.GetGroup(damagableMatcher); }
public void Initialize() { _selectedNavAgentsGroup = _contexts.game.GetGroup(GameMatcher.AllOf(GameMatcher.Selected, GameMatcher.NavAgent)); GameObject targetGo = new GameObject("RightClickNavigationTarget"); GameEntity targetEntity = _contexts.game.CreateEntity(); targetEntity.isRightClickNavigationTarget = true; targetEntity.AddView(targetGo); }
public CollisionDetectionSystem(Contexts contexts, PositionChunks positionChunks) { chunks = positionChunks; gameContext = contexts.game; var matcher = GameMatcher.AllOf(GameMatcher.Collidable, GameMatcher.CircleCollider, GameMatcher.Position); collidableGroup = gameContext.GetGroup(matcher); buffer = new List <GameEntity>(predictedCapacity); idsToIndexes = new Dictionary <ushort, int>(predictedCapacity); collidables = new CollisionInfo[predictedCapacity]; }
public SetPathEndTiles(GameContext game) { agents = game.GetGroup(GameMatcher .AllOf(GameMatcher.PathFinderAgent, GameMatcher.PathFinderPath)); tiles = game.GetGroup(GameMatcher .AllOf( GameMatcher.Tile, GameMatcher.GridPosition) .NoneOf( GameMatcher.PathEndTile)); }
public AttackCurrentEnemySystem(Contexts contexts) { gameContext = contexts.game; charactersGroup = gameContext.GetGroup(GameMatcher .AllOf( GameMatcher.CurrentEnemy, GameMatcher.Attack, GameMatcher.Position ) ); }
public CreatePlayerSystem(Contexts contexts) { this.contexts = contexts; var player = contexts.game.GetGroup(GameMatcher.AllOf(GameMatcher.Player)); player.OnEntityAdded += InitializePlayer; var instantiatiedPlayer = contexts.game.GetGroup(GameMatcher.AllOf(GameMatcher.Player, GameMatcher.GameObject)); instantiatiedPlayer.OnEntityAdded += OnPlayerInstantiated; }
public EndGameSystem(Contexts contexts) : base(contexts.game) { _contexts = contexts; _playerCharacters = contexts.game.GetGroup(GameMatcher.AllOf( GameMatcher.PlayerCharacter, GameMatcher.Health)); _enemyCharacters = contexts.game.GetGroup(GameMatcher.AllOf( GameMatcher.EnemyCharacter, GameMatcher.Health)); }
public void Initialize() { _game.isAnimating = false; _game.SetAnimationQueue(new Queue <GameEntity>()); _animations = _game.animationQueue.value; _immediate = _game.GetGroup(GameMatcher.AllOf( GameMatcher.Animation, GameMatcher.Immediate )); _all = _game.GetGroup(GameMatcher.Animation); }
public CreateNewCreatureSystem(IGameContext context, MonsterFactory factory, RandomPositionGenerator randomPositionGenerator, Grid grid) { _factory = factory; _grid = grid; _attackGroup = context.GetGroup(GameMatcher.AllOf( GameMatcher.Creator, GameMatcher.Calldown, GameMatcher.InitialCalldown, GameMatcher.Target)); _randomPositionGenerator = randomPositionGenerator; }
public ItemPickupTooltipSystem(Contexts contexts) { _contexts = contexts; _pickable = contexts.game.GetGroup(GameMatcher.AllOf( GameMatcher.Item, GameMatcher.Position) .NoneOf(GameMatcher.StorageSource)); _players = contexts.game.GetGroup( GameMatcher.AllOf(GameMatcher.Actor, GameMatcher.Player, GameMatcher.Position)); _tooltip = contexts.ui.CreateEntity(); }
private GameEntity GetEntityAtPos(int x, int y) { foreach (GameEntity entity in _context.GetEntities(GameMatcher.AllOf(GameMatcher.Position, GameMatcher.FieldElement))) { if (entity.position.x == x && entity.position.y == y) { return(entity); } } return(null); }