/// <summary> /// Calls the appropriate check function against the type of the inputted collider. /// </summary> /// <param name="collider">The collider to check against</param> /// <returns>Returns true if a collision occurred</returns> public virtual bool CheckCollisionWith(Collider collider) { RectangleCollider rectangleCollider = collider as RectangleCollider; if (rectangleCollider != null) { return CheckCollisionWith(rectangleCollider); } Debug.Fail("Checking against an unknown collider."); return false; }
/// <summary> /// By default adds a RectangleCollider for this object if it's bool UsesCollider is set to true. /// Can be overridden to add custom colliders instead. /// </summary> protected virtual void AddCollider() { Collider = new RectangleCollider(this); }