예제 #1
0
        public Point[] GetRandamPanel(
            int many,
            Panel.COLOR union,
            bool underchara,
            CharacterBase character,
            bool hole)
        {
            SceneBattle    parent    = character.parent;
            List <Point>   pointList = new List <Point>();
            List <int>     intList   = new List <int>();
            List <Vector3> source    = new List <Vector3>();

            if (union == Panel.COLOR.blue)
            {
                for (int x = parent.panel.GetLength(0) - 1; x >= 0; --x)
                {
                    for (int y = 0; y < parent.panel.GetLength(1); ++y)
                    {
                        if (parent.panel[x, y].color == union && (hole || !parent.panel[x, y].Hole))
                        {
                            if (underchara)
                            {
                                source.Add(new Vector3(x, y, this.RandomSeedUse() % 100));
                            }
                            else if (!parent.OnPanelCheck(x, y, false))
                            {
                                source.Add(new Vector3(x, y, this.RandomSeedUse() % 100));
                            }
                        }
                    }
                }
            }
            else
            {
                for (int x = 0; x < parent.panel.GetLength(0); ++x)
                {
                    for (int y = 0; y < parent.panel.GetLength(1); ++y)
                    {
                        if (parent.panel[x, y].color == union && (hole || !parent.panel[x, y].Hole))
                        {
                            if (underchara)
                            {
                                source.Add(new Vector3(x, y, this.RandomSeedUse() % 100));
                            }
                            else if (!parent.OnPanelCheck(x, y, false))
                            {
                                source.Add(new Vector3(x, y, this.RandomSeedUse() % 100));
                            }
                        }
                    }
                }
            }
            List <Vector3> list  = source.OrderByDescending <Vector3, float>(n => n.Z).ToList <Vector3>();
            int            index = 0;

            while (pointList.Count < many)
            {
                pointList.Add(new Point((int)list[index].X, (int)list[index].Y));
                ++index;
                if (index >= list.Count)
                {
                    index = 0;
                }
            }
            return(pointList.ToArray());
        }