void UpdateTile(ref RenderTileData tile, IntVector3 ml)
{
tile = new RenderTileData(Brushes.Black);
if (!m_map.Bounds.Contains(ml))
{
tile.Brush = Brushes.DarkBlue;
}
else
{
tile.Weight = m_map.GetWeight(ml);
tile.Stairs = m_map.GetStairs(ml);
if (m_nodes != null && m_nodes.ContainsKey(ml))
{
var node = m_nodes[ml];
tile.G = node.G;
tile.H = node.H;
if (node.Parent == null)
tile.From = Direction.None;
else
tile.From = (node.Parent.Loc - node.Loc).ToDirection();
if (m_path != null && m_path.Contains(ml))
tile.Brush = Brushes.DarkGray;
else if (node.Closed)
tile.Brush = Brushes.MidnightBlue;
}
if (m_map.GetBlocked(ml))
{
tile.Brush = Brushes.Blue;
}
else if (m_state > 0 && ml == m_from)
{
tile.Brush = Brushes.Green;
}
else if (m_state > 1 && ml == m_to)
{
tile.Brush = Brushes.Red;
}
}
}