Пример #1
0
        /// <summary>
        /// Creates a new Instance of an Ant.
        /// </summary>
        /// <param name="context">Simulation Context</param>
        /// <param name="faction">Related Faction</param>
        /// <param name="position">Startposition</param>
        /// <param name="orientation">Startorientation</param>
        /// <param name="name">Name of the Ant</param>
        public AntItem(SimulationContext context, AntFaction faction, Vector2 position, Angle orientation, string name)
            : base(context, faction, position, AntRadius, orientation)
        {
            Name = name;

            // Gets the Reference to the walking Property
            walking = GetProperty <WalkingProperty>();
            if (walking == null)
            {
                throw new NotSupportedException("There is no Walking Property");
            }
        }
Пример #2
0
 public AnthillItem(SimulationContext context, AntFaction faction, Vector2 position)
     : base(context, faction, position, HillRadius, Angle.Right)
 {
     var attackable = new AttackableProperty(this);
     if (attackable != null)
     {
         attackable.OnAttackableHealthChanged += (item, value) =>
         {
             // Sollten die Hitpoints unter 0 kommen, ist der Ameisenhügel zerstört
             if (value <= 0)
                 Engine.RemoveItem(this);
         };
     }
 }
Пример #3
0
        public AnthillItem(SimulationContext context, AntFaction faction, Vector2 position)
            : base(context, faction, position, HillRadius, Angle.Right)
        {
            var attackable = new AttackableProperty(this);

            if (attackable != null)
            {
                attackable.OnAttackableHealthChanged += (item, value) =>
                {
                    // Sollten die Hitpoints unter 0 kommen, ist der Ameisenhügel zerstört
                    if (value <= 0)
                    {
                        Engine.RemoveItem(this);
                    }
                };
            }
        }
Пример #4
0
        /// <summary>
        /// Nimmt den heimatlichen Ameisenhügel als Ziel.
        /// </summary>
        public void GoToAnthill()
        {
            Stop();

            // Anthill ermitteln
            AntFaction antFaction = Faction as AntFaction;

            // In Case of wrong Faction
            if (antFaction == null)
            {
                return;
            }

            var target = antFaction.GetClosestAnthill(Item);

            // No Anthill was found
            if (target == null)
            {
                return;
            }

            GoTo(target);
        }
Пример #5
0
 public AntFactoryInterop(AntFaction faction)
     : base(faction)
 {
 }