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 Path
|
|
|
|
|
{
|
|
|
|
|
private Nodes[] nodes = new Nodes[512];
|
|
|
|
|
private int Count = 0;
|
2020-05-03 16:35:46 +02:00
|
|
|
|
|
|
|
|
|
public void AddNode(Nodes node)
|
|
|
|
|
{
|
|
|
|
|
nodes[Count] = new Nodes(node);
|
|
|
|
|
Count++;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Nodes Reduce()
|
|
|
|
|
{
|
|
|
|
|
Count--;
|
|
|
|
|
Nodes temp = nodes[0];
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < Count; i++)
|
|
|
|
|
{
|
|
|
|
|
nodes[i] = nodes[i + 1];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return temp;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void FlipArray()
|
|
|
|
|
{
|
|
|
|
|
int j = Count;
|
|
|
|
|
Nodes[] temp = nodes;
|
|
|
|
|
for (int i = 0; i < Count; i++)
|
|
|
|
|
{
|
|
|
|
|
nodes[i] = temp[j];
|
|
|
|
|
j--;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Nodes getFinalDest()
|
|
|
|
|
{
|
|
|
|
|
return nodes[Count];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public int getCount()
|
|
|
|
|
{
|
|
|
|
|
return Count;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Nodes getByIndex(int i)
|
|
|
|
|
{
|
|
|
|
|
return nodes[i];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
private int Count = 0;
|
2020-05-03 13:05:05 +02:00
|
|
|
|
private int Cost = 0;
|
|
|
|
|
private int Efficency;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public Nodes getNode(int i)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
return nodes[i];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void setNode(Vector2 newNode)
|
|
|
|
|
{
|
|
|
|
|
nodes[Count] = new Nodes(10, newNode);
|
|
|
|
|
Count++;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Nodes Reduce()
|
|
|
|
|
{
|
|
|
|
|
Count--;
|
|
|
|
|
Nodes temp = nodes[0];
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < Count; i++)
|
|
|
|
|
{
|
|
|
|
|
nodes[i] = nodes[i + 1];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return temp;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Nodes getFinalDest()
|
|
|
|
|
{
|
|
|
|
|
return nodes[Count];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public int getCount()
|
|
|
|
|
{
|
|
|
|
|
return Count;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Nodes getFirst()
|
|
|
|
|
{
|
|
|
|
|
return nodes[0];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Nodes getByIndex(int i)
|
|
|
|
|
{
|
|
|
|
|
return nodes[i];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public int getEfficency()
|
|
|
|
|
{
|
|
|
|
|
return Efficency;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void calculateEfficency()
|
|
|
|
|
{
|
|
|
|
|
for (int i = 0; i < Count; i++)
|
|
|
|
|
{
|
|
|
|
|
Efficency = Efficency + nodes[i].getCost();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public int getCost()
|
|
|
|
|
{
|
|
|
|
|
return Cost;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void setCost(Crops Crop)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2020-05-03 16:35:46 +02:00
|
|
|
|
*/
|
2020-05-03 13:05:05 +02:00
|
|
|
|
}
|