コード例 #1
0
ファイル: Pursuit2D.cs プロジェクト: luis-l/UnityAssets
 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
ファイル: Wander2D.cs プロジェクト: luis-l/UnityAssets
        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);
        }