public HeuristicResult(Unit u, Node n, float hv, StatusSkillTarget ss) { m_StatusValue = hv; m_Unit = u; m_Node = n; m_StatusSkill = ss; }
/// <summary> /// Updates the skill values of a heuristic result or adds one if it doesn't exist /// </summary> /// <param name="value"></param> /// <param name="node"></param> /// <param name="unit"></param> /// <param name="statusSkill"></param> private void AddOrUpdateHeuristic(float value, Node node, Unit unit, StatusSkillTarget statusSkill) { HeuristicResult hr = FindHeuristic(node, unit); if (hr != null) // If the heuristic already exists, update it { // If the existing heuristic already a better score, move on if (hr.m_StatusValue >= value) { return; } // Otherwise set values hr.m_StatusValue = value; hr.m_StatusSkill = statusSkill; } else // Otherwise create a new heuristic with the values { m_HeuristicResults.Add(new HeuristicResult(unit, node, value, statusSkill)); } }