コード例 #1
0
    void OnDrawGizmos()
    {
        if (_physicsCollider == null || _visibilityCollider == null)
        {
            Awake();
        }

        if ((int)_physicsCollider.bounds.extents.x != width ||
            (int)_physicsCollider.bounds.extents.y != height)
        {
            _physicsCollider.size = new Vector2(width, height);
        }
        if ((int)_visibilityCollider.bounds.extents.x != width ||
            (int)_visibilityCollider.bounds.extents.y != height)
        {
            _visibilityCollider.size = new Vector2(width + Screen.width / 2, height + Screen.height / 2); // add some padding
        }

        if (showCameraGizmoOutline)
        {
            GizmoUtility.DrawBoundingBox(transform, _visibilityCollider.bounds.extents, outlineVisibilityMaskGizmoColor);
        }
        if (showGizmoOutline)
        {
            GizmoUtility.DrawBoundingBox(transform, _physicsCollider.bounds.extents, outlineGizmoColor);
        }
    }
    void OnDrawGizmos()
    {
        if (ShowGizmoOutline && PlatformGroups.Count > 0)
        {
            BoxCollider2D boxCollider = null;

            for (var i = 0; i < PlatformGroups.Count; i++)
            {
                if (PlatformGroups[i].EnabledGameObject != null)
                {
                    boxCollider = PlatformGroups[i].EnabledGameObject.GetComponent <BoxCollider2D>();

                    break;
                }

                if (PlatformGroups[i].DisabledGameObject != null)
                {
                    boxCollider = PlatformGroups[i].DisabledGameObject.GetComponent <BoxCollider2D>();

                    break;
                }
            }

            if (boxCollider != null)
            {
                _gizmoCenter = Vector2.zero;

                _gizmoExtents = new Vector3(
                    Width + boxCollider.size.x / 2,
                    Height + boxCollider.size.y / 2);
            }

            GizmoUtility.DrawBoundingBox(transform.TransformPoint(_gizmoCenter), _gizmoExtents, OutlineGizmoColor);
        }
    }
    void OnDrawGizmos()
    {
        if (showGizmoOutline && platformGroups.Count > 0)
        {
            BoxCollider2D boxCollider2D = null;
            for (int i = 0; i < platformGroups.Count; i++)
            {
                if (platformGroups[i].enabledGameObject != null)
                {
                    boxCollider2D = platformGroups[i].enabledGameObject.GetComponent <BoxCollider2D>();
                    break;
                }
                if (platformGroups[i].disabledGameObject != null)
                {
                    boxCollider2D = platformGroups[i].disabledGameObject.GetComponent <BoxCollider2D>();
                    break;
                }
            }

            if (boxCollider2D != null)
            {
                _gizmoCenter  = Vector2.zero;
                _gizmoExtents = new Vector3(
                    width + boxCollider2D.size.x / 2
                    , height + boxCollider2D.size.y / 2
                    );
            }

            GizmoUtility.DrawBoundingBox(this.transform.TransformPoint(_gizmoCenter), _gizmoExtents, outlineGizmoColor);
        }
    }
コード例 #4
0
 void OnDrawGizmos()
 {
     if (ShowGizmoOutline)
     {
         GizmoUtility.DrawBoundingBox(transform.position, Size / 2, OutlineGizmoColor);
     }
 }
コード例 #5
0
 void OnDrawGizmos()
 {
     foreach (var bc in GetComponents <BoxCollider2D>())
     {
         GizmoUtility.DrawBoundingBox(transform.position, bc.bounds.extents, gizmoColor);
         break;
     }
 }
コード例 #6
0
 public override void DrawGizmos()
 {
     if (doDrawDebugBoundingBox)
     {
         GizmoUtility.DrawBoundingBox(_playerController.transform.position + _playerController.boxCollider.offset.ToVector3()
                                      , _playerController.boxCollider.bounds.extents, debugBoundingBoxColor);
     }
 }
    void OnDrawGizmos()
    {
        for (var i = 0; i < PlatformGroupPositions.Count; i++)
        {
            if (PlatformGroupPositions[i].ShowGizmoOutline)
            {
                var gizmoCenter = Vector3.zero;

                var gizmoExtents = new Vector3(16, 16, 0);

                if (PlatformGroupPositions[i].EnabledGameObject != null)
                {
                    for (int j = 0; j < PlatformGroupPositions[i].Positions.Count; j++)
                    {
                        var rectangleMeshBuildScript =
                            PlatformGroupPositions[i].EnabledGameObject.GetComponent <RectangleMeshBuildScript>();

                        if (rectangleMeshBuildScript != null)
                        {
                            switch (rectangleMeshBuildScript.Anchor)
                            {
                            case TextAnchor.MiddleCenter:

                                gizmoCenter = Vector3.zero;

                                gizmoExtents = new Vector3(rectangleMeshBuildScript.Width / 2, rectangleMeshBuildScript.Height / 2);

                                break;

                            case TextAnchor.LowerLeft:

                                gizmoCenter = new Vector3(rectangleMeshBuildScript.Width / 2, rectangleMeshBuildScript.Height / 2);

                                gizmoExtents = new Vector3(rectangleMeshBuildScript.Width / 2, rectangleMeshBuildScript.Height / 2);

                                break;

                            default:
                                throw new ArgumentException("rectangleMeshBuildScript anchor " + rectangleMeshBuildScript.Anchor + " not supported.");
                            }
                        }
                        else
                        {
                            var boxCollider = PlatformGroupPositions[i].EnabledGameObject.GetComponent <BoxCollider2D>();

                            if (boxCollider != null)
                            {
                                gizmoCenter  = boxCollider.offset;
                                gizmoExtents = boxCollider.size / 2;
                            }
                        }

                        GizmoUtility.DrawBoundingBox(transform.TransformPoint(PlatformGroupPositions[i].Positions[j] + gizmoCenter), gizmoExtents, PlatformGroupPositions[i].OutlineGizmoColor);
                    }
                }
            }
        }
    }
コード例 #8
0
 public override void DrawGizmos()
 {
     if (DoDrawDebugBoundingBox)
     {
         GizmoUtility.DrawBoundingBox(
             PlayerController.transform.position + PlayerController.EnvironmentBoxCollider.offset.ToVector3(),
             PlayerController.EnvironmentBoxCollider.bounds.extents, DebugBoundingBoxColor);
     }
 }
コード例 #9
0
    void OnDrawGizmos()
    {
        if (ShowGizmoOutline)
        {
            if (PlatformPrefab != null)
            {
                var rectangleMeshBuildScript = PlatformPrefab.GetComponent <RectangleMeshBuildScript>();

                if (rectangleMeshBuildScript != null)
                {
                    switch (rectangleMeshBuildScript.Anchor)
                    {
                    case TextAnchor.MiddleCenter:

                        _gizmoCenter = Vector3.zero;

                        _gizmoExtents = new Vector3(rectangleMeshBuildScript.Width / 2, rectangleMeshBuildScript.Height / 2);

                        break;

                    case TextAnchor.LowerLeft:

                        _gizmoCenter = new Vector3(rectangleMeshBuildScript.Width / 2, rectangleMeshBuildScript.Height / 2);

                        _gizmoExtents = new Vector3(rectangleMeshBuildScript.Width / 2, rectangleMeshBuildScript.Height / 2);

                        break;

                    default:
                        throw new ArgumentException("rectangleMeshBuildScript anchor " + rectangleMeshBuildScript.Anchor + " not supported.");
                    }
                }
                else
                {
                    var boxCollider = PlatformPrefab.GetComponent <BoxCollider2D>();

                    if (boxCollider != null)
                    {
                        _gizmoCenter  = boxCollider.offset;
                        _gizmoExtents = boxCollider.bounds.extents;
                    }
                }
            }

            for (var i = 0; i < PlatformPositions.Count; i++)
            {
                GizmoUtility.DrawBoundingBox(
                    transform.TransformPoint(PlatformPositions[i] + _gizmoCenter),
                    _gizmoExtents,
                    OutlineGizmoColor);
            }
        }
    }
コード例 #10
0
    void OnDrawGizmos()
    {
        if (showGizmoOutline)
        {
            BoxCollider2D boxCollider2D = this.GetComponent <BoxCollider2D>();
            if (boxCollider2D != null)
            {
                _gizmoCenter  = boxCollider2D.offset;
                _gizmoExtents = boxCollider2D.size / 2;
            }

            GizmoUtility.DrawBoundingBox(this.transform.TransformPoint(_gizmoCenter), _gizmoExtents, outlineGizmoColor);
        }
    }
コード例 #11
0
    void OnDrawGizmos()
    {
        if (ShowGizmoOutline)
        {
            var boxCollider = GetComponent <BoxCollider2D>();

            if (boxCollider != null)
            {
                _gizmoCenter  = boxCollider.offset;
                _gizmoExtents = boxCollider.size / 2;
            }

            GizmoUtility.DrawBoundingBox(transform.TransformPoint(_gizmoCenter), _gizmoExtents, OutlineGizmoColor);
        }
    }
コード例 #12
0
    void OnDrawGizmos()
    {
        for (int i = 0; i < platformGroupPositions.Count; i++)
        {
            if (platformGroupPositions[i].showGizmoOutline)
            {
                Vector3 gizmoCenter  = Vector3.zero;
                Vector3 gizmoExtents = new Vector3(16, 16, 0);

                if (platformGroupPositions[i].enabledGameObject != null)
                {
                    for (int j = 0; j < platformGroupPositions[i].positions.Count; j++)
                    {
                        RectangleMeshBuildScript rectangleMeshBuildScript = platformGroupPositions[i].enabledGameObject.GetComponent <RectangleMeshBuildScript>();
                        if (rectangleMeshBuildScript != null)
                        {
                            switch (rectangleMeshBuildScript.anchor)
                            {
                            case TextAnchor.MiddleCenter:
                                gizmoCenter  = Vector3.zero;
                                gizmoExtents = new Vector3(rectangleMeshBuildScript.width / 2, rectangleMeshBuildScript.height / 2);
                                break;

                            case TextAnchor.LowerLeft:
                                gizmoCenter  = new Vector3(rectangleMeshBuildScript.width / 2, rectangleMeshBuildScript.height / 2);
                                gizmoExtents = new Vector3(rectangleMeshBuildScript.width / 2, rectangleMeshBuildScript.height / 2);
                                break;

                            default:
                                throw new ArgumentException("rectangleMeshBuildScript anchor " + rectangleMeshBuildScript.anchor + " not supported.");
                            }
                        }
                        else
                        {
                            BoxCollider2D boxCollider2D = platformGroupPositions[i].enabledGameObject.GetComponent <BoxCollider2D>();
                            if (boxCollider2D != null)
                            {
                                gizmoCenter  = boxCollider2D.offset;
                                gizmoExtents = boxCollider2D.size / 2;
                            }
                        }

                        GizmoUtility.DrawBoundingBox(this.transform.TransformPoint(platformGroupPositions[i].positions[j] + gizmoCenter), gizmoExtents, platformGroupPositions[i].outlineGizmoColor);
                    }
                }
            }
        }
    }
コード例 #13
0
    void OnDrawGizmos()
    {
        if (_physicsCollider == null || _visibilityCollider == null)
        {
            Awake();
        }

        if (showCameraGizmoOutline)
        {
            GizmoUtility.DrawBoundingBox(transform, _visibilityCollider.bounds.extents, outlineVisibilityMaskGizmoColor);
        }
        if (showGizmoOutline)
        {
            GizmoUtility.DrawBoundingBox(transform, new Vector3(width / 2, height / 2), outlineGizmoColor);
        }
    }
コード例 #14
0
 void OnDrawGizmos()
 {
     if (showGizmoOutline)
     {
         if (floatingAttachedPlatform != null)
         {
             BoxCollider2D boxCollider2D = floatingAttachedPlatform.GetComponent <BoxCollider2D>();
             if (boxCollider2D != null)
             {
                 _gizmoCenter  = Vector2.zero;
                 _gizmoExtents = new Vector3(
                     width + boxCollider2D.size.x / 2
                     , height + boxCollider2D.size.y / 2
                     );
             }
         }
         GizmoUtility.DrawBoundingBox(this.transform.TransformPoint(_gizmoCenter), _gizmoExtents, outlineGizmoColor);
     }
 }
コード例 #15
0
    void OnDrawGizmos()
    {
        if (ShowGizmoOutline)
        {
            if (FloatingAttachedPlatform != null)
            {
                var boxCollider = FloatingAttachedPlatform.GetComponent <BoxCollider2D>();
                if (boxCollider != null)
                {
                    _gizmoCenter  = Vector2.zero;
                    _gizmoExtents = new Vector3(
                        Radius + boxCollider.size.x / 2,
                        Radius + boxCollider.size.y / 2);
                }
            }

            GizmoUtility.DrawBoundingBox(transform.TransformPoint(_gizmoCenter), _gizmoExtents, OutlineGizmoColor);
        }
    }
コード例 #16
0
    void OnDrawGizmos()
    {
        if (_collider != null ||
            (Application.isEditor && !Application.isPlaying))
        {
            _walkingJumpRadiusPositions = null;
            _runningJumpRadiusPositions = null;

            Gizmos.color = Color.gray;
            if (_walkingJumpRadiusPositions == null)
            {
                _walkingJumpRadiusPositions = GizmoUtility.CreateEllipse(
                    walkingJumpDistance
                    , jumpHeight
                    , 0, 0//-playerDimensions.y * .5f
                    , 0f
                    , _jumpRadiusResolution);
            }
            if (_runningJumpRadiusPositions == null)
            {
                _runningJumpRadiusPositions = GizmoUtility.CreateEllipse(
                    runningJumpDistance
                    , jumpHeight
                    , 0, 0//-playerDimensions.y * .5f
                    , 0f
                    , _jumpRadiusResolution);
            }

            for (int i = 1; i < _walkingJumpRadiusPositions.Length; i++)
            {
                Gizmos.DrawLine(_walkingJumpRadiusPositions[i - 1] + this.transform.position, _walkingJumpRadiusPositions[i] + this.transform.position);
            }
            Gizmos.DrawLine(_walkingJumpRadiusPositions[_walkingJumpRadiusPositions.Length - 1] + this.transform.position, _walkingJumpRadiusPositions[0] + this.transform.position);

            for (int i = 1; i < _runningJumpRadiusPositions.Length; i++)
            {
                Gizmos.DrawLine(_runningJumpRadiusPositions[i - 1] + this.transform.position, _runningJumpRadiusPositions[i] + this.transform.position);
            }
            Gizmos.DrawLine(_runningJumpRadiusPositions[_runningJumpRadiusPositions.Length - 1] + this.transform.position, _runningJumpRadiusPositions[0] + this.transform.position);


            float comfortableJumpHeightYPos = this.transform.position.y + comfortableJumpHeight; // -playerDimensions.y * .5f;
            float maxJumpHeightYPos         = this.transform.position.y + maxJumpHeight;         //  - playerDimensions.y * .5f;

            Gizmos.color = Color.gray;
            Gizmos.DrawLine(
                new Vector3(this.transform.position.x - walkingJumpHeightWidth * .4f, maxJumpHeightYPos, this.transform.position.z)
                , new Vector3(this.transform.position.x + walkingJumpHeightWidth * .4f, maxJumpHeightYPos, this.transform.position.z));
            Gizmos.color = Color.white;
            Gizmos.DrawLine(
                new Vector3(this.transform.position.x - walkingJumpHeightWidth * .7f, comfortableJumpHeightYPos, this.transform.position.z)
                , new Vector3(this.transform.position.x + walkingJumpHeightWidth * .7f, comfortableJumpHeightYPos, this.transform.position.z));

            Gizmos.DrawLine(new Vector3(transform.position.x - playerDimensions.x, transform.position.y - playerDimensions.y * .5f, transform.position.z)
                            , new Vector3(transform.position.x + playerDimensions.x, transform.position.y - playerDimensions.y * .5f, transform.position.z));

            // draw player visible rect
            GizmoUtility.DrawBoundingBox(transform.position, new Vector3(950f, 540f, 0f), Color.blue);

            // draw default camera locked
            // draw player visible rect
            GizmoUtility.DrawBoundingBox(new Vector3(transform.position.x, 540f, transform.position.z), new Vector3(950f, 540f, 0f), Color.cyan);
            Gizmos.color = Color.cyan;
            Gizmos.DrawLine(
                new Vector3(this.transform.position.x - 1000f, 540f, this.transform.position.z)
                , new Vector3(this.transform.position.x + 1000f, 540f, this.transform.position.z));
            Gizmos.DrawLine(
                new Vector3(this.transform.position.x - 1000f, 720f, this.transform.position.z)
                , new Vector3(this.transform.position.x + 1000f, 720f, this.transform.position.z));
            Gizmos.DrawLine(
                new Vector3(this.transform.position.x - 1000f, 360f, this.transform.position.z)
                , new Vector3(this.transform.position.x + 1000f, 360f, this.transform.position.z));
        }
    }
コード例 #17
0
    void OnDrawGizmos()
    {
        if (_collider != null ||
            (Application.isEditor && !Application.isPlaying))
        {
            _walkingJumpRadiusPositions = null;

            _runningJumpRadiusPositions = null;

            Gizmos.color = Color.gray;
            if (_walkingJumpRadiusPositions == null)
            {
                _walkingJumpRadiusPositions = GizmoUtility.CreateEllipse(
                    WalkingJumpDistance,
                    JumpHeight,
                    0,
                    0,
                    0f,
                    _jumpRadiusResolution);
            }
            if (_runningJumpRadiusPositions == null)
            {
                _runningJumpRadiusPositions = GizmoUtility.CreateEllipse(
                    RunningJumpDistance,
                    JumpHeight,
                    0,
                    0,
                    0f,
                    _jumpRadiusResolution);
            }

            for (var i = 1; i < _walkingJumpRadiusPositions.Length; i++)
            {
                Gizmos.DrawLine(_walkingJumpRadiusPositions[i - 1] + transform.position, _walkingJumpRadiusPositions[i] + transform.position);
            }

            Gizmos.DrawLine(_walkingJumpRadiusPositions[_walkingJumpRadiusPositions.Length - 1] + transform.position, _walkingJumpRadiusPositions[0] + transform.position);

            for (var i = 1; i < _runningJumpRadiusPositions.Length; i++)
            {
                Gizmos.DrawLine(_runningJumpRadiusPositions[i - 1] + transform.position, _runningJumpRadiusPositions[i] + transform.position);
            }

            Gizmos.DrawLine(_runningJumpRadiusPositions[_runningJumpRadiusPositions.Length - 1] + transform.position, _runningJumpRadiusPositions[0] + transform.position);

            var comfortableJumpHeightYPos = transform.position.y + ComfortableJumpHeight; // -playerDimensions.y * .5f;

            var maxJumpHeightYPos = transform.position.y + MaxJumpHeight;                 //  - playerDimensions.y * .5f;

            Gizmos.color = Color.gray;

            Gizmos.DrawLine(
                new Vector3(transform.position.x - WalkingJumpHeightWidth * .4f, maxJumpHeightYPos, transform.position.z),
                new Vector3(transform.position.x + WalkingJumpHeightWidth * .4f, maxJumpHeightYPos, transform.position.z));

            Gizmos.color = Color.white;

            Gizmos.DrawLine(
                new Vector3(transform.position.x - WalkingJumpHeightWidth * .7f, comfortableJumpHeightYPos, transform.position.z),
                new Vector3(transform.position.x + WalkingJumpHeightWidth * .7f, comfortableJumpHeightYPos, transform.position.z));

            Gizmos.DrawLine(
                new Vector3(transform.position.x - PlayerDimensions.x, transform.position.y - PlayerDimensions.y * .5f, transform.position.z),
                new Vector3(transform.position.x + PlayerDimensions.x, transform.position.y - PlayerDimensions.y * .5f, transform.position.z));

            // draw player visible rect
            GizmoUtility.DrawBoundingBox(transform.position, SafeAreaBounds, Color.blue);
        }
    }