/// <summary> /// Lisää uuden törmäyksenvälttelyryhmän. /// </summary> /// <param name="group">Ryhmän numero (indeksi).</param> public void AddCollisionIgnoreGroup(int group) { var groupIgnorer = CollisionIgnorer as JypeliGroupIgnorer; if (groupIgnorer == null) { CollisionIgnorer = groupIgnorer = new JypeliGroupIgnorer(); } groupIgnorer.AddGroup(group); }
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); }
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."); } }
/// <summary> /// Poistaa kaikki törmäysryhmät, jolloin olio saa törmäillä vapaasti. /// </summary> public void ClearCollisionIgnoreGroups() { CollisionIgnorer = new JypeliGroupIgnorer(); }