예제 #1
0
        public static void DrawGizmos(Vector2 target, AutonomousAgent2D agent)
        {
            // Draw the arrow pointing to the target position.
            DrawUtil.DrawArrow(agent.transform.position, target, Color.green, 0.8f);

            // Emphasize the target position.
            DrawUtil.DrawCircle(target, 0.15f, Color.green);
        }
예제 #2
0
        void OnDrawGizmosSelected()
        {
            Vector2 center = Agent.transform.position;

            DrawUtil.DrawCircle(center, _sepRadius, Color.red);
            DrawUtil.DrawCircle(center, _aliRadius, Color.magenta);
            DrawUtil.DrawCircle(center, _cohRadius, Color.yellow);
        }
예제 #3
0
        void OnDrawGizmosSelected()
        {
            Evade2D.DrawGizmos(Agent, evadeSensor);
            Arrive2D.DrawGizmos(Agent, arriveSensor);

            // Draw the obstacle sensor dimensions
            DrawUtil.DrawCircle(_obstacleSensor.transform.position, _obstacleSensorCollider.radius, Color.yellow);
        }
예제 #4
0
        public static void DrawGizmos(AutonomousAgent2D agent, Vector2 target)
        {
            // Draw the arrow towards the target.
            DrawUtil.DrawArrow(agent.transform.position, target, Color.green, 0.8f, true);

            // Emphasize the fleeing position.
            DrawUtil.DrawCircle(target, 0.15f, Color.green);
        }
예제 #5
0
        public static void DrawGizmos(AutonomousAgent2D agent, EvadeSensor2D sensor)
        {
            if (sensor.avoid != null)
            {
                if (sensor.bUseRange)
                {
                    DrawUtil.DrawCircle(agent.transform.position, sensor.avoidRange, Color.red);
                }

                DrawUtil.DrawArrow(agent.transform.position, sensor.avoid.position, Color.green, 1f, true);
            }
        }
예제 #6
0
        public static void DrawGizmos(AutonomousAgent2D agent, ArriveSensor2D sensor)
        {
            // Draw the slow radius
            DrawUtil.DrawCircle(agent.transform.position, sensor.slowRadius, Color.green);

            // Draw the stop radius
            DrawUtil.DrawCircle(agent.transform.position, sensor.stopRadius, Color.green);

            // Draw a line between the agent and its target.
            DrawUtil.DrawArrow(agent.transform.position, sensor.target, Color.green, 1f);

            // Draw the target position
            DrawUtil.DrawCircle(sensor.target, 0.15f, Color.green);
        }
예제 #7
0
        void OnDrawGizmosSelected()
        {
            if (_nearestObstacle != null)
            {
                Vector2 sensorPosition = _sensor.transform.position;

                DrawUtil.DrawLine(sensorPosition, _nearestIntersectGlobal, Color.red);
                DrawUtil.DrawCrosshair(_nearestIntersectGlobal, 1f, Color.red, 0f);

                Vector2 obstacleCenter = _nearestObstacle.bounds.center;
                float   obstacleRadius = getExtendedBoundsRadius(_nearestObstacle);

                // Draw obstacle
                DrawUtil.DrawCircle(obstacleCenter, obstacleRadius, Color.red);
                DrawUtil.DrawCrosshair(obstacleCenter, 0.3f, Color.red);
            }
        }
예제 #8
0
        void OnDrawGizmosSelected()
        {
            if (!active)
            {
                return;
            }

            if (transform.hasChanged)
            {
                updateWander();
            }

            // Draw connection between wander circle and the agent.
            DrawUtil.DrawLine(Agent.transform.position, _wanderCenter, Color.green);

            // Draw the wander properies, such as the target, radius, and wander center.
            DrawUtil.DrawLine(_wanderCenter, _wanderTarget, Color.green);
            DrawUtil.DrawCrosshair(_wanderTarget, 1f, Color.yellow);
            DrawUtil.DrawCircle(_wanderCenter, wanderRadius, Color.green);
        }
예제 #9
0
        public void DrawGizmos()
        {
            for (int i = 0; i < Size - 1; ++i)
            {
                Vector2 start = waypoints[i];
                Vector2 end   = waypoints[i + 1];

                // Draw a line segment between the waypoints.
                DrawUtil.DrawArrow(start, end, Color.cyan, 0.35f);

                // Draw the near threshold.
                DrawUtil.DrawCircle(start, nearWaypointThresh, Color.blue);
            }

            // Draw the near threshold for last waypoint since the loop only goes to Length-1.
            DrawUtil.DrawCircle(LastWaypoint, nearWaypointThresh, Color.blue);

            // Draw a line segment between the end and start waypoints.
            if (bLoop)
            {
                DrawUtil.DrawArrow(LastWaypoint, FirstWaypoint, Color.cyan, 0.35f);
            }
        }
예제 #10
0
 protected void drawSensorBounds()
 {
     DrawUtil.DrawCircle(Agent.transform.position, sensorRadius, Color.red);
 }