コード例 #1
0
        private static List <List <int> > LightDist(P_BattleMap battlemap, List <int> moverange, IEntityActor actor)
        {
            List <List <int> > ReturnValue = new List <List <int> >();

            for (int i = 0; i <= actor.MovementPoints + 1; i++)
            {
                List <int> Range = new List <int>();
                for (int j = 0; j < moverange.Count; j++)
                {
                    if (P_HexPath.GetPath(battlemap.TheMap, battlemap.TheMap.IndexToCube(actor.MyTileIndex), battlemap.TheMap.IndexToCube(moverange[j])).Count == i)
                    {
                        Range.Add(moverange[j]);
                    }
                }
                for (int j = 0; j < Range.Count; j++)
                {
                    moverange.Remove(Range[j]);
                }
                ReturnValue.Add(Range);
            }
            for (int i = 0; i < ReturnValue.Count; i++)
            {
                for (int j = 0; j < ReturnValue[j].Count; j++)
                {
                    moverange.Add(ReturnValue[i][j]);
                }
            }
            return(ReturnValue);
        }
コード例 #2
0
        private List <int> MovementRange(P_BattleMap battlemap, IEntityActor actor)
        {
            List <int> ReturnValue = new List <int>();
            List <int> Check       = new List <int>();

            Check.Add(actor.MyTileIndex);
            while (Check.Count > 0)
            {
                List <int> NeighborsIndex = battlemap.TheMap.TileNeighborsIndex(Check[0]);
                for (int i = 0; i < NeighborsIndex.Count; i++)
                {
                    if (Check.Contains(NeighborsIndex[i]) || ReturnValue.Contains(NeighborsIndex[i]))
                    {
                        continue;
                    }
                    if (battlemap.TheMap.MyTiles[NeighborsIndex[i]].IsTilePassable() == false)
                    {
                        continue;
                    }
                    if (battlemap.TheMap.MyTiles[NeighborsIndex[i]].EntityList.Count > 0)
                    {
                        continue;
                    }
                    List <P_CubeCoords> path = P_HexPath.GetPath(battlemap.TheMap, battlemap.TheMap.IndexToCube(NeighborsIndex[i]), battlemap.TheMap.IndexToCube(actor.MyTileIndex));
                    if (path.Count > actor.MovementPoints + 1)
                    {
                        continue;
                    }

                    Check.Add(NeighborsIndex[i]);
                }
                ReturnValue.Add(Check[0]);
                Check.RemoveAt(0);
            }
            return(ReturnValue);
        }