/// <summary> /// Initializes a new instance of the <see cref="T:MyGame.CollisionCheckSystem"/> class. /// </summary> /// <param name="world">The World the System belongs to.</param> public CollisionCheckSystem(World world) : base(new List <Type> { }, new List <Type> { typeof(CExcludeAll) }, world) { /// <summary> /// Initialise Entity Holder Systems and add them to the World. /// </summary> _playerEnts = new EntityHolderSystem(new List <Type> { typeof(CPlayerTeam), typeof(CCollidable) }, new List <Type> { }, world); _enemyEnts = new EntityHolderSystem(new List <Type> { typeof(CEnemyTeam), typeof(CCollidable) }, new List <Type> { }, world); world.AddSystem(_playerEnts); world.AddSystem(_enemyEnts); /// <summary> /// Generate Spatial Hash cell details and initialise cells. /// </summary> /// <value>The player cells.</value> _cols = (int)Math.Floor((double)SwinGame.ScreenWidth() / _cellSize); _rows = (int)Math.Floor((double)SwinGame.ScreenHeight() / _cellSize); _numCells = _cols * _rows; for (int i = 0; i < _numCells; i++) { _playerCells.Add(i, new List <ulong>()); _enemyCells.Add(i, new List <ulong>()); } }
/// <summary> /// Initializes a new instance of the <see cref="T:MyGame.PlayerAISystem"/> class. /// </summary> /// <param name="world">The World the System belongs to.</param> public PlayerAISystem(World world) : base(world) { /// <summary> /// The Player AI System's Component Masks are: /// Include - CAI, CPlayerTeam /// Exclude - CENemyTeam /// </summary> /// <param name="entID">Ent identifier.</param> Include.Remove(typeof(CEnemyTeam)); Include.Add(typeof(CPlayerTeam)); _enemies = new EntityHolderSystem(new List <Type> { typeof(CEnemyTeam), typeof(CHealth) }, new List <Type> { }, world); World.AddSystem(_enemies); }