Beispiel #1
0
    private static void SetUpFloorPanel(CubeLocationScript neighbourHalfScript)
    {
        PanelPieceScript panelScript = neighbourHalfScript.GetCubePanel;

        Vector3Int cubeHalfLoc = neighbourHalfScript.CubeID;

        Vector3Int         leftVect       = new Vector3Int(cubeHalfLoc.x, cubeHalfLoc.y - 1, cubeHalfLoc.z);
        CubeLocationScript cubeScriptLeft = LocationManager.GetLocationScript_CLIENT(leftVect); // underneath panel

        if (cubeScriptLeft != null)
        {
            panelScript.cubeScriptLeft          = cubeScriptLeft;
            panelScript.cubeLeftVector          = leftVect;
            cubeScriptLeft._platform_Panel_Cube = neighbourHalfScript;

            cubeScriptLeft._movementOffset_Left = Vector3Int.zero;
        }
        else
        {
            Debug.LogError("Got an issue here cubeHalfLoc ");
            panelScript.PANEL_HAS_ERROR = true;
        }


        Vector3Int         rightVect       = new Vector3Int(cubeHalfLoc.x, cubeHalfLoc.y + 1, cubeHalfLoc.z);
        CubeLocationScript cubeScriptRight = LocationManager.GetLocationScript_CLIENT(rightVect); // Ontop of panel

        if (cubeScriptRight != null)
        {
            panelScript.cubeScriptRight          = cubeScriptRight;
            panelScript.cubeRightVector          = rightVect;
            cubeScriptRight._platform_Panel_Cube = neighbourHalfScript;

            cubeScriptRight._movementOffset_Right = Vector3Int.zero;
        }
        else
        {
            Debug.LogError("Got an issue here cubeHalfLoc ");
            panelScript.PANEL_HAS_ERROR = true;
        }

        if (panelScript.PANEL_HAS_ERROR)
        {
            panelScript.PanelPieceChangeColor("Red");
        }
    }
Beispiel #2
0
    // this is a bit different, the actual MOVEABLE cube script gets passed in here coz slopes sit in the cube object not the half cube objects
    // THIS IS GOING TO CAUSE PROBLEMS IN FUTURE COZ THERES NO CHECKS IF THEY CAN MOVE ONTO SLOPE, ITS ALWAYS YES
    private static void SetUpFloorAnglePanel(CubeLocationScript cubeScript) // << hence the cubeScript NOT neighbourHalfScript
    {
        PanelPieceScript panelScript = cubeScript.GetCubePanel;

        Vector3Int cubeLoc = cubeScript.CubeID;

        Vector3Int rightVect = new Vector3Int(cubeLoc.x, cubeLoc.y, cubeLoc.z);
        Vector3Int leftVect  = new Vector3Int(cubeLoc.x, cubeLoc.y, cubeLoc.z);

        int panelYaxis = panelScript._panelYAxis;

        int slopeAmount = 1;

        int xOffsetR = 0;
        int xOffsetL = 0;
        int zOffsetR = 0;
        int zOffsetL = 0;

        if (panelYaxis == 0)
        {
            xOffsetR = slopeAmount;
            xOffsetL = -slopeAmount;
            zOffsetR = 0;
            zOffsetL = 0;
        }
        else if (panelYaxis == 90)
        {
            xOffsetR = 0;
            xOffsetL = 0;
            zOffsetR = -slopeAmount;
            zOffsetL = slopeAmount;
        }
        else if (panelYaxis == 180)
        {
            xOffsetR = -slopeAmount;
            xOffsetL = slopeAmount;
            zOffsetR = 0;
            zOffsetL = 0;
        }
        else if (panelYaxis == 270)
        {
            xOffsetR = 0;
            xOffsetL = 0;
            zOffsetR = slopeAmount;
            zOffsetL = -slopeAmount;
        }
        else
        {
            Debug.Log("f**k got an issue here");
        }

        Vector3Int movementOffset_Left  = new Vector3Int(xOffsetL, slopeAmount, zOffsetL);  // Ontop
        Vector3Int movementOffset_Right = new Vector3Int(xOffsetR, -slopeAmount, zOffsetR); // Underneath


        CubeLocationScript cubeScriptLeft = LocationManager.GetLocationScript_CLIENT(leftVect);

        if (cubeScriptLeft != null)
        {
            panelScript.cubeScriptLeft          = cubeScriptLeft;
            panelScript.cubeLeftVector          = leftVect;
            cubeScriptLeft._platform_Panel_Cube = cubeScript;

            cubeScriptLeft._movementOffset_Left = movementOffset_Left;
        }
        else
        {
            Debug.LogError("f**k got an issue here");
            panelScript.PANEL_HAS_ERROR = true;
        }


        CubeLocationScript cubeScriptRight = LocationManager.GetLocationScript_CLIENT(rightVect);

        if (cubeScriptRight != null)
        {
            panelScript.cubeScriptRight          = cubeScriptRight;
            panelScript.cubeRightVector          = rightVect;
            cubeScriptRight._platform_Panel_Cube = cubeScript;

            cubeScriptRight._movementOffset_Right = movementOffset_Right;
        }
        else
        {
            Debug.LogError("f**k got an issue here");
            panelScript.PANEL_HAS_ERROR = true;
        }

        if (panelScript.PANEL_HAS_ERROR)
        {
            panelScript.PanelPieceChangeColor("Red");
        }
    }
Beispiel #3
0
    private static void SetUpWallPanel(CubeLocationScript neighbourHalfScript)
    {
        PanelPieceScript panelScript = neighbourHalfScript.GetCubePanel;

        Vector3Int cubeLoc = neighbourHalfScript.CubeID;

        Vector3Int rightVect = new Vector3Int(cubeLoc.x, cubeLoc.y, cubeLoc.z);
        Vector3Int leftVect  = new Vector3Int(cubeLoc.x, cubeLoc.y, cubeLoc.z); // Underneath ( I think)


        int panelAngle = panelScript._panelYAxis;

        if (panelAngle == 90)
        {
            rightVect = new Vector3Int(cubeLoc.x + 1, cubeLoc.y, cubeLoc.z);
            leftVect  = new Vector3Int(cubeLoc.x - 1, cubeLoc.y, cubeLoc.z); // Underneath ( I think)
        }
        else if (panelAngle == 0)
        {
            rightVect = new Vector3Int(cubeLoc.x, cubeLoc.y, cubeLoc.z + 1);
            leftVect  = new Vector3Int(cubeLoc.x, cubeLoc.y, cubeLoc.z - 1); // Underneath ( I think)
        }
        else
        {
            Debug.LogError("f**k got an issue here");
            panelScript.PANEL_HAS_ERROR = true;
        }

        CubeLocationScript cubeScriptLeft = LocationManager.GetLocationScript_CLIENT(leftVect);

        if (cubeScriptLeft != null)
        {
            panelScript.cubeScriptLeft          = cubeScriptLeft;
            panelScript.cubeLeftVector          = leftVect;
            cubeScriptLeft._platform_Panel_Cube = neighbourHalfScript;

            cubeScriptLeft._movementOffset_Left = Vector3Int.zero;
        }
        else
        {
            Debug.LogError("f**k got an issue here");
            panelScript.PANEL_HAS_ERROR = true;
        }

        CubeLocationScript cubeScriptRight = LocationManager.GetLocationScript_CLIENT(rightVect);

        if (cubeScriptRight != null)
        {
            panelScript.cubeScriptRight          = cubeScriptRight;
            panelScript.cubeRightVector          = rightVect;
            cubeScriptRight._platform_Panel_Cube = neighbourHalfScript;

            cubeScriptRight._movementOffset_Right = Vector3Int.zero;
        }
        else
        {
            Debug.LogError("f**k got an issue here");
            panelScript.PANEL_HAS_ERROR = true;
        }

        if (panelScript.PANEL_HAS_ERROR)
        {
            panelScript.PanelPieceChangeColor("Red");
        }
    }