//------------------------------------------------------------------------------------------------------------------------ // 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; } }
//------------------------------------------------------------------------------------------------------------------------ // HitTest() //------------------------------------------------------------------------------------------------------------------------ public virtual bool HitTest(Collider other) { return false; }
//------------------------------------------------------------------------------------------------------------------------ // 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); }