示例#1
0
 public HeuristicResult(Unit u, Node n, float hv, HealSkillTarget hs)
 {
     m_HealValue = hv;
     m_Unit      = u;
     m_Node      = n;
     m_HealSkill = hs;
 }
示例#2
0
    /// <summary>
    /// Updates the heal 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="healSkill"></param>
    private void AddOrUpdateHeuristic(float value, Node node, Unit unit, HealSkillTarget healSkill)
    {
        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_HealValue >= value)
            {
                return;
            }

            // Otherwise set values
            hr.m_HealValue = value;
            hr.m_HealSkill = healSkill;
        }
        else         // Otherwise create a new heuristic with the values
        {
            m_HeuristicResults.Add(new HeuristicResult(unit, node, value, healSkill));
        }
    }