예제 #1
0
 public void Drop(FigureImp dropByFigure, Point tilePosition)
 {
     TilePosition    = tilePosition;
     _dropByFigure   = dropByFigure;
     IsActive        = true;
     CurrentBurnTime = 0;
 }
예제 #2
0
 public bool HitByFire(FigureImp figure)
 {
     return(CollideHandle(figure, (p, c) =>
     {
         var f = (ExplosionFragmentImp)GetOverlayData(p);
         return f.IsActive && c.Intersects(f.Bounds);
     }));
 }
예제 #3
0
        private FigureImp CreatePlayerFigure()
        {
            var figure = new FigureImp(Id)
            {
                FigureController = Session.GetFigureController(PlayerIndex)
            };

            return(figure);
        }
예제 #4
0
        private FigureImp CreateComputerFigure(LevelImp level)
        {
            var comFigureController = new ComFigureController(level);
            var figure = new FigureImp(Id)
            {
                FigureController = comFigureController
            };

            comFigureController.Figure = figure;
            return(figure);
        }
예제 #5
0
        public Bomb PlaceBomb(FigureImp figure)
        {
            var position = GetTilePositionFromWorld(figure.Position);

            if (!HasBomb(position))
            {
                var b = new BombImp(PullId(), figure.ActiveBombType);
                _bombs.Add(b);
                b.Drop(figure, position);
                return(b);
            }
            return(null);
        }
예제 #6
0
        public bool MayCollectItem(FigureImp figure, out ItemImp item)
        {
            var possibleItem = GetItemData(GetTilePositionFromWorld(figure.Position));

            if (possibleItem.IsActive)
            {
                item = (ItemImp)possibleItem;
                return(true);
            }

            item = null;
            return(false);
        }
예제 #7
0
        public void ProvideItemsOf(FigureImp figure)
        {
            if (figure.CollectedItems.Count == 0)
            {
                return;
            }

            var freeFields = GetFreeFields();

            foreach (var item in figure.CollectedItems)
            {
                DropOfType(item, freeFields);
                if (freeFields.Count == 0)
                {
                    break;
                }
            }
        }
예제 #8
0
        private bool CollideHandle(FigureImp figure, Func <Point, Circle, bool> collisionCheck)
        {
            var currentTile  = GetTilePositionFromWorld(figure.Position);
            var playerCircle = figure.CircleBounds;

            for (var x = currentTile.X - 1; x <= currentTile.X + 1; x++)
            {
                for (var y = currentTile.Y - 1; y <= currentTile.Y + 1; y++)
                {
                    if (collisionCheck(new Point(x, y), playerCircle))
                    {
                        return(true);
                    }
                }
            }

            return(false);
        }
예제 #9
0
 public void AddFigure(FigureImp figure)
 {
     figure.Position = GetWorldStartupPosition(_figures.Count + 1);
     _figures.Add(figure);
 }
예제 #10
0
 public Vector2 GetOffsetToTileCenter(FigureImp figure, Point tilePosition)
 {
     return(figure.Position - GetWorldFromTilePositionCentered(tilePosition));
 }