示例#1
0
 public TileLogicSetup(ITileMatrixProducer tileMatrixProducer, ISpyTileLogic spyTileLogic,
                       IEnvTileLogic envTileLogic, IGuardTileLogic guardTileLogic, IExitTileLogic exitTileLogic,
                       IPathFinder pathFinder,
                       int mapCreationTolerance = 500, bool hasMiddleTiles = true)
 {
     _tileMatrixProducer   = tileMatrixProducer;
     _tileMatrix           = _tileMatrixProducer.Tiles;
     _spyTileLogic         = spyTileLogic;
     _envTileLogic         = envTileLogic;
     _guardTileLogic       = guardTileLogic;
     _pathFinder           = pathFinder;
     _exitTileLogic        = exitTileLogic;
     _mapCreationTolerance = mapCreationTolerance;
 }
示例#2
0
 /// <summary>
 /// Instantiates each class which manipulates the EnvTile matrix with the relevant parameters
 /// </summary>
 /// <param name="mapScale">size of the map</param>
 /// <param name="mapDifficulty">number of randomly placed env blocks</param>
 /// <param name="exitCount">number of exits</param>
 /// <param name="guardAgentCount">number of guards</param>
 /// <param name="parentDictionary">Dictionary of gameobjects in hierarchy</param>
 /// <param name="mapCreationTolerance">number of times the algorithm should attempt to produce the map</param>
 /// <param name="hasMiddleTiles">determines if the map should have the middle tiles (corridors)</param>
 public TileLogicBuilder(int mapScale, int mapDifficulty, int exitCount, int guardAgentCount,
     Dictionary<ParentObject, GameObject> parentDictionary, int mapCreationTolerance = 500,
     bool hasMiddleTiles = true)
 {
     var matrixSize = MapScaleToMatrixSize(mapScale);
     _tileMatrixProducer =
         new TileMatrixProducer(parentDictionary[ParentObject.TopParent].transform.position, matrixSize);
     _spyTileLogic = new SpyTileLogic(matrixSize);
     _envTileLogic = new EnvTileLogic(matrixSize, mapDifficulty, hasMiddleTiles);
     _pathFinder = new PathFinder();
     _exitTileLogic = new ExitTileLogic(matrixSize, exitCount);
     _guardTileLogic = new GuardTileLogic(mapScale, matrixSize, guardAgentCount);
     _mapCreationTolerance = mapCreationTolerance;
 }