Example #1
0
        internal SquareInformation(int pX, int pY, SquarePoint pTarget, ModelInfo pMap, bool pUserOverride, bool CalculateDiagonal)
        {
            mX = pX;
            mY = pY;
            mTarget = pTarget;

            mPoint = new SquarePoint(pX, pY, pTarget.X, pTarget.Y, pMap.GetState(pX, pY), pUserOverride);

            //Analyze all the squares arround the user
            mPos = new SquarePoint[8];

            if (CalculateDiagonal)
            {
                mPos[1] = new SquarePoint(pX - 1, pY - 1, pTarget.X, pTarget.Y, pMap.GetState(pX - 1, pY - 1), pUserOverride);
                mPos[3] = new SquarePoint(pX - 1, pY + 1, pTarget.X, pTarget.Y, pMap.GetState(pX - 1, pY + 1), pUserOverride);
                mPos[5] = new SquarePoint(pX + 1, pY + 1, pTarget.X, pTarget.Y, pMap.GetState(pX + 1, pY + 1), pUserOverride);
                mPos[7] = new SquarePoint(pX + 1, pY - 1, pTarget.X, pTarget.Y, pMap.GetState(pX + 1, pY - 1), pUserOverride);
            }

            mPos[0] = new SquarePoint(pX, pY - 1, pTarget.X, pTarget.Y, pMap.GetState(pX, pY - 1), pUserOverride);
            mPos[2] = new SquarePoint(pX - 1, pY, pTarget.X, pTarget.Y, pMap.GetState(pX - 1, pY), pUserOverride);
            mPos[4] = new SquarePoint(pX, pY + 1, pTarget.X, pTarget.Y, pMap.GetState(pX, pY + 1), pUserOverride);
            mPos[6] = new SquarePoint(pX + 1, pY, pTarget.X, pTarget.Y, pMap.GetState(pX + 1, pY), pUserOverride);

            ///456
            //Y3X7
            ///218
            ////X
        }
Example #2
0
        internal static SquarePoint GetNextStep(int pUserX, int pUserY,
            int pUserTargetX, int pUserTargetY,
            byte[,] pGameMap, double[,] pHeight,
            int MaxX, int MaxY,
            bool pUserOverride, bool pDiagonal)
        {
            ModelInfo MapInfo = new ModelInfo(MaxX, MaxY, pGameMap);
            SquarePoint TargetPoint = new SquarePoint(pUserTargetX, pUserTargetY, pUserTargetX, pUserTargetY, MapInfo.GetState(pUserTargetX, pUserTargetY), pUserOverride);
            if (pUserX == pUserTargetX && pUserY == pUserTargetY) //User is allready standing on its target
                return TargetPoint;

            SquareInformation SquareOnUser = new SquareInformation(pUserX, pUserY, TargetPoint, MapInfo, pUserOverride, pDiagonal);

            //if (!TargetPoint.CanWalk)
            //    return SquareOnUser.Point;

            return GetClosetSqare(SquareOnUser, new HeightInfo(MaxX, MaxY, pHeight));
        }