Ejemplo n.º 1
0
        void OnDrawGizmosSelected()
        {
            if (leader != null)
            {
                Vector2 worldOffset = leader.graphicTransform.TransformPoint(localOffset);
                DrawUtil.DrawCrosshair(worldOffset, 1f, Color.white);

                Arrive2D.DrawGizmos(Agent, arriveSensor);
            }
        }
Ejemplo n.º 2
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);
            }
        }
Ejemplo n.º 3
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);
            }
        }
Ejemplo n.º 4
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);
        }