예제 #1
0
        /// <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);
        }
예제 #2
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);
        }
예제 #3
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.");
            }
        }
예제 #4
0
 /// <summary>
 /// Poistaa kaikki törmäysryhmät, jolloin olio saa törmäillä vapaasti.
 /// </summary>
 public void ClearCollisionIgnoreGroups()
 {
     CollisionIgnorer = new JypeliGroupIgnorer();
 }