public Portal(GDGameScreen scrn, PortalBlueprint blueprint) : base(scrn, GDConstants.ORDER_GAME_PORTAL) { var pos = new FPoint(blueprint.X, blueprint.Y); Normal = FloatMath.DegreesToRadians * blueprint.Normal; VecNormal = Vector2.UnitX.Rotate(Normal); Length = blueprint.Length; VecDirection = VecNormal.RotateWithLength(FloatMath.RAD_POS_090, blueprint.Length / 2f); Color = COLORS[blueprint.Group]; _group = blueprint.Group; _side = blueprint.Side; Position = pos; DrawingBoundingBox = new Vector2(Length, 0).Rotate(Normal + FloatMath.RAD_POS_090).ToAbsFSize().AtLeast(WIDTH, WIDTH); this.GDOwner().GDBackground.RegisterBlockedLine(pos - Vector2.UnitX.RotateWithLength(Normal + FloatMath.RAD_POS_090, Length / 2f), pos + Vector2.UnitX.RotateWithLength(Normal + FloatMath.RAD_POS_090, Length / 2f)); _rectFull = FRectangle.CreateByCenter(pos, Length, WIDTH); _rectHorizon = FRectangle.CreateByCenter(pos + VecNormal.WithLength(WIDTH / 4f), Length, WIDTH / 2f); _rectGradient = FRectangle.CreateByCenter(pos + VecNormal.WithLength(WIDTH / 2f), Length, WIDTH); _rectDropTop = FRectangle.CreateByCenter(pos - VecDirection.WithLength(Length / 2f), 24, 16); _rectDropMid = FRectangle.CreateByCenter(pos, 24, Length - 16); _rectDropBot = FRectangle.CreateByCenter(pos + VecDirection.WithLength(Length / 2f), 24, 16); }
private void DrawPortal(PortalBlueprint p) { var x = p.X / 64; var y = p.Y / 64; var l = p.Length / 64; var r = p.Normal + 90; DrawLine(x, y, l, r, '&'); }
public Portal(GDGameScreen scrn, PortalBlueprint blueprint) : base(scrn, GDConstants.ORDER_GAME_PORTAL) { var pos = new FPoint(blueprint.X, blueprint.Y); Normal = FloatMath.DegreesToRadians * blueprint.Normal; VecNormal = Vector2.UnitX.Rotate(Normal); Length = blueprint.Length; VecDirection = VecNormal.RotateWithLength(FloatMath.RAD_POS_090, blueprint.Length / 2f); Color = COLORS[blueprint.Group]; _group = blueprint.Group; _side = blueprint.Side; Position = pos; DrawingBoundingBox = new Vector2(Length, 0).Rotate(Normal + FloatMath.RAD_POS_090).ToAbsFSize().AtLeast(WIDTH, WIDTH); this.GDOwner().GDBackground.RegisterBlockedLine(pos - Vector2.UnitX.RotateWithLength(Normal + FloatMath.RAD_POS_090, Length / 2f), pos + Vector2.UnitX.RotateWithLength(Normal + FloatMath.RAD_POS_090, Length / 2f)); _renderRects = CommonObstacleRenderer.CreatePortalRenderRects(pos, VecNormal, VecDirection, Length); }