Beispiel #1
0
 internal static SquarePoint GetNextStep(int pUserX, int pUserY, int pUserTargetX, int pUserTargetY, byte[,] pGameMap, double[,] pHeight, double[,] floorHeight, double[,] sitHeight, int MaxX, int MaxY, bool pUserOverride, bool pDiagonal)
 {
     ModelInfo pMap = new ModelInfo(MaxX, MaxY, pGameMap);
     SquarePoint pTarget = new SquarePoint(pUserTargetX, pUserTargetY, pUserTargetX, pUserTargetY, pMap.GetState(pUserTargetX, pUserTargetY), pUserOverride);
     if (pUserX == pUserTargetX && pUserY == pUserTargetY)
     {
         return pTarget;
     }
     SquareInformation pInfo = new SquareInformation(pUserX, pUserY, pTarget, pMap, pUserOverride, pDiagonal);
     return GetClosetSqare(pInfo, new HeightInfo(MaxX, MaxY, pHeight, floorHeight, sitHeight), pDiagonal);
 }
		public SquareInformation(int pX, int pY, SquarePoint pTarget, ModelInfo pMap, bool pUserOverride, bool CalculateDiagonal)
		{
			this.mX = pX;
			this.mY = pY;
			this.mTarget = pTarget;
			this.mPoint = new SquarePoint(pX, pY, pTarget.X, pTarget.Y, pMap.GetState(pX, pY), pUserOverride);
			this.mPos = new SquarePoint[8];
			if (CalculateDiagonal)
			{
				this.mPos[1] = new SquarePoint(pX - 1, pY - 1, pTarget.X, pTarget.Y, pMap.GetState(pX - 1, pY - 1), pUserOverride);
				this.mPos[3] = new SquarePoint(pX - 1, pY + 1, pTarget.X, pTarget.Y, pMap.GetState(pX - 1, pY + 1), pUserOverride);
				this.mPos[5] = new SquarePoint(pX + 1, pY + 1, pTarget.X, pTarget.Y, pMap.GetState(pX + 1, pY + 1), pUserOverride);
				this.mPos[7] = new SquarePoint(pX + 1, pY - 1, pTarget.X, pTarget.Y, pMap.GetState(pX + 1, pY - 1), pUserOverride);
			}
			this.mPos[0] = new SquarePoint(pX, pY - 1, pTarget.X, pTarget.Y, pMap.GetState(pX, pY - 1), pUserOverride);
			this.mPos[2] = new SquarePoint(pX - 1, pY, pTarget.X, pTarget.Y, pMap.GetState(pX - 1, pY), pUserOverride);
			this.mPos[4] = new SquarePoint(pX, pY + 1, pTarget.X, pTarget.Y, pMap.GetState(pX, pY + 1), pUserOverride);
			this.mPos[6] = new SquarePoint(pX + 1, pY, pTarget.X, pTarget.Y, pMap.GetState(pX + 1, pY), pUserOverride);
		}
Beispiel #3
0
 public SquareInformation(int pX, int pY, SquarePoint pTarget, ModelInfo pMap, bool pUserOverride, bool CalculateDiagonal)
 {
     this.mX      = pX;
     this.mY      = pY;
     this.mTarget = pTarget;
     this.mPoint  = new SquarePoint(pX, pY, pTarget.X, pTarget.Y, pMap.GetState(pX, pY), pUserOverride);
     this.mPos    = new SquarePoint[8];
     if (CalculateDiagonal)
     {
         this.mPos[1] = new SquarePoint(pX - 1, pY - 1, pTarget.X, pTarget.Y, pMap.GetState(pX - 1, pY - 1), pUserOverride);
         this.mPos[3] = new SquarePoint(pX - 1, pY + 1, pTarget.X, pTarget.Y, pMap.GetState(pX - 1, pY + 1), pUserOverride);
         this.mPos[5] = new SquarePoint(pX + 1, pY + 1, pTarget.X, pTarget.Y, pMap.GetState(pX + 1, pY + 1), pUserOverride);
         this.mPos[7] = new SquarePoint(pX + 1, pY - 1, pTarget.X, pTarget.Y, pMap.GetState(pX + 1, pY - 1), pUserOverride);
     }
     this.mPos[0] = new SquarePoint(pX, pY - 1, pTarget.X, pTarget.Y, pMap.GetState(pX, pY - 1), pUserOverride);
     this.mPos[2] = new SquarePoint(pX - 1, pY, pTarget.X, pTarget.Y, pMap.GetState(pX - 1, pY), pUserOverride);
     this.mPos[4] = new SquarePoint(pX, pY + 1, pTarget.X, pTarget.Y, pMap.GetState(pX, pY + 1), pUserOverride);
     this.mPos[6] = new SquarePoint(pX + 1, pY, pTarget.X, pTarget.Y, pMap.GetState(pX + 1, pY), pUserOverride);
 }
Beispiel #4
0
        internal static SquarePoint GetNextStep(int pUserX, int pUserY, int pUserTargetX, int pUserTargetY, byte[,] pGameMap, double[,] pHeight, double[,] floorHeight, double[,] sitHeight, int MaxX, int MaxY, bool pUserOverride, bool pDiagonal)
        {
            ModelInfo   pMap    = new ModelInfo(MaxX, MaxY, pGameMap);
            SquarePoint pTarget = new SquarePoint(pUserTargetX, pUserTargetY, pUserTargetX, pUserTargetY, pMap.GetState(pUserTargetX, pUserTargetY), pUserOverride);

            if (pUserX == pUserTargetX && pUserY == pUserTargetY)
            {
                return(pTarget);
            }
            SquareInformation pInfo = new SquareInformation(pUserX, pUserY, pTarget, pMap, pUserOverride, pDiagonal);

            return(GetClosetSqare(pInfo, new HeightInfo(MaxX, MaxY, pHeight, floorHeight, sitHeight), pDiagonal));
        }