Exemplo n.º 1
0
        private void ParseField(string rawField)
        {
            rawField = rawField.Substring(6);
            int size = (int)Math.Sqrt(rawField.Length);

            if (MapSize != size)
            {
                Map     = new BombermanBlocks[size, size];
                MapSize = size;
            }

            int rawPosition = 0;

            for (int j = 0; j < size; j++)
            {
                for (int i = 0; i < size; i++)
                {
                    Map[i, j] = CharToBlock(rawField[rawPosition]);

                    if (IsPlayerCoords(Map[i, j]))
                    {
                        PlayerX = i;
                        PlayerY = j;
                    }

                    rawPosition++;
                }
            }

            OnUpdate?.Invoke();
        }
Exemplo n.º 2
0
 private static bool IsBlock(BombermanBlocks block) =>
 block == BombermanBlocks.Wall ||
 block == BombermanBlocks.WallDestroyable ||
 block == BombermanBlocks.MeatChopper ||
 block == BombermanBlocks.BombTimer1 ||
 block == BombermanBlocks.BombTimer2 ||
 block == BombermanBlocks.BombTimer3 ||
 block == BombermanBlocks.BombTimer4 ||
 block == BombermanBlocks.BombTimer5 ||
 block == BombermanBlocks.OtherBomberman ||
 block == BombermanBlocks.OtherBombBomberman;
Exemplo n.º 3
0
 protected bool IsPlayerCoords(BombermanBlocks block) => block == BombermanBlocks.Bomberman ||
 block == BombermanBlocks.BombBomberman ||
 block == BombermanBlocks.DeadBomberman;