// Constructs an xSize by ySize map. Default Tile set to TileBasicFloor. public Map(Int32 seed) { // creates and fills the tile array this._xMax = Constants.MapSizeX; this._yMax = Constants.MapSizeY; // Calculates maximal bounds in pixels. this._pixelMaxX = 0; for (Int32 i = 0; i < Constants.MapSizeX; ++i) { _pixelMaxX += Constants.TileSizesX[i]; } this._pixelMaxY = (UInt32)(Constants.MapSizeY); for (Int32 i = 0; i < Constants.MapSizeY; ++i) { _pixelMaxY += Constants.TileSizesY[i]; } // Constructs the field. _tiles = new Tile[Constants.MapSizeX, Constants.MapSizeY]; for (Int32 i = 0; i < Constants.MapSizeX; i++) { for (Int32 j = 0; j < Constants.MapSizeY; j++) { _tiles[i, j] = new Tile(this, new Coords(i, j), (SpriteTile)(i + j * Constants.MapSizeX)); } } // initializes collider this._myCollider = new Collider(Constants.BoxesInX, Constants.BoxesInY, Constants.PixelsPerBoxX, Constants.PixelsPerBoxY); // intialize influence map generator this._infMapGenerator = new InfluenceMapGenerator(); // initialize default source map this._defaultInfSourceMap = new InfluenceSourceMap(Constants.InfMapDefaultX, Constants.InfMapDefaultY, new Coords(Constants.InfMapDefaultX / 2, Constants.InfMapDefaultY / 2), Constants.InfluenceMapMaxDistance); this._defaultInfSourceMap.Map = this.InfMapGenerator.GenerateInfluenceMap(Constants.InfMapDefaultX, Constants.InfMapDefaultY, new Coords(Constants.InfMapDefaultX / 2, Constants.InfMapDefaultY / 2), StaticMathFunctions.InfluenceDecayFunctionLinear); //this._teamInfluenceMaps[0] = new InfluenceMap(Constants.InfMapDefaultX, Constants.InfMapDefaultY); //this._teamInfluenceMaps[1] = new InfluenceMap(Constants.InfMapDefaultX, Constants.InfMapDefaultY); // initializes the random number generator associated with this map this._randomator = new RandomStuff(seed); }
private Footballer LookForPass() { Footballer target = null; // pick random target List <Footballer> roster = _owner.Team.TeamRoster; UInt16 choices = (UInt16)roster.Count; RandomStuff randomator = _owner.InhabitedMap.Randomator; UInt32 choice = randomator.NSidedDice(choices, 1) - 1; while (choice == _owner.UniqueID && roster.Count > 1) { choice = randomator.NSidedDice(choices, 1) - 1; } target = roster[(Int32)choice]; return(target); }