Exemplo n.º 1
0
 /// <summary>
 /// Perform call to "TargetReached(Fruit)" on given ant.
 /// </summary>
 /// <param name="ant">ant</param>
 /// <param name="fruit">fruit</param>
 public static void TargetReached(CoreAnt ant, CoreFruit fruit)
 {
     AreaChanged(
         null,
         new AreaChangeEventArgs(ant.colony.Player, Area.ReachedFruit));
     playerRights.PermitOnly();
     ant.NimmBefehleEntgegen = true;
     try {
         ant.ZielErreichtBase(fruit);
     }
     catch (Exception ex) {
         throw new AiException("KI-Fehler in der ZielErreicht(Obst)-Methode", ex);
     }
     ant.NimmBefehleEntgegen = false;
     AreaChanged(
         null, new AreaChangeEventArgs(null, Area.Unknown));
 }
Exemplo n.º 2
0
        /// <summary>
        /// Perform call to "TargetReached(Sugar)" on given ant.
        /// </summary>
        /// <param name="ant">ant</param>
        /// <param name="sugar">sugar</param>
        public static void TargetReached(CoreAnt ant, CoreSugar sugar)
        {
            AreaChanged(
                null,
                new AreaChangeEventArgs(ant.colony.Player, Area.ReachedSugar));
            playerRights.PermitOnly();
            ant.NimmBefehleEntgegen = true;
            try
            {
                ant.ZielErreichtBase(sugar);
            }
            catch (Exception ex)
            {
                throw new AiException(string.Format("{0}: KI-Fehler in der ZielErreicht(Zucker)-Methode", ant.colony.Player.Guid), ex);
            }

            ant.NimmBefehleEntgegen = false;
            AreaChanged(
                null, new AreaChangeEventArgs(null, Area.Unknown));
        }