コード例 #1
0
ファイル: Portal.cs プロジェクト: GastonTS/ElElementoPerfecto
 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);
        }
コード例 #3
0
 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);
     }
 }
コード例 #6
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);
 }
コード例 #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
ファイル: Button.cs プロジェクト: GastonTS/ElElementoPerfecto
 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
ファイル: Item.cs プロジェクト: GastonTS/ElElementoPerfecto
 protected virtual void OnCollision(ItemCollision itemCollision)
 {
 }
コード例 #14
0
ファイル: Item.cs プロジェクト: GastonTS/ElElementoPerfecto
 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;
 }