PotatoPlan/Game1/Sources/Pathing/A-Star/PathSaver/Nodes.cs

97 lines
1.6 KiB
C#
Raw Normal View History

2020-05-03 13:05:05 +02:00
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Graphics;
class Nodes
{
2020-05-03 16:35:46 +02:00
private int F = 0;
private int G = 0;
private int H = 0;
private Vector2 Coordinates;
private Nodes Parent = null;
2020-05-03 23:40:40 +02:00
private int Direction = 0;
2020-05-03 13:05:05 +02:00
2020-05-03 16:35:46 +02:00
public Nodes(Vector2 coordinates)
2020-05-03 13:05:05 +02:00
{
2020-05-03 16:35:46 +02:00
Coordinates = coordinates;
2020-05-03 13:05:05 +02:00
}
2020-05-03 23:40:40 +02:00
public Nodes(Vector2 coordinates, int direction)
{
Coordinates = coordinates;
Direction = direction;
}
public Nodes(Nodes node)
2020-05-03 13:05:05 +02:00
{
2020-05-03 16:35:46 +02:00
F = node.F;
G = node.G;
H = node.H;
Coordinates = node.Coordinates;
Parent = node.Parent;
2020-05-03 13:05:05 +02:00
}
2020-05-03 16:35:46 +02:00
public Nodes(int f, int g, int h, Vector2 coordinates, Nodes parent)
2020-05-03 13:05:05 +02:00
{
2020-05-03 16:35:46 +02:00
F = f;
G = g;
H = h;
Coordinates = coordinates;
Parent = parent;
}
public Vector2 getCords()
{
return Coordinates;
}
public int getF()
{
return F;
}
public int getG()
{
return G;
}
public int getH()
{
return H;
}
public void calculateF()
{
F = G + H;
}
public void setG(int g)
{
G = g;
}
public void setH(int h)
{
H = h;
}
public Nodes getParent()
{
return Parent;
}
public void setParent(Nodes parent)
{
Parent = parent;
2020-05-03 13:05:05 +02:00
}
2020-05-03 23:40:40 +02:00
public int getDirection()
{
return Direction;
}
}