当前位置: 首页>>代码示例>>C#>>正文


C# Circle类代码示例

本文整理汇总了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
            };
        }
开发者ID:btr10,项目名称:EloBuddyAddons,代码行数:25,代码来源:CircularMissileSkillshot.cs

示例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(',', '.'));
        }
    }
开发者ID:tddold,项目名称:Telerik-Academy-Homework-Solutions,代码行数:28,代码来源:Test.cs

示例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;
        }
开发者ID:nubington,项目名称:rts,代码行数:60,代码来源:PathFinderTools.cs

示例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;
        }
开发者ID:BitSits,项目名称:BitSits-Framework---2D-Race,代码行数:11,代码来源:Circle.cs

示例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;
 }
开发者ID:wcatykid,项目名称:GeoShader,代码行数:13,代码来源:CircleSegmentIntersection.cs

示例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);
 }
开发者ID:jodigiordano,项目名称:commander,代码行数:7,代码来源:HorizontalSlider.cs

示例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 });
         }
     }
 }
开发者ID:Ring-r,项目名称:opt,代码行数:31,代码来源:ModelExtending.cs

示例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();
        }
开发者ID:Ben-P-Leda,项目名称:Bopscotch-Android,代码行数:28,代码来源:Player.cs

示例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);
 }
开发者ID:pampersrocker,项目名称:STAR,代码行数:7,代码来源:LoadingRotation.cs

示例10: Main

 private static void Main()
 {
     var circle = new Circle(5);
     Console.WriteLine(circle);
     var rect = new Rectangle(2, 3);
     Console.WriteLine(rect);
 }
开发者ID:EBojilova,项目名称:CSharpHQC,代码行数:7,代码来源:FiguresExample.cs

示例11: CelestialBodyExplosion

 public CelestialBodyExplosion()
 {
     Handler = new IntegerHandler(CheckEnemiesHit);
     Output = new Dictionary<int, Enemy>();
     CelestialBodyRectangle = new PhysicalRectangle();
     CelestiablBodyRange = new Circle(Vector3.Zero, 0);
 }
开发者ID:jodigiordano,项目名称:commander,代码行数:7,代码来源:CelestialBodyExplosion.cs

示例12: PowerUpSpawner

 public PowerUpSpawner(GameObject[] powerUpPrefabs, Circle gameArea, float spawnDelay = 30.0f)
     : base(spawnDelay)
 {
     this.powerUpPrefabs = powerUpPrefabs;
     this.gameArea = gameArea;
     this.spawnTimer = spawnDelay;
 }
开发者ID:AkiV,项目名称:Survival,代码行数:7,代码来源:PowerUpSpawner.cs

示例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);
        }
开发者ID:gamepopper,项目名称:Ricoh2DFramework,代码行数:7,代码来源:CollisionListener.cs

示例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),
     };
 }
开发者ID:jaysan1292,项目名称:JdGameBase,代码行数:7,代码来源:Circle.cs

示例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);
    }
开发者ID:dgrigorov,项目名称:TelerikAcademy-1,代码行数:26,代码来源:RoundedFigureController.cs


注:本文中的Circle类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。