예제 #1
0
    void DrawPlatformOscillationDebug()
    {
        if (oscillateVertically)
        {
            //get the coords for top and bottom boxes (where the platforms will be after oscillating)
            vUpTopL    = new Vector2(topL.x, topL.y + upwardOscillationDistance);
            vUpTopR    = new Vector2(topR.x, topR.y + upwardOscillationDistance);
            vUpBottomL = new Vector2(bottomL.x, bottomL.y + upwardOscillationDistance);
            vUpBottomR = new Vector2(bottomR.x, bottomR.y + upwardOscillationDistance);

            vDownTopL    = new Vector2(topL.x, topL.y - downwardOscillationDistance);
            vDownTopR    = new Vector2(topR.x, topR.y - downwardOscillationDistance);
            vDownBottomL = new Vector2(bottomL.x, bottomL.y - downwardOscillationDistance);
            vDownBottomR = new Vector2(bottomR.x, bottomR.y - downwardOscillationDistance);

            //platform at top of its oscillation
            Debug.DrawRay(transform.position, Vector2.up * upwardOscillationDistance, Color.yellow, 0.0f);
            DebugHelper.DrawBox(vUpTopL, vUpTopR, vUpBottomL, vUpBottomR, Color.green);

            //platform at bottom of its oscillation
            Debug.DrawRay(transform.position, -Vector2.up * downwardOscillationDistance, Color.yellow, 0.0f);
            DebugHelper.DrawBox(vDownTopL, vDownTopR, vDownBottomL, vDownBottomR, Color.red);
        }
        if (oscillateHorizontally)
        {
            hLeftTopL    = new Vector2(topL.x - leftOscillationDistance, topL.y);
            hLeftTopR    = new Vector2(topR.x - leftOscillationDistance, topR.y);
            hLeftBottomL = new Vector2(bottomL.x - leftOscillationDistance, bottomL.y);
            hLeftBottomR = new Vector2(bottomR.x - leftOscillationDistance, bottomR.y);

            hRightTopL    = new Vector2(topL.x + rightOscillationDistance, topL.y);
            hRightTopR    = new Vector2(topR.x + rightOscillationDistance, topR.y);
            hRightBottomL = new Vector2(bottomL.x + rightOscillationDistance, bottomL.y);
            hRightBottomR = new Vector2(bottomR.x + rightOscillationDistance, bottomR.y);

            //platform at left of its oscillation
            Debug.DrawRay(transform.position, -Vector2.right * leftOscillationDistance, Color.yellow, 0.0f);
            DebugHelper.DrawBox(hLeftTopL, hLeftTopR, hLeftBottomL, hLeftBottomR, Color.red);

            //platform at right of its oscillation
            Debug.DrawRay(transform.position, Vector2.right * rightOscillationDistance, Color.yellow, 0.0f);
            DebugHelper.DrawBox(hRightTopL, hRightTopR, hRightBottomL, hRightBottomR, Color.green);
        }
    }