Esempio n. 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
        }
Esempio n. 2
0
        internal static SquarePoint GetNextStep(int pUserX, int pUserY, double pUserZ,
            int pUserTargetX, int pUserTargetY,
            byte[,] pGameMap, Stackmap pHeight, short[,] pHeightmap,
            int MaxX, int MaxY,
            bool pUserOverride, bool pDiagonal, Gamemap gamemap)
        {
            ModelInfo MapInfo = new ModelInfo(MaxX, MaxY, pGameMap);
            SquarePoint TargetPoint = new SquarePoint(pUserTargetX, pUserTargetY, pUserZ, pUserTargetX, pUserTargetY, MapInfo.GetState(pUserTargetX, pUserTargetY), pUserOverride, pHeight);
            if (pUserX == pUserTargetX && pUserY == pUserTargetY)
                return TargetPoint;

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

            return GetClosetSqare(SquareOnUser, new HeightInfo(MaxX, MaxY, pHeight, pHeightmap), pUserZ, gamemap, pUserOverride);
        }
Esempio n. 3
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)));
        }
Esempio n. 4
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
        }
Esempio n. 5
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));
        }