Example #1
0
 //------------------------------------------------------------------------------------------------------------------------
 //                                                        HitTest()
 //------------------------------------------------------------------------------------------------------------------------
 public override bool HitTest(Collider other)
 {
     if (other is BoxCollider) {
         Vector2[] c = _owner.GetExtents();
         if (c == null) return false;
         Vector2[] d = ((BoxCollider)other)._owner.GetExtents();
         if (d == null) return false;
         if (!areaOverlap(c, d)) return false;
         return areaOverlap(d, c);
     } else {
         return false;
     }
 }
Example #2
0
 //------------------------------------------------------------------------------------------------------------------------
 //                                                        HitTest()
 //------------------------------------------------------------------------------------------------------------------------
 public virtual bool HitTest(Collider other)
 {
     return false;
 }
Example #3
0
 //------------------------------------------------------------------------------------------------------------------------
 //                                                        GameObject()
 //------------------------------------------------------------------------------------------------------------------------
 /// <summary>
 /// Initializes a new instance of the <see cref="GameObject"/> class.
 /// Since GameObjects contain a display hierarchy, a GameObject can be used as a container for other objects.
 /// Other objects can be added using child commands as AddChild.
 /// </summary>
 public GameObject()
 {
     _collider = createCollider();
     if (Game.main != null) Game.main.Add(this);
 }