Example #1
0
    private void PrintDebugInfo(Vector2 input)
    {
        var debugInfo = new StringBuilder();

        debugInfo.AppendLine("Player Info");

        debugInfo.AppendFormat("input: {0}", input);
        debugInfo.AppendLine();

        debugInfo.AppendFormat("velocity: {0}", _velocity);
        debugInfo.AppendLine();

        var collisions = new List <string>();

        if (_controller.collisions.left)
        {
            collisions.Add("left");
        }
        if (_controller.collisions.above)
        {
            collisions.Add("above");
        }
        if (_controller.collisions.right)
        {
            collisions.Add("right");
        }
        if (_controller.collisions.below)
        {
            collisions.Add("below");
        }
        if (collisions.Count == 0)
        {
            collisions.Add("none");
        }

        debugInfo.AppendFormat("collisions: {0}", string.Join(", ", collisions.ToArray()));
        debugInfo.AppendLine();

        debugInfo.AppendFormat("climbing slope: {0}", _controller.collisions.climbingSlope);
        debugInfo.AppendLine();

        debugInfo.AppendFormat("descending slope: {0}", _controller.collisions.descendingSlope);
        debugInfo.AppendLine();

        debugInfo.AppendFormat("sliding slope: {0}", _controller.collisions.slidingDownMaxSlope);
        debugInfo.AppendLine();

        debugInfo.AppendFormat("slope angle: {0}", _controller.collisions.slopeAngle);
        debugInfo.AppendLine();

        debugInfo.AppendFormat("slope normal: {0}", _controller.collisions.slopeNormal);
        debugInfo.AppendLine();

        debugInfo.AppendFormat("falling through: {0}", _controller.collisions.fallingThroughPlatform);
        debugInfo.AppendLine();

        DebugEx.ClearStatic();
        DebugEx.LogStatic(debugInfo.ToString());
    }