• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# Circle类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Circle的典型用法代码示例。如果您正苦于以下问题:C# Circle类的具体用法?C# Circle怎么用?C# Circle使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Circle类属于命名空间,在下文中一共展示了Circle类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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


示例16: CollidedSurfaceNormals

        public static ICollection<Vector2> CollidedSurfaceNormals(Circle circle, ICollection<AABB> aabbs)
        {
            var surfaceNormals = new List<Vector2>();

            restartLoop:
            foreach (var aabb in aabbs)
            {
                Vector2 nearestVector = NearestVectorBetweenCircleAndAABB(aabb, circle);

                if (NearestVectorIntersects(nearestVector, circle))
                {
                    //if (surfaceNormals == EMPTY) surfaceNormals = new List<Vector2>();

                    var surfaceNormal = Vector2.Normalize(nearestVector);

                    if (!surfaceNormals.Contains(surfaceNormal))
                    {
                        surfaceNormals.Add(surfaceNormal);
                        PushCircleApartFromAABB(circle, nearestVector, 1.0f);

                        goto restartLoop;
                    }
                }
            }

            return surfaceNormals;
        }
开发者ID:axelo,项目名称:Noid,代码行数:27,代码来源:Collision.cs


示例17: ConstructorsEqualityTest

 public void ConstructorsEqualityTest()
 {
     Circle circle1 = new Circle(84, 64, 32);
     Circle circle2 = new Circle(52, 32, 64, false);
     Assert.True(circle1.Equals(circle2), "the circles should be equal");
     Assert.Equal(circle1.GetHashCode(), circle2.GetHashCode()); //the circles should generate the same hash code
 }
开发者ID:hl222ih,项目名称:2DV610.1,代码行数:7,代码来源:CircleTest.cs


示例18: ChoicesHorizontalSlider

        public ChoicesHorizontalSlider(string label, List<string> choices, int startingIndex)
        {
            Choices = choices;
            ChoiceIndex = startingIndex;

            DecrementRep = new Image("WidgetNext") { Origin = Vector2.Zero, Effect = SpriteEffects.FlipHorizontally, SizeX = 4 };
            IncrementRep = new Image("WidgetNext") { Origin = Vector2.Zero, SizeX = 4 };

            ValueText = new Text(Choices[ChoiceIndex], @"Pixelite") { SizeX = 2 };
            Label = new Text(label, @"Pixelite") { SizeX = 2 };

            LongestChoice = new Text(@"Pixelite") { SizeX = 2 };

            foreach (var choice in Choices)
            {
                if (choice.Length > LongestChoice.Data.Length)
                    LongestChoice.Data = choice;
            }

            DecrementCircle = new Circle(Vector3.Zero, DecrementRep.AbsoluteSize.X / 2);
            IncrementCircle = new Circle(Vector3.Zero, IncrementRep.AbsoluteSize.X / 2);

            SpaceForLabel = 200;
            SpaceForValue = 200;
        }
开发者ID:jodigiordano,项目名称:commander,代码行数:25,代码来源:ChoicesHorizontalSlider.cs


示例19: MineEnemy

        /// <summary>
        /// Constructor for the Missle Enemy.
        /// </summary>
        /// <param name="position"></param>
        public MineEnemy(Vector2 position, Player playerOne, Texture2D mineSpawnerTexture, Texture2D mineTexture)
        {
            m_mineEnemyTexture = mineSpawnerTexture;
            m_mineTexture = mineTexture;
            m_pPlayer = playerOne;
            m_position = position;
            m_spriteScale = 0.35f;
            m_dimensions = new Vector2(128, 128) * m_spriteScale;
            m_origin = (m_dimensions / 2.0f) / m_spriteScale;

            m_maxVelocity = 0.0f;
            m_turningSpeed = 150.0f;
            m_wanderPosition = new Vector2();

            m_detectionRadius = new Circle(m_position, 100);
            m_collisionRadius = new Circle(m_position, m_dimensions.X / 2 * m_spriteScale);
            
            m_directionChange = 2.0f;
            m_addMineCountdown = 2.0f;

            m_lerpColour = 0.0f;

            m_mineList = new List<Mine>();

            m_slowMotion = false;
        }
开发者ID:ShiftyMexican,项目名称:NeonCommander,代码行数:30,代码来源:MineEnemy.cs


示例20: ThreeCircleIntersectPoints

    public static void ThreeCircleIntersectPoints(Circle c1, Circle c2, Circle c3, List<Vector3> insectPoints)
    {
        Vector3[] ps1 = Circle.TwoCircleIntersectPoints(c1, c2);

        if (ps1 != null)
        {
            foreach (Vector3 v in ps1)
            {
                float length = (v - c3.mCenter).magnitude;
                if (length <= c3.mRadius)
                {
                    bool haveSame = false;
                    foreach (Vector3 vv in insectPoints)
                    {
                        if (Mathf.Abs(vv.x - v.x) < 0.0001
                            && Mathf.Abs(vv.y - v.y) < 0.0001
                            && Mathf.Abs(vv.z - v.z) < 0.0001)
                        {
                            haveSame = true;
                        }
                    }
                    if (haveSame == false)
                    {
                        insectPoints.Add(v);
                    }
                }
            }
        }
    }
开发者ID:Kamille1989,项目名称:Triangluation,代码行数:29,代码来源:Triangluation.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Circuit类代码示例发布时间:2022-05-24
下一篇:
C# CipherMode类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap