示例#1
0
        public void DrawQuery()
        {
            if (shape == null)
            {
                return;
            }



            ConvexCircle circle = shape as ConvexCircle;

            Gizmos.color = Color.yellow;
            float   cx       = circle.Radius * Mathf.Cos(0);
            float   cy       = circle.Radius * Mathf.Sin(0);
            Vector2 cpos     = circle.Center + new Vector2(cx, cy);
            Vector2 cnewPos  = cpos;
            Vector2 clastPos = cpos;

            for (float theta = 0.1f; theta < Mathf.PI * 2.0f; theta += 0.1f)
            {
                cx      = circle.Radius * Mathf.Cos(theta);
                cy      = circle.Radius * Mathf.Sin(theta);
                cnewPos = circle.Center + new Vector2(cx, cy);
                Gizmos.DrawLine(cpos, cnewPos);
                cpos = cnewPos;
            }
            Gizmos.DrawLine(cpos, clastPos);
        }
示例#2
0
        protected override void AgentAwake()
        {
            base.AgentAwake();

            circle = new ConvexCircle(new Vector2(agentTransform.position.x, agentTransform.position.y), radius);
        }
示例#3
0
 public QtCircleQuery(Vector2 center, float radius)
 {
     shape = new ConvexCircle(center, radius);
 }
示例#4
0
 // Use this for initialization
 void Start()
 {
     c1 = new ConvexCircle(circle1Position, c1Radius);
     c2 = new ConvexCircle(circle2Position, c2Radius);
 }
示例#5
0
 // Use this for initialization
 void Start()
 {
     rect1  = new ConvexRect(rectCenter, rectSize);
     circle = new ConvexCircle(circlePosition, cRadius);
 }