/// <summary>
        /// reik perdaryt sita dali
        /// </summary>
        /// <param name="coordinates"></param>
        public bool HitMapObj(Coordinates coordinates)
        {
            Map map = Map.GetInstance;
            List <MapObject> Objects = map.getMapContainer()[coordinates.PosX, coordinates.PosY];

            foreach (var mapObject in Objects)
            {
                if (mapObject is Player)
                {
                    Player player = mapObject as Player;
                    Visitor.visit(player);
                    PlayerHitAdapter.Hit(player);
                }
                else if (mapObject is Wall)
                {
                    Wall wall = mapObject as Wall;
                    Visitor.visit(wall, CompositeExplosion);
                    return(false);
                }
                else if (mapObject is Bomb)
                {
                    Bomb bomb = mapObject as Bomb;
                    Visitor.visit(bomb, CompositeExplosion);
                    MapManagerStub.CreateExplosion(coordinates, CompositeExplosion);
                    return(true);
                }
                else
                {
                }
            }
            MapManagerStub.CreateExplosion(coordinates, CompositeExplosion);
            return(true);
        }
예제 #2
0
        public void visit(Player player)
        {
            PlayerHitAdapter playerHitAdapter = new PlayerHitAdapter();

            playerHitAdapter.Hit(player);
        }