Пример #1
0
 /// <summary>
 /// Luo uuden tyhjän rakenteen.
 /// </summary>
 public PhysicsStructure()
 {
     centerObject = new PhysicsObject(1, 1)
     {
         IgnoresPhysicsLogics = true, IsVisible = false
     };
     objects             = new List <PhysicsObject>();
     Joints              = new List <IAxleJoint>();
     _collisionIgnorer   = new ObjectIgnorer();
     AssociatedListeners = new List <Listener>();
     AddedToGame        += AddJoints;
     Removed            += RemoveJoints;
     Add(centerObject); // Tämä pitää lisätä, sillä muuten jossain tilanteissa structuren ensimmäinen kappale pyörii keskiakselinsa ympäri.
 }
Пример #2
0
        public void SetCollisionIgnorer(Ignorer ignorer)
        {
            if (ignorer is null)
            {
                FSBody.JypeliGroupIgnorer = null;
                FSBody.ObjectIgnorer      = null;
                return;
            }

            if (ignorer is JypeliGroupIgnorer)
            {
                JypeliGroupIgnorer ign = ignorer as JypeliGroupIgnorer;
                FSBody.JypeliGroupIgnorer = ign;
            }
            else if (ignorer is ObjectIgnorer || ignorer is null)
            {
                ObjectIgnorer ign = ignorer as ObjectIgnorer;
                FSBody.ObjectIgnorer = ign;
            }
            else
            {
                throw new NotImplementedException("Annettu Ignore ei ole toteutettu.");
            }
        }
Пример #3
0
        public override bool CanCollide(IPhysicsBody thisBody, IPhysicsBody otherBody, Ignorer other)
        {
            AdvGroupIgnorer value = other as AdvGroupIgnorer;

            return
                (value == null ||
                 CanCollideInternal(value));
        }
Пример #4
0
 /// <summary>
 /// Voivatko kappaleet törmätä toisiinsa
 /// </summary>
 /// <param name="thisBody"></param>
 /// <param name="otherBody"></param>
 /// <param name="other"></param>
 /// <returns></returns>
 public override bool CanCollide(IPhysicsBody thisBody, IPhysicsBody otherBody, Ignorer other)
 {
     return(other != this);
 }
Пример #5
0
 public abstract bool CanCollide(IPhysicsBody thisBody, IPhysicsBody otherBody, Ignorer other);
Пример #6
0
        public override bool CanCollide(IPhysicsBody thisBody, IPhysicsBody otherBody, Ignorer other)
        {
            JypeliGroupIgnorer jOther = other as JypeliGroupIgnorer;

            if (jOther == null)
            {
                return(true);
            }

            return((this.LegacyGroup == 0 || jOther.LegacyGroup == 0 || this.LegacyGroup != jOther.LegacyGroup) && (this.IgnoreMask & jOther.IgnoreMask) == 0);
        }
Пример #7
0
 private bool CanCollideInternal(IPhysicsBody thisBody, IPhysicsBody otherBody, Ignorer other)
 {
     return(isInverted ^ CanCollide(thisBody, otherBody, other));
 }
Пример #8
0
 protected Ignorer(Ignorer copy)
 {
     this.isInverted = copy.isInverted;
 }
Пример #9
0
 internal static bool CanCollide(IPhysicsBody leftBody, IPhysicsBody rightBody, Ignorer left, Ignorer right)
 {
     return(left.CanCollideInternal(leftBody, rightBody, right));
 }
Пример #10
0
 public CollisionIgnorerAdapter(Jypeli.Ignorer adaptee)
 {
     this.innerIgnorer = adaptee;
 }
Пример #11
0
 public void SetCollisionIgnorer(Ignorer ignorer)
 {
     this.Body.CollisionIgnorer = new CollisionIgnorerAdapter(ignorer);
 }