public void Drop(FigureImp dropByFigure, Point tilePosition) { TilePosition = tilePosition; _dropByFigure = dropByFigure; IsActive = true; CurrentBurnTime = 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); }
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); }
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); }
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; } } }
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); }
public void AddFigure(FigureImp figure) { figure.Position = GetWorldStartupPosition(_figures.Count + 1); _figures.Add(figure); }
public Vector2 GetOffsetToTileCenter(FigureImp figure, Point tilePosition) { return(figure.Position - GetWorldFromTilePositionCentered(tilePosition)); }