Clone() public method

public Clone ( ) : GPRectangle
return GPRectangle
Exemplo n.º 1
0
        public GPArea(Vector3 startingLocation)
        {
            StartingLocation=startingLocation;

            //Creation and Cache base
            centerGPRect = new GPRectangle(startingLocation, 5);
            GPRectangle centerClone = centerGPRect.Clone();

            //Get all valid points (besides current point) from our current location GPR
            GridPoint[] SearchPoints = centerGPRect.Points.Keys.Where(gp => !gp.Ignored).ToArray();
            gridpointrectangles_ = new List<GPRectangle>();
            if (SearchPoints.Length > 1)
            {

                Vector3 LastSearchVector3 = FunkyGame.Navigation.LastSearchVector;
                // LastSearchVector3.Normalize();

                //we should check our surrounding points to see if we can even move into any of them first!
                for (int i = 1; i < SearchPoints.Length - 1; i++)
                {
                    GridPoint curGP = SearchPoints[i];
                    Vector3 thisV3 = (Vector3)curGP;
                    //thisV3.Normalize();

                    //Its a valid point for direction testing!
                    float DirectionDegrees = Navigation.FindDirection(LastSearchVector3, thisV3);
                    DirectionPoint P = new DirectionPoint((Vector3)curGP, DirectionDegrees, 125f);

                    if (P.Range > 5f)
                    {
                        gridpointrectangles_.Add(new GPRectangle(P, centerGPRect));
                    }
                }
                gridpointrectangles_.Add(centerClone);
                gridpointrectangles_ = gridpointrectangles_.OrderByDescending(gpr => gpr.Count).ToList();
            }
        }
Exemplo n.º 2
0
        public GPArea(Vector3 startingLocation)
        {
            StartingLocation = startingLocation;

            //Creation and Cache base
            centerGPRect = new GPRectangle(startingLocation, 5);
            GPRectangle centerClone = centerGPRect.Clone();

            //Get all valid points (besides current point) from our current location GPR
            GridPoint[] SearchPoints = centerGPRect.Points.Keys.Where(gp => !gp.Ignored).ToArray();
            gridpointrectangles_ = new List <GPRectangle>();
            if (SearchPoints.Length > 1)
            {
                Vector3 LastSearchVector3 = FunkyGame.Navigation.LastSearchVector;
                // LastSearchVector3.Normalize();

                //we should check our surrounding points to see if we can even move into any of them first!
                for (int i = 1; i < SearchPoints.Length - 1; i++)
                {
                    GridPoint curGP  = SearchPoints[i];
                    Vector3   thisV3 = (Vector3)curGP;
                    //thisV3.Normalize();

                    //Its a valid point for direction testing!
                    float          DirectionDegrees = Navigation.FindDirection(LastSearchVector3, thisV3);
                    DirectionPoint P = new DirectionPoint((Vector3)curGP, DirectionDegrees, 125f);

                    if (P.Range > 5f)
                    {
                        gridpointrectangles_.Add(new GPRectangle(P, centerGPRect));
                    }
                }
                gridpointrectangles_.Add(centerClone);
                gridpointrectangles_ = gridpointrectangles_.OrderByDescending(gpr => gpr.Count).ToList();
            }
        }