Beispiel #1
0
 public bool MindEquals(IMind mind1, IMind mind2)
 {
     if (mind1.GetType() == mind2.GetType())
     {
         bool returnvalue = true;
         if (mind1.GetType() == typeof(Gathering))
         {
             Gathering gather  = (Gathering)mind1;
             Gathering gather2 = (Gathering)mind2;
             if (!(gather.prefferedType == gather2.prefferedType &&
                   gather.prefferedDirection == gather2.prefferedDirection &&
                   gather.carryWeight == gather2.carryWeight &&
                   gather.IsScout == gather2.IsScout))
             {
                 returnvalue = false;
             }
         }
         if (mind1.GetType() == typeof(CombatMind))
         {
             CombatMind combat  = (CombatMind)mind1;
             CombatMind combat2 = (CombatMind)mind2;
             if (!(combat.GetMinEstimatedDifference() == combat2.GetMinEstimatedDifference() &&
                   combat.GetPrefferedHealth() == combat2.GetPrefferedHealth()))
             {
                 returnvalue = false;
             }
         }
         return(returnvalue);
     }
     return(false);
 }
    internal void GenerateMind()
    {
        gather = (Gathering)mindGroup.Minds.Find(mind => mind.GetType() == typeof(Gathering));
        if (gather == null)
        {
            gather = new Gathering();
            mindGroup.Minds.Add(gather);
        }

        combat = (CombatMind)mindGroup.Minds.Find(mind => mind.GetType() == typeof(CombatMind));
        if (combat == null)
        {
            combat = new CombatMind();
            mindGroup.Minds.Add(combat);
        }

        UpdateResourceValues(gather.carryWeight, gather.IsScout, gather.prefferedType, gather.prefferedDirection);

        UpdateCombatValues(combat.GetMinEstimatedDifference(), combat.GetPrefferedHealth());
    }