public override void Collide(FroggerObject fo, Rectangle intersection) { if (fo is Frog ) { if (intersection.Area() > 0.75f) has_frog=true; if (is_locked && intersection.Area() > 0.25f) { Rectangle locked = new Rectangle(0.0f, 1.0f, 1.0f, 1.0f); locked += rect.loc; if(Rectangle.Area(locked.Intersect(fo.rect))<Rectangle.Area(locked.Intersect(fo.rect + fo.delta))) { fo.delta *= 0.0f; fo.Stop(); } } } }
public override void Collide(FroggerObject fo, Rectangle intersection) { float common_area = intersection.Area() / fo.rect.Area(); if (fo.level == Level.Walking && common_area > 0.75) { fo.MoveBy(this.delta); } else if (fo.level == Level.Floor && common_area > 0.1) { //w coś uderzyliśmy this.colision=true; } }
public override void Collide(FroggerObject fo, Rectangle intersection) { if( fo is Frog && intersection.Area()/rect.Area() > 0.75) { this.Remove(); } }
public override void Collide(FroggerObject fo, Rectangle intersection) { if (fo is Frog && intersection.Area() > 0.50f) { had_frog = true; has_frog = true; } base.Collide(fo, intersection); }
public override void Collide(FroggerObject fo, Rectangle intersection) { if(fo is Frog && intersection.Area()/fo.rect.Area() > 0.75) { this.board.Win(); } }
public override void Collide(FroggerObject fo, Rectangle intersection) { float intersection_area=intersection.Area()/rect.Area(); if (fo.level==Level.Floor && !is_moving && intersection.Area() / rect.Area() > 0.50) { this.Location = fo.Location.Align(this.Location, 1.0f); is_moving = true; } if(fo.level==Level.Floor && intersection_area > 0.10) { this.floor_area+=intersection_area; } }
/// <summary> /// zwraca pole powierzchni r /// jeżeli r jest nullem zraca 0.0f /// </summary> /// <param name="r">prostokąt</param> /// <returns>pole powierzchni r</returns> public static float Area(Rectangle r) { if (r == null) return 0.0f; else return r.Area(); }