示例#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);
     }));
 }
        private FigureImp CreatePlayerFigure()
        {
            var figure = new FigureImp(Id)
            {
                FigureController = Session.GetFigureController(PlayerIndex)
            };

            return(figure);
        }
        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));
 }