public void Move(Player movingPlayer, int x, int y, int speed) { int px = x; int py = y; List <int[]> previousBlocks = movingPlayer.GetPreviousBlock(); //movingPlayer.SetPreviousBlock(GetCurrentBlocks(movingPlayer)); if (px == 0 && py == 0) { return; } Unit[] b = getNearbyBlocks(movingPlayer.x, movingPlayer.y, GetStillOccupiedBlocks(GetCurrentBlocks(movingPlayer), previousBlocks)); MovementHandler full = new FullMove(); full.SetNextChain(new HalfMove()); full.GetNextChain().SetNextChain(new QuarterMove()); full.GetNextChain().GetNextChain().SetNextChain(new OneMove()); full.Calculate(movingPlayer, px, py, speed, this, b); }
public void ActivateBlock(Player player, double time, ScoreboardTemplate scoreboard) { int[] playerCenter = getCenterPlayer(new int[] { player.x, player.y }); int[] playerTile = getTile(playerCenter[0], playerCenter[1]); Unit playerStandsOn = units[playerTile[0], playerTile[1]]; List <int[]> previousBlocks = player.GetPreviousBlock(); //Explosive playerStandsOnMine = explosions[playerTile[0], playerTile[1]]; switch (playerStandsOn) { case Boost x: PickupBoost(player, x); break; case Teleporter x: Teleport(player, x); break; default: break; } List <int[]> playerCorners = new List <int[]>(); playerCorners.Add(new int[] { player.x, player.y }); playerCorners.Add(new int[] { player.x, player.y + 14 }); playerCorners.Add(new int[] { player.x + 14, player.y }); playerCorners.Add(new int[] { player.x + 14, player.y + 14 }); foreach (var playerCoordinate in playerCorners) { playerTile = getTile(playerCoordinate[0], playerCoordinate[1]); playerStandsOn = explosions[playerTile[0], playerTile[1]]; Unit playerStandsOnMine = units[playerTile[0], playerTile[1]]; switch (playerStandsOn) { case Explosion x: PlayerExplode(player, time, scoreboard, x.GetOwner()); break; case SuperExplosion x: PlayerExplode(player, time, scoreboard, x.GetOwner()); break; default: break; } switch (playerStandsOnMine) { case Mine x: RegularMineExplosion(player, x, time, GetStillOccupiedBlocks(GetCurrentBlocks(player), previousBlocks)); break; case SuperMine x: SuperMineExplosion(player, x, time, GetStillOccupiedBlocks(GetCurrentBlocks(player), previousBlocks)); break; default: break; } } player.SetPreviousBlock(GetCurrentBlocks(player)); }