public static bool TestMoveCollide(IMovable obj1, ISolid obj2) { if (!(obj1 is ISolid)) { return(false); } PointF test_pos = PointOp.Sum( (obj1 as AbstrUnit).Pos, PointOp.Mul(obj1.Direction, obj1.Speed)); return(TestCollide(obj1 as ISolid, obj2, test_pos)); }
public static void Draw(Graphics gr, IDrawable obj, bool always = false) { PointF pointDraw = PointOp.Sub( (obj as AbstrUnit).Pos, Offset - Screen); if (!always && ( pointDraw.X < -1 || pointDraw.X > Screen.Width * 2 + 1 || pointDraw.Y < -1 || pointDraw.Y > Screen.Height * 2 + 1)) { return; } if (obj is AbstrUnit) { obj.Draw(gr, PointOp.Mul(pointDraw, MainGame.CellEdge), MainGame.CellSize); } else { obj.Draw(gr); } }