public void OnConnectionsCreated(PathfindingNode source)
{
if (!this.initialised && !generatedOnLoadTime)
{
double currTime =
new TimeSpan(DateTime.UtcNow.Ticks).TotalMilliseconds ;
// For each node we can make a connection to
CustomArrayList<PathfindingNode> connectedNodes = this.GetConnectedNodes();
for( int i = 0; i < connectedNodes.Count(); i++){
if (connectedNodes.ElementAt(i) is Node)
{
Node connectedNode = (Node)connectedNodes.ElementAt(i);
// Scedule it for reprocessing
if (currTime - connectedNode.lastConnectionCreateTime > 5000)
{
// Remove its current nodes
connectedNode.RemoveAllConnections();
connectedNode.lastConnectionCreateTime = currTime;
SmartPathfindingNodeProcessor.GetInstance().Push(connectedNode);
}
}
// Console.Out.WriteLine("Re-sceduled a node!");
}
this.initialised = true;
}
lastConnectionCreateTime = new TimeSpan(DateTime.UtcNow.Ticks).TotalMilliseconds;
}