/// <summary> /// Initialise a level /// </summary> /// <param name="onWin">Function to call when a player wins (parameter is winning player index)</param> /// <param name="onTie">Function to call when there's a tie</param> public Level(Action<int> onWin, Action onTie) { this.onWin = onWin; this.onTie = onTie; aesthetics = new LevelAesthetics(); tileObjectManager = new TileObjectManager(this); fireManager = new FireManager(tileObjectManager); solidArea = new bool[GlobalGameData.gridSizeX, GlobalGameData.gridSizeY]; gridNodeMap = new GridNodeMap(); playerToController = new Dictionary<int, int>(); players = new Player[4]; //Initialise players to the gridnodemap, with their index, and the bomb create function for (int i = 0; i < 4; ++i) { players[i] = new Player(gridNodeMap, i, tileObjectManager.CreateBomb); } playerInputControllers = new PlayerInputController[4]; //Initialise player input controllers to the players for (int i = 0; i < 4; ++i) { playerInputControllers[i] = new PlayerInputController(players[i]); } floatingAnimationManager = new FloatingAnimationManager(); }
public GridNodeMover(GridNodeMap gridNodeMap) { GridNodeMap.TileContents tile = gridNodeMap.GetNode(0, 0); if (tile == null) //Tile requested doesn't exist { tile = gridNodeMap.GetNode(0, 0); } position = tile.position; map = gridNodeMap; moveEventQueue = new Queue<MoveEvent>(); }
public Player(GridNodeMap map, int playerIndex, Func<int, int, int, int, bool> placeBombFunc) { movement = new GridNodeMover(map); this.placeBombFunc = placeBombFunc; this.playerIndex = playerIndex; }