/// <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. }
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."); } }
public override bool CanCollide(IPhysicsBody thisBody, IPhysicsBody otherBody, Ignorer other) { AdvGroupIgnorer value = other as AdvGroupIgnorer; return (value == null || CanCollideInternal(value)); }
/// <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); }
public abstract bool CanCollide(IPhysicsBody thisBody, IPhysicsBody otherBody, Ignorer other);
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); }
private bool CanCollideInternal(IPhysicsBody thisBody, IPhysicsBody otherBody, Ignorer other) { return(isInverted ^ CanCollide(thisBody, otherBody, other)); }
protected Ignorer(Ignorer copy) { this.isInverted = copy.isInverted; }
internal static bool CanCollide(IPhysicsBody leftBody, IPhysicsBody rightBody, Ignorer left, Ignorer right) { return(left.CanCollideInternal(leftBody, rightBody, right)); }
public CollisionIgnorerAdapter(Jypeli.Ignorer adaptee) { this.innerIgnorer = adaptee; }
public void SetCollisionIgnorer(Ignorer ignorer) { this.Body.CollisionIgnorer = new CollisionIgnorerAdapter(ignorer); }