Ejemplo n.º 1
0
        private void InitItem(Vector2 carrier1, Vector2 portable1, Vector2?carrier2, Vector2?portable2)
        {
            Item1       = new DebugCarrierItem(carrier1);
            Moving1     = Item1.GetProperty <WalkingProperty>();
            Collidable1 = Item1.GetProperty <CollidableProperty>();
            Carrier1    = Item1.GetProperty <CarrierProperty>();

            Item3       = new DebugPortableItem(portable1);
            Moving3     = Item3.GetProperty <WalkingProperty>();
            Collidable3 = Item3.GetProperty <CollidableProperty>();
            Portable3   = Item3.GetProperty <PortableProperty>();


            if (carrier2.HasValue)
            {
                Item2       = new DebugCarrierItem(carrier2.Value);
                Moving2     = Item2.GetProperty <WalkingProperty>();
                Collidable2 = Item2.GetProperty <CollidableProperty>();
                Carrier2    = Item2.GetProperty <CarrierProperty>();
            }

            if (portable2.HasValue)
            {
                Item4       = new DebugPortableItem(portable2.Value);
                Moving4     = Item4.GetProperty <WalkingProperty>();
                Collidable4 = Item4.GetProperty <CollidableProperty>();
                Portable4   = Item4.GetProperty <PortableProperty>();
            }
        }
Ejemplo n.º 2
0
        public DebugWalkingItem(ITypeResolver resolver, Vector2 pos)
            : base(resolver, pos, Angle.Right)
        {
            moving = new WalkingProperty(this, 5);

            AddProperty(moving);
        }
Ejemplo n.º 3
0
 public ClassicBugItem(SimulationContext context, Vector2 position, Angle orientation)
     : base(context, position, BugRadius, orientation)
 {
     walking = GetProperty <WalkingProperty>();
     if (walking == null)
     {
         throw new NotSupportedException("Classic Bug does not have a Walking Property");
     }
 }
 public void CleanupEngine()
 {
     Item1       = null;
     Moving1     = null;
     Collidable1 = null;
     Item2       = null;
     Moving2     = null;
     Collidable2 = null;
     Map         = null;
     Engine      = null;
 }
Ejemplo n.º 5
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");
            }
        }
        private void InitItem(Vector2 pos1, Vector2?pos2)
        {
            Item1       = new DebugCollisionItem(new Vector2(pos1.X, pos1.Y));
            Moving1     = Item1.GetProperty <WalkingProperty>();
            Collidable1 = Item1.GetProperty <CollidableProperty>();

            if (pos2.HasValue)
            {
                Item2       = new DebugCollisionItem(new Vector2(pos2.Value.X, pos2.Value.Y));
                Moving2     = Item2.GetProperty <WalkingProperty>();
                Collidable2 = Item2.GetProperty <CollidableProperty>();
            }
        }
Ejemplo n.º 7
0
        public PhysicsUnit(Item item, Dictionary <int, PhysicsUnit> items)
        {
            this.item  = item;
            this.items = items;
            moving     = item.GetProperty <WalkingProperty>();
            collidable = item.GetProperty <CollidableProperty>();
            carrier    = item.GetProperty <CarrierProperty>();
            portable   = item.GetProperty <PortableProperty>();

            map = item.Engine.Map;

            mapSize = map.GetSize();

            // Attach Item Stuff
            item.CellChanged += item_CellChanged;

            // Attach Moving Stuff
            if (moving != null)
            {
                moving.OnMaximumMoveSpeedChanged += moving_OnMaximumMoveSpeedChanged;
                moving.OnMoveDirectionChanged    += moving_OnMoveDirectionChanged;
                moving.OnMoveSpeedChanged        += moving_OnMoveSpeedChanged;
                moving.MoveMalus = 1;
            }

            // Attach Collision Stuff
            if (collidable != null)
            {
                collidable.OnCollisionMassChanged  += collidable_OnCollisionMassChanged;
                collidable.OnCollisionFixedChanged += collidable_OnCollisionFixedChanged;
            }

            // Attach Carrier Stuff
            if (carrier != null)
            {
                carrier.OnCarrierLoadChanged     += carrier_OnCarrierLoadChanged;
                carrier.OnCarrierStrengthChanged += carrier_OnCarrierStrengthChanged;
            }

            // Attach Portable Stuff
            if (portable != null)
            {
                portable.OnPortableWeightChanged += portable_OnPortableMassChanged;
                portable.OnNewCarrierItem        += portable_OnNewCarrierItem;
                portable.OnLostCarrierItem       += portable_OnLostCarrierItem;
                clusterUnits = new HashSet <PhysicsUnit>();
            }

            Recalc();
        }
Ejemplo n.º 8
0
        /// <summary>
        /// Default Constructor for the Type Mapper.
        /// </summary>
        /// <param name="faction">Faction</param>
        /// <param name="item">Item</param>
        /// <param name="interop">UnitInterop</param>
        public AntMovementInterop(Faction faction, FactionItem item, UnitInterop interop) : base(faction, item, interop)
        {
            // Get Walking Property
            walking = Item.GetProperty <WalkingProperty>();
            if (walking == null)
            {
                throw new NotSupportedException("There is no Walking Property");
            }

            // Get Collision Property
            collidable = Item.GetProperty <CollidableProperty>();
            if (collidable == null)
            {
                throw new NotSupportedException("There is no Collidable Property");
            }

            // Handle Collisions with Walls and Borders.
            walking.OnHitBorder += (i, v) => { if (OnHitWall != null)
                                               {
                                                   OnHitWall(v);
                                               }
            };
            walking.OnHitWall += (i, v) => { if (OnHitWall != null)
                                             {
                                                 OnHitWall(v);
                                             }
            };

            // Kollisionen mit anderen Items füllt die Liste der Kollisionsitems
            // und prüft, ob es sich beim getroffenen Item um das Ziel handelt.
            collidable.OnCollision += (i, v) =>
            {
                // Zur Liste der kollidierten Items hinzufügen.
                collidedItems.Add(v.GetItemInfo(Item));

                // Prüfen, ob es sich um das aktuelle Ziel handelt.
                if (CurrentDestination != null &&
                    Item == Item.GetItemFromInfo(CurrentDestination))
                {
                    // Alles anhalten und Reach melden
                    Stop();
                    if (OnTargetReched != null)
                    {
                        OnTargetReched(i.GetItemInfo(Item));
                    }
                }
            };
        }
Ejemplo n.º 9
0
 public void CleanupEngine()
 {
     Item1       = null;
     Moving1     = null;
     Collidable1 = null;
     Carrier1    = null;
     Item2       = null;
     Moving2     = null;
     Collidable2 = null;
     Carrier2    = null;
     Item3       = null;
     Moving3     = null;
     Collidable3 = null;
     Portable3   = null;
     Item4       = null;
     Moving4     = null;
     Collidable4 = null;
     Portable4   = null;
     Map         = null;
     Engine      = null;
 }
        public void MovingVsNonCollision()
        {
            InitItem(new Vector2(50, 100), null);
            Item2   = new DebugWalkingItem(new Vector2(150, 100));
            Moving2 = Item2.GetProperty <WalkingProperty>();
            InitFlat(true);

            Collidable1.OnCollision += (i, v) =>
            {
                collision1++;
            };

            float distance = new Vector2(2, 2).Length();

            // Kollision X-Achse
            Move(new Vector2(97, 100), new Vector2(97 + distance, 100), Angle.Right,
                 new Vector2(103, 100), new Vector2(103 - distance, 100), Angle.Left);
            CheckCollisionEvents(0, 0, 0);

            // Kollision Y-Achse
            Move(new Vector2(100, 97), new Vector2(100, 97 + distance), Angle.Down,
                 new Vector2(100, 103), new Vector2(100, 103 - distance), Angle.Up);
            CheckCollisionEvents(0, 0, 0);
        }
Ejemplo n.º 11
0
 private void InitItem(Vector2 pos)
 {
     Item    = new DebugWalkingItem(new Vector2(pos.X, pos.Y));
     Walking = Item.GetProperty <WalkingProperty>();
 }
Ejemplo n.º 12
0
        protected override void RequestDraw()
        {
            if (_level != null)
            {
                DrawPlayground(_level.Map.GetCellCount(), _level.Map.Tiles);

                foreach (var item in _level.Items)
                {
                    float?bodySpeed       = null;
                    float?bodyDirection   = null;
                    float?bodyRadius      = null;
                    float?smellableRadius = null;
                    float?viewRange       = null;
                    float?viewAngle       = null;
                    float?viewDirection   = null;
                    float?attackRange     = null;

                    // Movement
                    if (item.ContainsProperty <WalkingProperty>())
                    {
                        WalkingProperty prop = item.GetProperty <WalkingProperty>();
                        bodySpeed     = prop.Speed;
                        bodyDirection = prop.Direction;
                    }

                    // Kollisionsradius
                    if (item.ContainsProperty <CollidableProperty>())
                    {
                        CollidableProperty prop = item.GetProperty <CollidableProperty>();
                        bodyRadius = prop.CollisionRadius;
                    }

                    // Sicht
                    if (item.ContainsProperty <SightingProperty>())
                    {
                        SightingProperty prop = item.GetProperty <SightingProperty>();
                        viewRange     = prop.ViewRange;
                        viewDirection = prop.ViewDirection.Radian;
                        viewAngle     = prop.ViewAngle;
                    }

                    // Attack
                    if (item.ContainsProperty <AttackerProperty>())
                    {
                        AttackerProperty prop = item.GetProperty <AttackerProperty>();
                        attackRange = prop.AttackRange;
                    }

                    // Stinkender radius
                    if (item.ContainsProperty <SmellableProperty>())
                    {
                        SmellableProperty prop = item.GetProperty <SmellableProperty>();
                        smellableRadius = prop.SmellableRadius;
                    }

                    Color color       = Color.Gray;
                    Color?borderColor = null;

                    // Farbe
                    if (item is AnthillItem)
                    {
                        color = Color.Brown;
                    }
                    else if (item is SugarItem)
                    {
                        color = Color.White;
                    }
                    else if (item is AppleItem)
                    {
                        color = Color.LightGreen;
                    }
                    else if (item is BugItem)
                    {
                        color = Color.Blue;
                    }
                    else if (item is AntItem)
                    {
                        color = Color.LightGray;
                        AntItem ant = item as AntItem;
                        switch (ant.PlayerIndex)
                        {
                        case 0: borderColor = Color.Orange; break;

                        case 1: borderColor = Color.Red; break;

                        case 2: borderColor = Color.Yellow; break;

                        case 3: borderColor = Color.Green; break;

                        case 4: borderColor = Color.Blue; break;

                        case 5: borderColor = Color.Purple; break;

                        case 6: borderColor = Color.White; break;

                        case 7: borderColor = Color.Black; break;
                        }
                    }
                    else if (item is MarkerItem)
                    {
                        color = Color.LightGray;
                        MarkerItem marker = item as MarkerItem;
                        switch (marker.PlayerIndex)
                        {
                        case 0: borderColor = Color.Orange; break;

                        case 1: borderColor = Color.Red; break;

                        case 2: borderColor = Color.Yellow; break;

                        case 3: borderColor = Color.Green; break;

                        case 4: borderColor = Color.Blue; break;

                        case 5: borderColor = Color.Purple; break;

                        case 6: borderColor = Color.White; break;

                        case 7: borderColor = Color.Black; break;
                        }
                    }

                    // Malen
                    DrawItem(item.Id, item.Position,
                             bodyRadius, bodyDirection, bodySpeed, color,
                             viewRange, viewDirection, viewAngle,
                             attackRange, smellableRadius, borderColor);
                }
            }
        }
Ejemplo n.º 13
0
        protected override void RequestDraw()
        {
            if (_engine != null)
            {
                DrawPlayground(_engine.Map.GetCellCount(), _engine.Map.Tiles);

                foreach (var item in _engine.Items)
                {
                    float?bodySpeed       = null;
                    float?bodyDirection   = null;
                    float?bodyRadius      = null;
                    float?smellableRadius = null;
                    float?viewRange       = null;
                    float?viewAngle       = null;
                    float?viewDirection   = null;
                    float?attackRange     = null;

                    // Movement
                    if (item.ContainsProperty <WalkingProperty>())
                    {
                        WalkingProperty prop = item.GetProperty <WalkingProperty>();
                        bodySpeed     = prop.Speed;
                        bodyDirection = prop.Direction;
                    }

                    // Kollisionsradius
                    if (item.ContainsProperty <CollidableProperty>())
                    {
                        CollidableProperty prop = item.GetProperty <CollidableProperty>();
                        bodyRadius = prop.CollisionRadius;
                    }

                    // Sicht
                    if (item.ContainsProperty <SightingProperty>())
                    {
                        SightingProperty prop = item.GetProperty <SightingProperty>();
                        viewRange     = prop.ViewRange;
                        viewDirection = prop.ViewDirection.Radian;
                        viewAngle     = prop.ViewAngle;
                    }

                    // Attack
                    if (item.ContainsProperty <AttackerProperty>())
                    {
                        AttackerProperty prop = item.GetProperty <AttackerProperty>();
                        attackRange = prop.AttackRange;
                    }

                    // Stinkender radius
                    if (item.ContainsProperty <SmellableProperty>())
                    {
                        SmellableProperty prop = item.GetProperty <SmellableProperty>();
                        smellableRadius = prop.SmellableRadius;
                    }

                    DrawItem(item.Id, item.Position,
                             bodyRadius, bodyDirection, bodySpeed, Color.White,
                             viewRange, viewDirection, viewAngle,
                             attackRange, smellableRadius, null);
                }
            }
        }
Ejemplo n.º 14
0
        /// <summary>
        /// Registers classic Bugs
        /// </summary>
        /// <param name="typeMapper">Type Mapper</param>
        /// <param name="settings">Settings</param>
        private void RegisterClassicBug(ITypeMapper typeMapper, KeyValueStore settings)
        {
            // Classic Bug
            typeMapper.RegisterItem <ClassicBugItem, BugState, BugInfo>(this, "Classic Bug");

            // Walking
            settings.Set <ClassicBugItem>("MaxSpeed", 2f, "Maximum Speed of a Classic Bug");
            typeMapper.AttachItemProperty <ClassicBugItem, WalkingProperty>(this, "Classic Bug Walking", (i) =>
            {
                WalkingProperty property = new WalkingProperty(i);

                // Set Walking Speed
                property.MaximumSpeed = i.Settings.GetFloat <ClassicBugItem>("MaxSpeed").Value;

                // Bind Direction to the Items Orientation
                property.Direction    = i.Orientation;
                i.OrientationChanged += (item, v) => { property.Direction = v; };

                return(property);
            });

            // Collision
            settings.Set <ClassicBugItem>("Mass", 10f, "Collision Mass of a Classic Bug");
            typeMapper.AttachItemProperty <ClassicBugItem, CollidableProperty>(this, "Classic Bug Collidable", (i) =>
            {
                CollidableProperty property = new CollidableProperty(i);

                // Set Collision Mass
                property.CollisionFixed = false;
                property.CollisionMass  = i.Settings.GetFloat <ClassicBugItem>("Mass").Value;

                // Bind Collision Radius to the Item Radius
                property.CollisionRadius = i.Radius;
                i.RadiusChanged         += (item, v) => { property.CollisionRadius = v; };

                return(property);
            });

            // Visibility
            typeMapper.AttachItemProperty <ClassicBugItem, VisibleProperty>(this, "Classic Bug Visible", (i) =>
            {
                VisibleProperty property = new VisibleProperty(i);

                // Bind Visibility Radius to the Item Radius
                property.VisibilityRadius = i.Radius;
                i.RadiusChanged          += (item, v) => { property.VisibilityRadius = v; };

                return(property);
            });

            // Sighting
            settings.Set <ClassicBugItem>("ViewRange", 20f, "View Range of a Classic Bug");
            settings.Set <ClassicBugItem>("ViewAngle", 360, "View Angle of a Classic Bug");
            typeMapper.AttachItemProperty <ClassicBugItem, SightingProperty>(this, "Classic Bug Sighting", (i) =>
            {
                SightingProperty property = new SightingProperty(i);

                // Set View Range and Angle
                property.ViewRange = i.Settings.GetFloat <ClassicBugItem>("ViewRange").Value;
                property.ViewAngle = i.Settings.GetFloat <ClassicBugItem>("ViewAngle").Value;

                // Bind View Direction to the Item Orientation
                property.ViewDirection = i.Orientation;
                i.OrientationChanged  += (item, v) => { property.ViewDirection = v; };

                return(property);
            });

            // Sniffer
            typeMapper.AttachItemProperty <ClassicBugItem, SnifferProperty>(this, "Classic Bug Sniffer");

            // Attackable
            settings.Set <ClassicBugItem>("MaxHealth", 1000, "Maximum Health of a Classic Bug");
            typeMapper.AttachItemProperty <ClassicBugItem, AttackableProperty>(this, "Classic Bug Attackable", (i) =>
            {
                AttackableProperty property = new AttackableProperty(i);

                // Bind Attackable Radius to Item Radius
                property.AttackableRadius = i.Radius;
                i.RadiusChanged          += (item, v) => { property.AttackableRadius = v; };

                // Health
                property.AttackableMaximumHealth = settings.GetInt <ClassicBugItem>("MaxHealth").Value;
                property.AttackableHealth        = settings.GetInt <ClassicBugItem>("MaxHealth").Value;

                return(property);
            });

            // Attacker
            settings.Set <ClassicBugItem>("AttackRange", 5f, "Attack Range for a Classic Bug");
            settings.Set <ClassicBugItem>("RecoveryTime", 5, "Recovery Time in Rounds for a Classic Bug");
            settings.Set <ClassicBugItem>("AttackStrength", 10, "Attach Strength for a Classic Bug");
            typeMapper.AttachItemProperty <ClassicBugItem, AttackerProperty>(this, "Classic Bug Attacker", (i) =>
            {
                AttackerProperty property   = new AttackerProperty(i);
                property.AttackRange        = i.Settings.GetFloat <ClassicBugItem>("AttackRange").Value;
                property.AttackRecoveryTime = i.Settings.GetInt <ClassicBugItem>("RecoveryTime").Value;
                property.AttackStrength     = i.Settings.GetInt <ClassicBugItem>("AttackStrength").Value;
                return(property);
            });
        }
 private void InitItem(Vector2 pos)
 {
     Item = new DebugWalkingItem(new Vector2(pos.X, pos.Y));
     Walking = Item.GetProperty<WalkingProperty>();
 }
Ejemplo n.º 16
0
        /// <summary>
        /// Registers Ants
        /// </summary>
        /// <param name="typeMapper">Type Mapper</param>
        /// <param name="settings">Settings</param>
        private void RegisterAnt(ITypeMapper typeMapper, KeyValueStore settings)
        {
            // Ant Item
            settings.Set <AntItem>("ZickZackAngle", 10, "Correction Angle after Sprint");
            settings.Set <AntItem>("ZickZackRange", 30f, "Distance to go every Sprint");
            settings.Set <AntItem>("RotationSpeed", 20, "Maximum Rotation Angle per Round");
            settings.Set <AntItem>("DropSugar", false, "Will an Ant leave a small Sugar on Drop");
            settings.Set <AntItem>("MarkerDelay", 10, "Time in Rounds between Marker-Drops");
            typeMapper.RegisterItem <AntItem, AntState, AntInfo>(this, "Ant");

            // Walking
            settings.Set <AntItem>("MaxSpeed", 1f, "Maximum Speed of an Ant");
            typeMapper.AttachItemProperty <AntItem, WalkingProperty>(this, "Ant Walking", (i) =>
            {
                WalkingProperty property = new WalkingProperty(i);

                // Set Maximum Speed based on the current Settings
                // TODO: Check for Castes
                property.MaximumSpeed = i.Settings.GetFloat <AntItem>("MaxSpeed").Value;

                // Bind Item Orientation to Walk-Direction
                property.Direction    = i.Orientation;
                i.OrientationChanged += (item, v) => { property.Direction = v; };

                return(property);
            });

            // Collision
            settings.Set <AntItem>("Mass", 1f, "Collision Mass of an Ant");
            typeMapper.AttachItemProperty <AntItem, CollidableProperty>(this, "Ant Collidable", (i) =>
            {
                CollidableProperty property = new CollidableProperty(i);

                // Set Mass to Settings
                property.CollisionFixed = false;
                property.CollisionMass  = i.Settings.GetFloat <AntItem>("Mass").Value;

                // Bind Collision Radius to Item Radius
                property.CollisionRadius = i.Radius;
                i.RadiusChanged         += (item, v) => { property.CollisionRadius = v; };

                return(property);
            });

            // Visibility
            typeMapper.AttachItemProperty <AntItem, VisibleProperty>(this, "Ant Visible", (i) =>
            {
                VisibleProperty property = new VisibleProperty(i);

                // Bind Visibility Radius to the Item Radius
                property.VisibilityRadius = i.Radius;
                i.RadiusChanged          += (item, v) => { property.VisibilityRadius = v; };

                return(property);
            });

            // Sighting
            settings.Set <AntItem>("ViewRange", 20f, "View Range of an Ant");
            settings.Set <AntItem>("ViewAngle", 360, "View Angle of an Ant");
            typeMapper.AttachItemProperty <AntItem, SightingProperty>(this, "Ant Sighting", (i) =>
            {
                SightingProperty property = new SightingProperty(i);

                // Set View Range and Angle
                property.ViewRange = i.Settings.GetFloat <AntItem>("ViewRange").Value;
                property.ViewAngle = i.Settings.GetFloat <AntItem>("ViewAngle").Value;

                // Bind View Direction to the Item Orientation
                property.ViewDirection = i.Orientation;
                i.OrientationChanged  += (item, v) => { property.ViewDirection = v; };

                return(property);
            });

            // Sniffer
            typeMapper.AttachItemProperty <AntItem, SnifferProperty>(this, "Ant Sniffer");

            // Carrier
            settings.Set <AntItem>("CarrierStrength", 10f, "Carrier Strength of an Ant");
            typeMapper.AttachItemProperty <AntItem, CarrierProperty>(this, "Ant Carrier", (i) =>
            {
                CarrierProperty property = new CarrierProperty(i);
                property.CarrierStrength = i.Settings.GetFloat <AntItem>("CarrierStrength").Value;
                return(property);
            });

            // Attackable
            settings.Set <AntItem>("MaxHealth", 100f, "Maximum Health for an Ant");
            typeMapper.AttachItemProperty <AntItem, AttackableProperty>(this, "Ant Attackable", (i) =>
            {
                AttackableProperty property = new AttackableProperty(i);

                // Bind Attackable Radius to Item Radius
                property.AttackableRadius = i.Radius;
                i.RadiusChanged          += (item, v) => { property.AttackableRadius = v; };

                // Health
                property.AttackableMaximumHealth = settings.GetInt <AntItem>("MaxHealth").Value;
                property.AttackableHealth        = settings.GetInt <AntItem>("MaxHealth").Value;

                return(property);
            });

            // Attacker
            settings.Set <AntItem>("AttackRange", 3f, "Attack Range for a Bug");
            settings.Set <AntItem>("RecoveryTime", 2, "Recovery Time in Rounds for a Bug");
            settings.Set <AntItem>("AttackStrength", 5, "Attach Strength for a Bug");
            typeMapper.AttachItemProperty <AntItem, AttackerProperty>(this, "Ant Attacker", (i) =>
            {
                AttackerProperty property   = new AttackerProperty(i);
                property.AttackRange        = i.Settings.GetFloat <AntItem>("AttackRange").Value;
                property.AttackRecoveryTime = i.Settings.GetInt <AntItem>("RecoveryTime").Value;
                property.AttackStrength     = i.Settings.GetInt <AntItem>("AttackStrength").Value;
                return(property);
            });

            // Collector
            settings.Set <AntItem>("SugarCapacity", 5, "Maximum Capacity for Sugar");
            settings.Set <AntItem>("AppleCapacity", 2, "Maximum Capacity for Apple");
            typeMapper.AttachItemProperty <AntItem, SugarCollectorProperty>(this, "Ant Sugar Collectable", (i) =>
            {
                SugarCollectorProperty property = new SugarCollectorProperty(i);
                property.Capacity = i.Settings.GetInt <AntItem>("SugarCapacity").Value;
                return(property);
            });
            typeMapper.AttachItemProperty <AntItem, AppleCollectorProperty>(this, "Ant Apple Collectable", (i) =>
            {
                AppleCollectorProperty property = new AppleCollectorProperty(i);
                property.Capacity = i.Settings.GetInt <AntItem>("AppleCapacity").Value;
                return(property);
            }); // TODO: Optional, wenn _settings.ANT_APPLECOLLECT | _settings.ANT_APPLE_CAPACITY, 0);
        }
        private void InitItem(Vector2 pos1, Vector2? pos2)
        {
            Item1 = new DebugCollisionItem(new Vector2(pos1.X, pos1.Y));
            Moving1 = Item1.GetProperty<WalkingProperty>();
            Collidable1 = Item1.GetProperty<CollidableProperty>();

            if (pos2.HasValue)
            {
                Item2 = new DebugCollisionItem(new Vector2(pos2.Value.X, pos2.Value.Y));
                Moving2 = Item2.GetProperty<WalkingProperty>();
                Collidable2 = Item2.GetProperty<CollidableProperty>();
            }
        }
        public void MovingVsNonCollision()
        {
            InitItem(new Vector2(50, 100), null);
            Item2 = new DebugWalkingItem(new Vector2(150, 100));
            Moving2 = Item2.GetProperty<WalkingProperty>();
            InitFlat(true);

            Collidable1.OnCollision += (i, v) =>
            {
                collision1++;
            };

            float distance = new Vector2(2, 2).Length();

            // Kollision X-Achse
            Move(new Vector2(97, 100), new Vector2(97 + distance, 100), Angle.Right,
                new Vector2(103, 100), new Vector2(103 - distance, 100), Angle.Left);
            CheckCollisionEvents(0, 0, 0);

            // Kollision Y-Achse
            Move(new Vector2(100, 97), new Vector2(100, 97 + distance), Angle.Down,
                new Vector2(100, 103), new Vector2(100, 103 - distance), Angle.Up);
            CheckCollisionEvents(0, 0, 0);
        }
 public void CleanupEngine()
 {
     Item1 = null;
     Moving1 = null;
     Collidable1 = null;
     Item2 = null;
     Moving2 = null;
     Collidable2 = null;
     Map = null;
     Engine = null;
 }