예제 #1
0
 protected override void OnCollision(ItemCollision itemCollision)
 {
     itemCollision.Interactive.Position = _Receptor.Position;
     if (_SoundEffect != null)
         _SoundEffect.play(false);
     ClearParts();
 }
예제 #2
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);
        }
 protected override void OnCollision(ItemCollision itemCollision)
 {
     itemCollision.Interactive.Position = _EndOfTheWorld;
     if (_SoundEffect != null)
     {
         _SoundEffect.play(false);
     }
 }
예제 #4
0
 protected override void OnCollision(ItemCollision itemCollision)
 {
     itemCollision.Interactive.Position = _Receptor.Position;
     if (_SoundEffect != null)
     {
         _SoundEffect.play(false);
     }
     ClearParts();
 }
예제 #5
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);
     }
 }
 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);
 }
예제 #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);
 }
예제 #8
0
 protected override void OnCollision(ItemCollision itemCollision)
 {
     itemCollision.Interactive.Momentum += _Collider.Right * _ForceReal;
     _RedArrows.KeepPlaying();
 }
예제 #9
0
 protected override void OnCollision(ItemCollision itemCollision)
 {
     itemCollision.Interactive.Momentum += _Collider.Right * _ForceReal;
     _RedArrows.KeepPlaying();
 }
예제 #10
0
 protected virtual void OnCollision(ItemCollision itemCollision)
 {
 }
예제 #11
0
 protected override void OnCollision(ItemCollision itemCollision)
 {
     itemCollision.Interactive.Position = _EndOfTheWorld;
     if (_SoundEffect != null)
         _SoundEffect.play(false);
 }
예제 #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);
 }
예제 #13
0
 protected virtual void OnCollision(ItemCollision itemCollision)
 {
 }
예제 #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;
 }