protected override bool CanCollide(Body thisBody, Body otherBody, Ignorer other)
        {
            AdvGroupIgnorer value = other as AdvGroupIgnorer;

            return
                (value == null ||
                 CanCollideInternal(value));
        }
 public bool CanCollide(AdvGroupIgnorer other)
 {
     if (other == null)
     {
         throw new ArgumentNullException("other");
     }
     return(CanCollideInternal(other));
 }
 private bool CanCollideInternal(AdvGroupIgnorer other)
 {
     return(!GroupCollection.Intersect(ignoredGroups, other.groups));
 }
 protected AdvGroupIgnorer(AdvGroupIgnorer copy)
     : base(copy)
 {
     this.groups = new GroupCollection(copy.groups);
     this.groups = new GroupCollection(copy.ignoredGroups);
 }
Beispiel #5
0
 private bool CanCollideInternal(AdvGroupIgnorer other)
 {
     return !GroupCollection.Intersect(ignoredGroups, other.groups);
 }
Beispiel #6
0
 public bool CanCollide(AdvGroupIgnorer other)
 {
     if (other == null) { throw new ArgumentNullException("other"); }
     return CanCollideInternal(other);
 }
Beispiel #7
0
 protected AdvGroupIgnorer(AdvGroupIgnorer copy)
     : base(copy)
 {
     this.groups = new GroupCollection(copy.groups);
     this.groups = new GroupCollection(copy.ignoredGroups);
 }
Beispiel #8
0
        void DemoA()
        {

            BeginDemoChange();
            Reset(false);
            AddGravityField();
            Body body1IT;
            Body body2IT;
            
            body1IT = AddFloor(new ALVector2D(0, new Vector2D(700, 750)));
            Sprite blockSprite = GetSprite("fighter.png");
            Vector2D[][] vertexes = blockSprite.Polygons;
            MultiPolygonShape shape = new MultiPolygonShape(vertexes, 4);
            shape.Tag = blockSprite;
           //  body1IT = AddShape(shape, 40, new ALVector2D(0, new Vector2D(200, 300)));
             body2IT = AddShape(shape, 40, new ALVector2D(0, new Vector2D(300, 300)));
            AdvGroupIgnorer ignore1 = new AdvGroupIgnorer();
            AdvGroupIgnorer ignore2 = new AdvGroupIgnorer();
            ignore1.IsInverted = true;
            ignore2.IsInverted = true;
            //ignore1.Groups.Add(1);
            //ignore2.IgnoredGroups.Add(1);
            ignore2.Groups.Add(1);
            ignore1.IgnoredGroups.Add(1);
            body1IT.EventIgnorer = ignore1;
            body2IT.EventIgnorer = ignore2;

            body1IT.Collided += new EventHandler<CollisionEventArgs>(body2_Collided);
            //body2IT.Collided += new EventHandler<CollisionEventArgs>(body2_Collided);

            EndDemoChange();
        }