本文整理汇总了C#中Circle类的典型用法代码示例。如果您正苦于以下问题:C# Circle类的具体用法?C# Circle怎么用?C# Circle使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Circle类属于命名空间,在下文中一共展示了Circle类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnCreate
public override void OnCreate(GameObject obj)
{
if (Missile == null)
{
Position = CastArgs.End;
}
else
{
Position = Missile.EndPosition;
StartMissilePos = Missile.Position;
}
PrimaryCircle = new Circle
{
Radius = SpellData.Radius,
BorderWidth = 3,
Color = Color.White
};
SecondaryCircle = new Circle
{
Radius = 10,
Color = Color.LawnGreen
};
}
示例2: Main
static void Main()
{
var shapes = new Shape[numberOfShapes];
for (int i = 0; i < shapes.Length; i++)
{
switch (vladoRandoma.Next() % 3)
{
case 0:
shapes[i] = new Triangle(widths[vladoRandoma.Next(0, widths.Length)],
heights[vladoRandoma.Next(0, heights.Length)]);
break;
case 1: shapes[i] = new Rectangle(widths[vladoRandoma.Next(0, widths.Length)],
heights[vladoRandoma.Next(0, heights.Length)]);
break;
case 2: shapes[i] = new Circle(heights[vladoRandoma.Next(0, heights.Length)]);
break;
default:
break;
}
}
foreach (var item in shapes)
{
Console.WriteLine(item.ToString().Replace(',', '.'));
}
}
示例3: CanStructureBePlaced
public bool CanStructureBePlaced(Point location, int size, Unit builder, bool cutCorners)
{
List<PathNode> placingStructurePathNodes = new List<PathNode>();
Circle collisionCircle = new Circle(new Vector2(location.X * Map.TileSize + (size / 2) * Map.TileSize, location.Y * Map.TileSize + (size / 2) * Map.TileSize), size * Map.TileSize);
//placingStructureCenterPoint = collisionCircle.CenterPoint;
for (int x = location.X; x < location.X + size; x++)
{
for (int y = location.Y; y < location.Y + size; y++)
{
PathNode node = Rts.pathFinder.PathNodes[(int)MathHelper.Clamp(y, 0, Map.Height - 1), (int)MathHelper.Clamp(x, 0, Map.Width - 1)];
if (collisionCircle.Intersects(node.Tile))
{
placingStructurePathNodes.Add(node);
}
}
}
// remove corners
if (cutCorners)
{
placingStructurePathNodes.Remove(Rts.pathFinder.PathNodes[location.Y, location.X]);
if (location.X + size <= Map.Width - 1)
placingStructurePathNodes.Remove(Rts.pathFinder.PathNodes[location.Y, location.X + size - 1]);
else
return false;
if (location.Y + size <= Map.Height - 1)
placingStructurePathNodes.Remove(Rts.pathFinder.PathNodes[location.Y + size - 1, location.X]);
else
return false;
placingStructurePathNodes.Remove(Rts.pathFinder.PathNodes[location.Y + size - 1, location.X + size - 1]);
}
foreach (PathNode node in placingStructurePathNodes)
{
if (!node.Tile.Walkable || node.Blocked)
return false;
if (node.UnitsContained.Count > 0)
{
if (node.UnitsContained.Count == 1 && node.UnitsContained.ElementAt<Unit>(0) == builder)
continue;
else
{
bool allow = true;
foreach (Unit unit in node.UnitsContained)
{
if (unit.Team != builder.Team)
{
allow = false;
break;
}
}
if (!allow)
return false;
}
}
}
return true;
}
示例4: Intersects
/// <summary>
/// Determines if a circle intersects a circle.
/// </summary>
/// <returns>True if the circle and circle overlap. False otherwise.</returns>
public bool Intersects(Circle circle)
{
float dist = Vector2.Distance(Center, circle.Center);
float minDist = Radius + circle.Radius;
return dist <= minDist;
}
示例5: CircleSegmentIntersection
/// <summary>
/// Create a new intersection between a segment and a circle.
/// </summary>
/// <param name="i">The point of intersection.</param>
/// <param name="c">The circle.</param>
/// <param name="s">The segment.</param>
public CircleSegmentIntersection(Point i, Circle c, Segment s)
: base()
{
intersect = i;
circle = c;
segment = s;
}
示例6: DoClick
public void DoClick(Circle circle)
{
if (Physics.CircleCicleCollision(circle, GaucheCercle) && Valeur > Min)
Valeur = Math.Max(Min, Valeur - Increment);
else if (Physics.CircleCicleCollision(circle, DroiteCercle) && Valeur < Max)
Valeur = Math.Min(Max, Valeur + Increment);
}
示例7: PP
public static Point2d PP(Object object_i, Object object_j, Circle circle)
{
if (object_i is Circle)
{
Circle circle_i = object_i as Circle;
if (object_j is Circle)
{
Circle circle_j = object_j as Circle;
return PlacingPoint.Calc(new Circle() { X = circle_i.X, Y = circle_i.Y, R = circle_i.R + circle.R }, new Circle() { X = circle_j.X, Y = circle_j.Y, R = circle_j.R + circle.R });
}
else
{
StripLine strip_line_j = object_j as StripLine;
return PlacingPoint.Calc(new Circle() { X = circle_i.X, Y = circle_i.Y, R = circle_i.R + circle.R }, new StripLine() { PX = strip_line_j.PX + strip_line_j.VY * circle.R, PY = strip_line_j.PY - strip_line_j.VX * circle.R, VX = strip_line_j.VX, VY = strip_line_j.VY });
}
}
else
{
StripLine strip_line_i = object_i as StripLine;
if (object_j is Circle)
{
Circle circle_j = object_j as Circle;
return PlacingPoint.Calc(new StripLine() { PX = strip_line_i.PX + strip_line_i.VY * circle.R, PY = strip_line_i.PY - strip_line_i.VX * circle.R, VX = strip_line_i.VX, VY = strip_line_i.VY }, new Circle() { X = circle_j.X, Y = circle_j.Y, R = circle_j.R + circle.R });
}
else
{
StripLine strip_line_j = object_j as StripLine;
return PlacingPoint.Calc(new StripLine() { PX = strip_line_i.PX + strip_line_i.VY * circle.R, PY = strip_line_i.PY - strip_line_i.VX * circle.R, VX = strip_line_i.VX, VY = strip_line_i.VY }, new StripLine() { PX = strip_line_j.PX + strip_line_j.VY * circle.R, PY = strip_line_j.PY - strip_line_j.VX * circle.R, VX = strip_line_j.VX, VY = strip_line_j.VY });
}
}
}
示例8: Player
public Player()
: base()
{
ID = "player";
PlayerEventCallback = null;
_lastEvent = PlayerEvent.None;
RenderLayer = Render_Layer;
RenderDepth = Render_Depth;
_mapBounds = Rectangle.Empty;
CollisionBoundingCircle = new Circle(Vector2.Zero, Body_Collision_Radius);
Collidable = true;
Visible = true;
_motionEngine = new PlayerMotionEngine();
MotionEngine = _motionEngine;
_isSmashingSmashBlocks = false;
_hasTouchedGoalFlag = false;
IsExitingLevel = false;
LastRaceRestartPointTouched = null;
TutorialStepTrigger = null;
ResetCollisionFlags();
}
示例9: Initialize
public void Initialize()
{
int size = 75;
innercircle = new Circle(new Vector2(100 , screen.Height / options.ScaleFactor - 25), content.Load<Texture2D>("Img/Game/LSIC"), size, size);
System.Threading.Thread.Sleep(10);
outercircle = new Circle(new Vector2(100, screen.Height / options.ScaleFactor - 25), content.Load<Texture2D>("Img/Game/LSOC"), size, size);
}
示例10: Main
private static void Main()
{
var circle = new Circle(5);
Console.WriteLine(circle);
var rect = new Rectangle(2, 3);
Console.WriteLine(rect);
}
示例11: CelestialBodyExplosion
public CelestialBodyExplosion()
{
Handler = new IntegerHandler(CheckEnemiesHit);
Output = new Dictionary<int, Enemy>();
CelestialBodyRectangle = new PhysicalRectangle();
CelestiablBodyRange = new Circle(Vector3.Zero, 0);
}
示例12: PowerUpSpawner
public PowerUpSpawner(GameObject[] powerUpPrefabs, Circle gameArea, float spawnDelay = 30.0f)
: base(spawnDelay)
{
this.powerUpPrefabs = powerUpPrefabs;
this.gameArea = gameArea;
this.spawnTimer = spawnDelay;
}
示例13: CircleCollision
public static bool CircleCollision(Circle circleA, Circle circleB)
{
float distance = Vector2.Distance(circleA.Position, circleB.Position);
float radiusTotal = circleA.Radius + circleB.Radius;
return (distance < radiusTotal);
}
示例14: CollisionPoint
public Vector2 CollisionPoint(Circle circle)
{
return new Vector2 {
X = ((Center.X * circle.Radius) + (circle.Center.X * Radius)) / (Radius + circle.Radius),
Y = ((Center.Y * circle.Radius) + (circle.Center.Y * Radius)) / (Radius + circle.Radius),
};
}
示例15: ExecuteFigureCreationCommand
public override void ExecuteFigureCreationCommand(string[] splitFigString)
{
switch (splitFigString[0])
{
case "circle":
{
Vector3D center = Vector3D.Parse(splitFigString[1]);
double radius = double.Parse(splitFigString[2]);
currentFigure = new Circle(center, radius);
break;
}
case "cylinder":
{
Vector3D bottom = Vector3D.Parse(splitFigString[1]);
Vector3D top = Vector3D.Parse(splitFigString[2]);
double radius = double.Parse(splitFigString[3]);
currentFigure = new Cylinder(bottom, top, radius);
break;
}
}
base.ExecuteFigureCreationCommand(splitFigString);
}