示例#1
0
文件: PathNode.cs 项目: kayorga/3DSP
 public PathNode(PathNode prev, int X, int Y, Point goal, float constantG)
 {
     this.mapX = X; this.mapY = Y;
     this.hCosts = Math.Max(Math.Abs(goal.X - this.mapX), Math.Abs(goal.Y - this.mapY));
     this.previousNode = prev;
     if (this.previousNode == null) this.gCosts = constantG;
     else this.gCosts = this.previousNode.G + constantG;
     this.fCosts = this.hCosts + this.gCosts;
     //worldPosition = new Vector3(X * -2.0f/3.0f + Constants.MAP_SIZE - 1, 0, -2.0f * Y / 3.0f + Constants.MAP_SIZE - 1);
     worldPosition = new Vector3(X * -1.0f + Constants.MAP_SIZE - 1, 0, -1.0f * Y + Constants.MAP_SIZE - 1);
 }
示例#2
0
文件: PathNode.cs 项目: kayorga/3DSP
        public bool Equals(PathNode node2)
        {
            // If parameter is null return false:
            if ((object)node2 == null)
            {
                return false;
            }

            // Return true if the fields match:
            return (X == node2.X) && (Y == node2.Y);
        }
示例#3
0
文件: PathNode.cs 项目: kayorga/3DSP
 public void replaceAndUpdateValues(PathNode betterNode)
 {
     this.previousNode = betterNode.PreviousNode;
     this.gCosts = betterNode.G;
     this.fCosts = betterNode.F;
 }