示例#1
0
        public List <Tile> getBoardLOS(Tile origin, Tile destination)
        {
            List <Tile> tileList = new List <Tile>();

            if (origin != null && destination != null)
            {
                List <Point> pointList = PlotLine.GetPointsOnLine(origin.x, origin.y, destination.x, destination.y).ToList();

                tileList.Add(origin);

                if (pointList != null)
                {
                    foreach (var p in pointList)
                    {
                        Tile tempTile = this.getTileFromLocation(p.x, p.y);
                        if (tempTile != origin && tempTile != destination)
                        {
                            if (tempTile.empty)
                            {
                                tileList.Add(tempTile);
                            }
                            else
                            {
                                return(tileList);
                            }
                        }
                    }
                }

                tileList.Add(destination);
            }

            return(tileList);
        }
示例#2
0
        private static bool UseAbilityPoint(GameCharacter character, Ability ability, Tile target, BattleGame game)
        {
            Tile ActiveTile = game.board.getTileFromLocation(character.x, character.y);

            int dist = PlotLine.GetPointsOnLine(character.x, character.y, target.x, target.y).Count() - 1;

            if (dist <= ability.range)
            {
                if (character.SpendAP(ability.ap))
                {
                    return(UseAbilityAOEHelper(character, ability, target, game));
                }
            }
            return(false);
        }
示例#3
0
        //return the tile (or list of tiles) that forms a straight line from the origin, through the target outward, for range tiles
        //using Bresenham Plotline along empty squares)
        public List <Tile> getMoveTargetTileList(Tile origin, Tile target, int range)
        {
            List <Tile> retvalList = new List <Tile>();

            Point        rangedPoint = PlotLine.getRangedPointOnLine(getPointFromTile(origin), getPointFromTile(target), range);
            List <Point> pointList   = PlotLine.GetPointsOnLine(target.x, target.y, rangedPoint.x, rangedPoint.y).ToList();

            foreach (Point p in pointList)
            {
                Tile tempTile = getTileFromPoint(p);
                if (tempTile != null && tempTile.empty)
                {
                    retvalList.Add(tempTile);
                }
            }

            return(retvalList);
        }