예제 #1
0
 void OnDrawGizmosSelected()
 {
     if (targetRigid)
     {
         Seek2D.DrawGizmos(_futureSeekCache, Agent);
         DrawUtil.DrawLine(_futureSeekCache, targetRigid.position, Color.green);
     }
 }
예제 #2
0
        void OnDrawGizmosSelected()
        {
            if (targetsAreValid())
            {
                Arrive2D.DrawGizmos(Agent, sensor);

                Vector2 agentPosition = Agent.transform.position;

                // Draw the association of the targets to interpose.
                DrawUtil.DrawLine(agentPosition, targetA.position, Color.green);
                DrawUtil.DrawLine(agentPosition, targetB.position, Color.green);
            }
        }
예제 #3
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);
            }
        }
예제 #4
0
        void OnDrawGizmosSelected()
        {
            Vector2 agentPosition = Agent.transform.position;

            // Draw the whiskers
            DrawUtil.DrawRay(agentPosition, mainWhiskerDirection, mainWhiskerLength, Color.red);
            DrawUtil.DrawRay(agentPosition, rightWhiskerDirection, sideWhiskerLength, Color.red);
            DrawUtil.DrawRay(agentPosition, leftWhiskerDirection, sideWhiskerLength, Color.red);

            // Draw the hit that the agent is trying to avoid.
            if (_closestHit.collider != null)
            {
                DrawUtil.DrawLine(agentPosition, _closestHit.point, Color.red);
                DrawUtil.DrawCrosshair(_closestHit.point, 0.3f, Color.red);

                DrawUtil.DrawRay(_closestHit.point, _closestHit.normal, 2f, Color.cyan);
            }
        }
예제 #5
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);
        }