Beispiel #1
0
 public HeuristicResult(Unit u, Node n, float hv, DamageSkillTarget ds)
 {
     m_DamageValue = hv;
     m_Unit        = u;
     m_Node        = n;
     m_DamageSkill = ds;
 }
Beispiel #2
0
    /// <summary>
    /// Updates the damage 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="damageSkill"></param>
    private void AddOrUpdateHeuristic(float value, Node node, Unit unit, DamageSkillTarget damageSkill)
    {
        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_DamageValue >= value)
            {
                return;
            }

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