protected override void OnCollision(ItemCollision itemCollision)
 {
     itemCollision.Interactive.Position = _Receptor.Position;
     if (_SoundEffect != null)
         _SoundEffect.play(false);
     ClearParts();
 }
        public ItemCollision Collide(Interactive interactive)
        {
            if (this == interactive)
            {
                return(null);
            }
            var collisions = new List <Collision>();

            foreach (var c in _Colliders)
            {
                foreach (var ic in interactive._Colliders)
                {
                    var collision = c.Collide(ic);
                    if (collision != null)
                    {
                        collisions.Add(collision);
                    }
                }
            }
            if (collisions.Count == 0)
            {
                return(null);
            }
            var itemCollision = new ItemCollision(this, interactive, collisions.ToArray());

            OnCollision(itemCollision);
            return(itemCollision);
        }
 protected override void OnCollision(ItemCollision itemCollision)
 {
     itemCollision.Interactive.Position = _EndOfTheWorld;
     if (_SoundEffect != null)
     {
         _SoundEffect.play(false);
     }
 }
 protected override void OnCollision(ItemCollision itemCollision)
 {
     itemCollision.Interactive.Position = _Receptor.Position;
     if (_SoundEffect != null)
     {
         _SoundEffect.play(false);
     }
     ClearParts();
 }
 protected override void OnCollision(ItemCollision itemCollision)
 {
     if (_RelatedItem != null &&
         itemCollision.AnyNormalDotVector(_Collider.Top, dot => dot.Abs().TolerantEquals(1)))
     {
         _RelatedItem.Signal(_Signal);
     }
     if (_SoundEffect != null)
     {
         _SoundEffect.play(false);
     }
 }
 public ItemContactState(ItemCollision itemCollision, Collision collision, Contact contact, Int32 timesReacted)
 {
     Interactive = itemCollision.Interactive;
     TimesReacted = timesReacted;
     Collision = collision;
     Contact = contact;
     Point = contact.PointB;
     Radius = Point - Interactive.Position;
     Normal = contact.NormalAB;
     Velocity = Interactive.GetVelocityAt(Radius);
     Approach = -Vector3.Dot(Normal, Velocity);
     Momentum = Interactive.GetForceAt(Radius);
     Weight = -Vector3.Dot(Normal, Momentum);
     Orthonormal = Normal.Orthonormal(Velocity);
 }
Exemple #7
0
 public ItemContactState(ItemCollision itemCollision, Collision collision, Contact contact, Int32 timesReacted)
 {
     Interactive  = itemCollision.Interactive;
     TimesReacted = timesReacted;
     Collision    = collision;
     Contact      = contact;
     Point        = contact.PointB;
     Radius       = Point - Interactive.Position;
     Normal       = contact.NormalAB;
     Velocity     = Interactive.GetVelocityAt(Radius);
     Approach     = -Vector3.Dot(Normal, Velocity);
     Momentum     = Interactive.GetForceAt(Radius);
     Weight       = -Vector3.Dot(Normal, Momentum);
     Orthonormal  = Normal.Orthonormal(Velocity);
 }
Exemple #8
0
 protected override void OnCollision(ItemCollision itemCollision)
 {
     itemCollision.Interactive.Momentum += _Collider.Right * _ForceReal;
     _RedArrows.KeepPlaying();
 }
 protected override void OnCollision(ItemCollision itemCollision)
 {
     itemCollision.Interactive.Momentum += _Collider.Right * _ForceReal;
     _RedArrows.KeepPlaying();
 }
 protected virtual void OnCollision(ItemCollision itemCollision)
 {
 }
 protected override void OnCollision(ItemCollision itemCollision)
 {
     itemCollision.Interactive.Position = _EndOfTheWorld;
     if (_SoundEffect != null)
         _SoundEffect.play(false);
 }
Exemple #12
0
 protected override void OnCollision(ItemCollision itemCollision)
 {
     if (_RelatedItem != null
     && itemCollision.AnyNormalDotVector(_Collider.Top, dot => dot.Abs().TolerantEquals(1)))
     {
         _RelatedItem.Signal(_Signal);
     }
     if (_SoundEffect != null)
         _SoundEffect.play(false);
 }
Exemple #13
0
 protected virtual void OnCollision(ItemCollision itemCollision)
 {
 }
Exemple #14
0
 public ItemCollision Collide(Interactive interactive)
 {
     if (this == interactive) return null;
     var collisions = new List<Collision>();
     foreach (var c in _Colliders)
         foreach (var ic in interactive._Colliders)
         {
             var collision = c.Collide(ic);
             if (collision != null)
                 collisions.Add(collision);
         }
     if (collisions.Count == 0) return null;
     var itemCollision = new ItemCollision(this, interactive, collisions.ToArray());
     OnCollision(itemCollision);
     return itemCollision;
 }