// If ANY kind of wall/floor/object make neighbour cubes walkable public void SetUpPanelInCube(CubeLocationScript cubeScript) { PanelPieceScript panelScript = cubeScript._panelScriptChild; switch (panelScript.name) { case "Floor": SetUpFloorPanel(cubeScript, panelScript); break; case "Wall": SetUpWallPanel(cubeScript, panelScript); break; case "FloorAngle": // angles put in half points SetUpFloorAnglePanel(cubeScript, panelScript); break; case "CeilingAngle": // This is the exact same as ceilingFloor SetUpCeilingAnglePanel(cubeScript, panelScript); break; default: Debug.Log("f**k no issue: " + panelScript.name); break; } }
private void SetUpCeilingAnglePanel(CubeLocationScript cubeScript, PanelPieceScript panelScript) { Vector3 cubeLoc = cubeScript.CubeLocVector; //cubeScript._isPanel = false; // this might cause issues Vector3 centerVect = new Vector3(cubeLoc.x, cubeLoc.y, cubeLoc.z); panelScript.cubeScriptLeft = cubeScript; panelScript.cubeLeftVector = centerVect; panelScript.leftPosNode = new Vector3(0, 0, -4.5f); panelScript.cubeScriptRight = cubeScript; panelScript.cubeRightVector = centerVect; panelScript.rightPosNode = new Vector3(0, 0, 4.5f); //cubeScript._isHumanWalkable = true; // // 8 points for each panel // DoHalfPointsForWalls (new Vector3 (cubeLoc.x - 1, cubeLoc.y + 1, cubeLoc.z - 1)); // DoHalfPointsForWalls (new Vector3 (cubeLoc.x + 0, cubeLoc.y + 1, cubeLoc.z - 1)); // DoHalfPointsForWalls (new Vector3 (cubeLoc.x + 1, cubeLoc.y + 1, cubeLoc.z - 1)); // DoHalfPointsForWalls (new Vector3 (cubeLoc.x - 1, cubeLoc.y + 0, cubeLoc.z + 0)); // // middle // DoHalfPointsForWalls (new Vector3 (cubeLoc.x + 1, cubeLoc.y + 0, cubeLoc.z + 0)); // DoHalfPointsForWalls (new Vector3 (cubeLoc.x - 1, cubeLoc.y - 1, cubeLoc.z + 1)); // DoHalfPointsForWalls (new Vector3 (cubeLoc.x + 0, cubeLoc.y - 1, cubeLoc.z + 1)); // DoHalfPointsForWalls (new Vector3 (cubeLoc.x + 1, cubeLoc.y - 1, cubeLoc.z + 1)); }
//////////////////////////////////////////////// private void UnitReachedTarget() { //Debug.Log("UnitReachedTarget!"); locCount += 1; _currCubeScript = unitScript.CubeUnitIsOn; _currPanelScript = _currCubeScript._platform_Panel_Cube.GetCubePanel; _currObjectScript = _currPanelScript.gameObject.GetComponent <ObjectScript>(); _currPanelScript.PanelIsDEActive(); transform.SetParent(_TARGETCubeScript.transform); if (_newPathSet) // has a new location been clicked { SetNewpath(); } else if (locCount < _nodes.Count) // move to next target { SetNextTarget(); } else { FinishMoving(); } }
// 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 SetUpCeilingAnglePanel(CubeLocationScript cubeScript, PanelPieceScript panelScript) { Vector3 cubeLoc = cubeScript.CubeStaticLocVector; Vector3 TopHalfVect = new Vector3(cubeLoc.x, cubeLoc.y + 1, cubeLoc.z); Vector3 bottomHalfVect = new Vector3(cubeLoc.x, cubeLoc.y - 1, cubeLoc.z); CubeLocationScript cubeScriptHalfTop = LocationManager.GetHalfLocationScript_CLIENT(TopHalfVect); // ontop panel CubeLocationScript cubeScriptHalfBottom = LocationManager.GetHalfLocationScript_CLIENT(bottomHalfVect); // underneath panel if (cubeScriptHalfBottom != null) // ontop { panelScript.cubeScriptRight = cubeScript; panelScript.cubeRightVector = cubeLoc; panelScript.rightPosNode = new Vector3(0, 4.5f, 0); // future issue here if want to move unit bit further on x,z axis on slope SetHumanCubeRules(cubeScript, true, true, true); SetAlienCubeRules(cubeScript, true, true, true); } if (cubeScriptHalfTop != null) // underneath { panelScript.cubeScriptLeft = cubeScript; panelScript.cubeLeftVector = cubeLoc; panelScript.leftPosNode = new Vector3(0, -4.5f, 0); // future issue here if want to move unit bit further on x,z axis on slope SetHumanCubeRules(cubeScript, true, true, true); SetAlienCubeRules(cubeScript, true, true, true); } }
//////////////////////////////////////////////// //////////////////////////////////////////////// public static void CreatePanelForCube(int[] cubeData, CubeLocationScript cubeScript) { GameObject panelObject = WorldBuilder._nodeBuilder.CreatePanelObject(cubeScript); panelObject.GetComponent <ObjectScript>().objectStyle = (CubeObjectStyles)cubeData[1]; if (panelObject.GetComponent <Renderer>()) { ObjectTextures texEnum = (ObjectTextures)cubeData[2]; string matName = "MapTextures/Materials/" + texEnum.ToString(); Material mat = (Material)Resources.Load(matName, typeof(Material)); panelObject.GetComponent <Renderer>().material = mat; } PanelPieceScript panelScript = panelObject.GetComponent <PanelPieceScript>(); int rotX = cubeData[4]; int rotY = cubeData[5]; int rotZ = cubeData[6]; panelObject.GetComponent <ObjectScript>().forcedRotation = new Vector3Int(rotX, rotY, rotZ); panelObject.transform.localScale *= 200; if (cubeData[0] == (int)CubeObjectTypes.Panel_Floor) // Floor { panelObject.GetComponent <ObjectScript>().objectType = CubeObjectTypes.Panel_Floor; cubeScript.CubeIsSlope = false; panelScript._panelYAxis = 0; } else if (cubeData[0] == (int)CubeObjectTypes.Panel_Wall) // Floor { panelObject.GetComponent <ObjectScript>().objectType = CubeObjectTypes.Panel_Wall; cubeScript.CubeIsSlope = false; rotZ = 90; panelScript._panelYAxis = rotY; } else if (cubeData[0] == (int)CubeObjectTypes.Panel_Angle) // Floor { panelObject.GetComponent <ObjectScript>().objectType = CubeObjectTypes.Panel_Angle; cubeScript.CubeIsSlope = true; } else { Debug.LogError("GOT AN ISSUE HERE"); } //Debug.Log("f**k TEST >>>>>>>>>> rotX " + rotX + " + rotY " + rotY + " + rotZ " + rotZ); panelObject.transform.localRotation = Quaternion.Euler(new Vector3Int(rotX, rotY, rotZ)); // panelObject.transform.tag = panelName; // panelScript.name = panelName; }
//////////////////////////////////////////////// //private void AnnoyingFuckingAngleMovementThing() // this is to fix the f*****g camera spinning around in weird angles 10% of the time when a unit moves onto a diff sided panel //{ // if (_TARGETObjectScript.objectType == CubeObjectTypes.Panel_Wall) // { // if (_lastPanelYAxis == -1) // { // _lastPanelYAxis = _TARGETPanelScript._panelYAxis; // changeWallAngle = false; // } // else // { // if (_lastPanelYAxis != _TARGETPanelScript._panelYAxis) // { // changeWallAngle = true; // } // else // { // changeWallAngle = false; // } // _lastPanelYAxis = _TARGETPanelScript._panelYAxis; // } // Debug.Log("f**k changeWallAngle " + changeWallAngle); // } //} //////////////////////////////////////////////// private void SetNextTarget() { _TARGETCubeID = _nodes[locCount]; _TARGETCubeScript = LocationManager.GetLocationScript_CLIENT(_TARGETCubeID); if (_TARGETCubeScript._platform_Panel_Cube.GetCubePanel != null) { _TARGETPanelScript = _TARGETCubeScript._platform_Panel_Cube.GetCubePanel; _TARGETObjectScript = _TARGETPanelScript.gameObject.GetComponent <ObjectScript>(); //AnnoyingFuckingAngleMovementThing(); if (MovementManager._gravityActivated) { // unitContainerTransformLOCAL.localEulerAngles = new Vector3(0, unitContainerTransformLOCAL.localEulerAngles.y, 0); // unitContainerAnglesGLOBAL.localEulerAngles = new Vector3(0, 0, 0); } else { rotateInProgress = false; if (_TARGETObjectScript.objectType != _currObjectScript.objectType) { rotateInProgress = true; } if (_TARGETObjectScript.objectType == _currObjectScript.objectType) { int currPanelYAxis = _currPanelScript._panelYAxis; int targetPanelYAxis = _TARGETPanelScript._panelYAxis; if (currPanelYAxis != targetPanelYAxis) { rotateInProgress = true; } } ChangeUnitsRotation(); ChangeCameraRotation(); } if (!LocationManager.SetUnitOnCube_CLIENT(GetComponent <UnitScript>(), _TARGETCubeID)) { Debug.LogWarning("units movement interrupted >> recalculating"); moveInProgress = false; ResetValues(); if (MovementManager.BuildMovementPath(_finalTargetScript)) { MovementManager.MakeActiveUnitMove_CLIENT(); } } } }
private static void SetUpFloorPanel(CubeLocationScript neighbourHalfScript) { PanelPieceScript panelScript = neighbourHalfScript._panelScriptChild; 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 && !cubeScriptLeft.CubeIsPanel) { panelScript.cubeScriptLeft = cubeScriptLeft; panelScript.cubeLeftVector = leftVect; cubeScriptLeft._platform_Panel_Cube = neighbourHalfScript; cubeScriptLeft._movementOffset_Left = Vector3Int.zero; SetHumanCubeRules(cubeScriptLeft, false, false, false); SetAlienCubeRules(cubeScriptLeft, true, true, true); cubeScriptLeft.IS_HUMAN_MOVABLE = false; cubeScriptLeft.IS_ALIEN_MOVABLE = true; } else { Debug.LogError("Got an issue here"); } Vector3Int rightVect = new Vector3Int(cubeHalfLoc.x, cubeHalfLoc.y + 1, cubeHalfLoc.z); CubeLocationScript cubeScriptRight = LocationManager.GetLocationScript_CLIENT(rightVect); // Ontop of panel if (cubeScriptRight != null && !cubeScriptRight.CubeIsPanel) { panelScript.cubeScriptRight = cubeScriptRight; panelScript.cubeRightVector = rightVect; cubeScriptRight._platform_Panel_Cube = neighbourHalfScript; cubeScriptRight._movementOffset_Right = Vector3Int.zero; SetHumanCubeRules(cubeScriptRight, true, true, true); SetAlienCubeRules(cubeScriptRight, true, true, true); cubeScriptRight.IS_HUMAN_MOVABLE = true; cubeScriptRight.IS_ALIEN_MOVABLE = true; } else { Debug.LogError("Got an issue here"); } }
//////////////////////////////////////////////// public GameObject CreatePanelObject(CubeLocationScript cubeParent) { GameObject panelObject = Instantiate(_panelPrefab, cubeParent.gameObject.transform, false); panelObject.transform.SetParent(cubeParent.gameObject.transform); panelObject.transform.localPosition = Vector3Int.zero; PanelPieceScript panelScript = panelObject.gameObject.GetComponent <PanelPieceScript>(); cubeParent.GetCubePanel = panelScript; cubeParent.CubeIsPanel = true; panelObject.name = "ERROR HERE"; panelScript.cubeScriptParent = cubeParent; return(panelObject); }
private static void SetUpFloorPanel(CubeLocationScript neighbourHalfScript, PanelPieceScript panelScript) { Vector3 cubeHalfLoc = neighbourHalfScript.CubeStaticLocVector; Vector3 leftVect = new Vector3(cubeHalfLoc.x, cubeHalfLoc.y - 1, cubeHalfLoc.z); CubeLocationScript cubeScriptLeft = LocationManager.GetLocationScript_CLIENT(leftVect); // underneath panel if (cubeScriptLeft != null) { panelScript.cubeScriptLeft = cubeScriptLeft; panelScript.cubeLeftVector = leftVect; panelScript.leftPosNode = new Vector3(0, 0, 0); SetHumanCubeRules(cubeScriptLeft, false, false, false); SetAlienCubeRules(cubeScriptLeft, true, true, true); } Vector3 rightVect = new Vector3(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; panelScript.rightPosNode = new Vector3(0, 0, 0); SetHumanCubeRules(cubeScriptRight, true, true, true); SetAlienCubeRules(cubeScriptRight, true, true, true); } if (cubeScriptLeft == null) { panelScript.cubeScriptLeft = panelScript.cubeScriptRight; panelScript.cubeLeftVector = panelScript.cubeRightVector; panelScript.leftPosNode = panelScript.rightPosNode; //Debug.LogWarning("cubeScript == null so making neighbours same cube"); } if (cubeScriptRight == null) { panelScript.cubeScriptRight = panelScript.cubeScriptLeft; panelScript.cubeRightVector = panelScript.cubeLeftVector; panelScript.rightPosNode = panelScript.leftPosNode; //Debug.LogWarning("cubeScript == null so making neighbours same cube"); } }
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"); } }
// 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, PanelPieceScript panelScript) { Vector3 cubeLoc = cubeScript.CubeStaticLocVector; Vector3 rightVect = new Vector3(cubeLoc.x, cubeLoc.y + 2, cubeLoc.z); // OnTop ( I think) CubeLocationScript cubeScriptRight = LocationManager.GetLocationScript_CLIENT(rightVect); if (cubeScriptRight != null) { panelScript.cubeScriptRight = cubeScriptRight; panelScript.cubeRightVector = rightVect; panelScript.rightPosNode = new Vector3(0, 4.5f, 0); // future issue here if want to move unit bit further on x,z axis on slope SetHumanCubeRules(cubeScriptRight, true, true, true); SetAlienCubeRules(cubeScriptRight, true, true, true); } Vector3 leftVect = new Vector3(cubeLoc.x, cubeLoc.y - 2, cubeLoc.z); // Underneath ( I think) CubeLocationScript cubeScriptLeft = LocationManager.GetLocationScript_CLIENT(leftVect); if (cubeScriptLeft != null) { panelScript.cubeScriptLeft = cubeScriptLeft; panelScript.cubeLeftVector = leftVect; panelScript.leftPosNode = new Vector3(0, -4.5f, 0); // future issue here if want to move unit bit further on x,z axis on slope SetHumanCubeRules(cubeScriptLeft, true, true, true); SetAlienCubeRules(cubeScriptLeft, true, true, true); } if (cubeScriptLeft == null) { panelScript.cubeScriptLeft = panelScript.cubeScriptRight; panelScript.cubeLeftVector = panelScript.cubeRightVector; panelScript.leftPosNode = panelScript.rightPosNode; //Debug.LogWarning("cubeScript == null so making neighbours same cube"); } if (cubeScriptRight == null) { panelScript.cubeScriptRight = panelScript.cubeScriptLeft; panelScript.cubeRightVector = panelScript.cubeLeftVector; panelScript.rightPosNode = panelScript.leftPosNode; //Debug.LogWarning("cubeScript == null so making neighbours same cube"); } }
//////////////////////////////////////////////// public GameObject CreatePanelObject(string panelName, Transform parent) { GameObject panelObject = Instantiate(_panelPrefab, parent, false); panelObject.transform.SetParent(parent); PanelPieceScript panelScript = panelObject.gameObject.GetComponent <PanelPieceScript>(); CubeLocationScript cubeScript = parent.gameObject.GetComponent <CubeLocationScript>(); cubeScript._panelScriptChild = panelScript; cubeScript.CubeIsPanel = true; panelObject.name = (panelName); panelScript.cubeScriptParent = cubeScript; panelScript._camera = CameraManager.Camera_Agent._camera; return(panelObject); }
//////////////////////////////////////////////// //////////////////////////////////////////////// public static void CreatePanelForCube(int[] cubeData, CubeLocationScript cubeScript) { GameObject panelObject = WorldBuilder._nodeBuilder.CreatePanelObject(cubeScript); PanelPieceScript panelScript = panelObject.GetComponent <PanelPieceScript>(); int rotX = cubeData[3]; int rotY = cubeData[4]; int rotZ = cubeData[5]; panelScript.cubeDataRotX = rotX; panelScript.cubeDataRotY = rotY; panelScript.cubeDataRotZ = rotZ; panelObject.transform.localPosition = new Vector3Int(0, 0, 0); panelObject.transform.localEulerAngles = new Vector3Int(rotX, rotY, rotZ); string name = ""; if (rotX == 90 && rotY == 0 && rotZ == 0) // Floor { cubeScript.CubeIsSlope = false; //panelObject.transform.localScale = new Vector3Int(1, 1, 1); name = "Panel_Floor"; } else if ((rotX == 0 && rotY == 90 && rotZ == 0) || (rotX == 0 && rotY == 0 && rotZ == 0)) // Wall { cubeScript.CubeIsSlope = false; //panelObject.transform.localScale = new Vector3Int(1, 1, 1); name = "Panel_Wall"; } else { cubeScript.CubeIsSlope = true; panelObject.transform.localScale = new Vector3Int(20, 30, 1); name = "Panel_Angle"; } panelObject.transform.tag = name; panelScript.name = name; panelScript._panelYAxis = rotY; }
//////////////////////////////////////////////// private void SetNextTarget() { _currTargetCubeID = _nodes[locCount]; _currTargetScript = LocationManager.GetLocationScript_CLIENT(_currTargetCubeID); if (_currTargetScript._platform_Panel_Cube._panelScriptChild != null) { _currTargetPanelScript = _currTargetScript._platform_Panel_Cube._panelScriptChild; if (!LocationManager.SetUnitOnCube_CLIENT(GetComponent <UnitScript>(), _currTargetCubeID)) { Debug.LogWarning("units movement interrupted >> recalculating"); moveInProgress = false; ResetValues(); if (MovementManager.BuildMovementPath(_finalTargetScript)) { MovementManager.MakeActiveUnitMove_CLIENT(); } } } }
//////////////////////////////////////////////// public void MoveUnit(List <Vector3Int> path) { AnimationManager.SetAnimatorBool(_animators, "Combat_Walk", true); _unitsSpeed = gameObject.transform.GetComponent <UnitScript>().UnitCombatStats[1]; // movement _finalTargetLoc = path[path.Count - 1]; _finalTargetScript = LocationManager.GetLocationScript_CLIENT(_finalTargetLoc); _currCubeScript = unitScript.CubeUnitIsOn; _currPanelScript = _currCubeScript._platform_Panel_Cube.GetCubePanel; _currObjectScript = _currPanelScript.gameObject.GetComponent <ObjectScript>(); if (path.Count > 0) { if (moveInProgress) { foreach (Vector3Int nodeVect in _nodes) { LocationManager.GetLocationScript_CLIENT(nodeVect)._platform_Panel_Cube.GetCubePanel.PanelIsDEActive(); } _newPathNodes = path; _newPathSet = true; } else { ResetValues(); _nodes = path; moveInProgress = true; foreach (Vector3Int nodeVect in _nodes) { LocationManager.GetLocationScript_CLIENT(nodeVect)._platform_Panel_Cube.GetCubePanel.PanelIsActive(); } SetNextTarget(); } } }
//////////////////////////////////////////////// //////////////////////////////////////////////// public static void CreatePanelForCube(string panelName, CubeLocationScript cubeScript, int angle, int rotations) { Transform cubeTrans = cubeScript.GetComponent <Transform>(); GameObject panelObject = WorldBuilder._nodeBuilder.CreatePanelObject(panelName, cubeTrans); PanelPieceScript panelScript = panelObject.GetComponent <PanelPieceScript>(); switch (panelName) { case "Floor": panelObject.transform.localPosition = new Vector3(0, 0, 0); panelObject.transform.localEulerAngles = new Vector3(90, angle, 0); panelObject.transform.tag = ("Panel_Floor"); break; case "Wall": panelObject.transform.localPosition = new Vector3(0, 0, 0); if (rotations == 0) // Seems good { if (angle == 0) // across { if (cubeScript.CubeAngle == 0) { angle = 180; } else if (cubeScript.CubeAngle == -180) { angle = 180; } else if (cubeScript.CubeAngle == -90) { angle = 0; } else if (cubeScript.CubeAngle == -270) { angle = 0; } else { Debug.Log("Got a wierd issue here!!"); } } else if (angle == 90) // Down { if (cubeScript.CubeAngle == 0) { angle = 270; } else if (cubeScript.CubeAngle == -180) { angle = 270; } else if (cubeScript.CubeAngle == -90) { angle = 90; } else if (cubeScript.CubeAngle == -270) { angle = 90; } else { Debug.Log("Got a wierd issue here!!"); } } else { Debug.Log("Got a wierd issue here!!"); } } else if (rotations == 1) { if (angle == 0) // across { if (cubeScript.CubeAngle == 0) { angle = 180; } else if (cubeScript.CubeAngle == -180) { angle = 180; } else if (cubeScript.CubeAngle == -90) { angle = 0; } else if (cubeScript.CubeAngle == -270) { angle = 0; } else { Debug.Log("Got a wierd issue here!!"); } } else if (angle == 90) // Down { if (cubeScript.CubeAngle == 0) { angle = 90; } else if (cubeScript.CubeAngle == -180) { angle = 90; } else if (cubeScript.CubeAngle == -90) { angle = 270; } else if (cubeScript.CubeAngle == -270) { angle = 270; } else { Debug.Log("Got a wierd issue here!!"); } } else { Debug.Log("Got a wierd issue here!!"); } } else if (rotations == 2) { if (angle == 0) // across { if (cubeScript.CubeAngle == 0) { angle = 0; } else if (cubeScript.CubeAngle == -180) { angle = 0; } else if (cubeScript.CubeAngle == -90) { angle = 0; } else if (cubeScript.CubeAngle == -270) { angle = 0; } else { Debug.Log("Got a wierd issue here!!"); } } else if (angle == 90) // Down { if (cubeScript.CubeAngle == 0) { angle = 90; } else if (cubeScript.CubeAngle == -180) { angle = 90; } else if (cubeScript.CubeAngle == -90) { angle = 270; } else if (cubeScript.CubeAngle == -270) { angle = 270; } else { Debug.Log("Got a wierd issue here!!"); } } else { Debug.Log("Got a wierd issue here!!"); } } else if (rotations == 3) { if (angle == 0) // across { if (cubeScript.CubeAngle == 0) { angle = 0; } else if (cubeScript.CubeAngle == -180) { angle = 0; } else if (cubeScript.CubeAngle == -90) { angle = 180; } else if (cubeScript.CubeAngle == -270) { angle = 180; } else { Debug.Log("Got a wierd issue here!!"); } } else if (angle == 90) // Down { if (cubeScript.CubeAngle == 0) { angle = 90; } else if (cubeScript.CubeAngle == -180) { angle = 90; } else if (cubeScript.CubeAngle == -90) { angle = 90; } else if (cubeScript.CubeAngle == -270) { angle = 90; } else { Debug.Log("Got a wierd issue here!!"); } } else { Debug.Log("Got a wierd issue here!!"); } } panelObject.transform.localEulerAngles = new Vector3(0, angle, 0); // here needs to be set to only 2 options panelObject.transform.tag = ("Panel_Wall"); break; case "FloorAngle": cubeScript.CubeIsSlope = true; panelObject.transform.localPosition = new Vector3(0, 0, 0); panelObject.transform.localEulerAngles = new Vector3(-135, angle, 0); panelObject.transform.localScale = new Vector3(20, 30, 1); panelObject.transform.tag = ("Panel_FloorAngle"); break; case "CeilingAngle": cubeScript.CubeIsSlope = true; panelObject.transform.localPosition = new Vector3(0, 0, 0); panelObject.transform.localEulerAngles = new Vector3(135, angle, 0); panelObject.transform.localScale = new Vector3(20, 30, 1); panelObject.transform.tag = ("Panel_CeilingAngle"); break; default: Debug.Log("Got a wierd issue here!!"); break; } panelScript.panelAngle = angle; cubeScript.PanelChildAngle = angle; }
private static void SetUpWallPanel(CubeLocationScript neighbourHalfScript) { PanelPieceScript panelScript = neighbourHalfScript._panelScriptChild; 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 == 0) { 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 == 90) { 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"); } CubeLocationScript cubeScriptLeft = LocationManager.GetLocationScript_CLIENT(leftVect); if (cubeScriptLeft != null && !cubeScriptLeft.CubeIsPanel) { panelScript.cubeScriptLeft = cubeScriptLeft; panelScript.cubeLeftVector = leftVect; cubeScriptLeft._platform_Panel_Cube = neighbourHalfScript; cubeScriptLeft._movementOffset_Left = Vector3Int.zero; if (panelScript._isLadder) { SetHumanCubeRules(cubeScriptLeft, true, true, true); cubeScriptLeft.IS_HUMAN_MOVABLE = true; } else { SetHumanCubeRules(cubeScriptLeft, false, false, false); cubeScriptLeft.IS_HUMAN_MOVABLE = false; } SetAlienCubeRules(cubeScriptLeft, true, true, true); cubeScriptLeft.IS_ALIEN_MOVABLE = true; } else { Debug.LogError("f**k got an issue here"); } CubeLocationScript cubeScriptRight = LocationManager.GetLocationScript_CLIENT(rightVect); if (cubeScriptRight != null && !cubeScriptRight.CubeIsPanel) { panelScript.cubeScriptRight = cubeScriptRight; panelScript.cubeRightVector = rightVect; cubeScriptRight._platform_Panel_Cube = neighbourHalfScript; cubeScriptRight._movementOffset_Right = Vector3Int.zero; if (panelScript._isLadder) { SetHumanCubeRules(cubeScriptRight, true, true, true); cubeScriptRight.IS_HUMAN_MOVABLE = true; } else { SetHumanCubeRules(cubeScriptRight, false, false, false); cubeScriptRight.IS_HUMAN_MOVABLE = false; } SetAlienCubeRules(cubeScriptRight, true, true, true); cubeScriptRight.IS_ALIEN_MOVABLE = true; } else { Debug.LogError("f**k got an issue here"); } }
// 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._panelScriptChild; 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; SetHumanCubeRules(cubeScriptLeft, true, true, true); SetAlienCubeRules(cubeScriptLeft, true, true, true); cubeScriptLeft.IS_HUMAN_MOVABLE = true; cubeScriptLeft.IS_ALIEN_MOVABLE = true; } else { Debug.LogError("f**k got an issue here"); } 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; SetHumanCubeRules(cubeScriptRight, true, true, true); SetAlienCubeRules(cubeScriptRight, true, true, true); cubeScriptRight.IS_HUMAN_MOVABLE = true; cubeScriptRight.IS_ALIEN_MOVABLE = true; } else { Debug.LogError("f**k got an issue here"); } }
public void CreatePanelForCube(string panel, Transform cubeTrans, int layerCount, int angle, int rotations) { GameObject panelObject = Instantiate(panelPrefab, cubeTrans, false); // empty cube panelObject.transform.SetParent(cubeTrans); panelObject.name = (panel); //panelObject.gameObject.layer = LayerMask.NameToLayer ("Floor" + layerCount.ToString ()); PanelPieceScript panelScript = panelObject.gameObject.GetComponent <PanelPieceScript> (); CubeLocationScript cubeScript = cubeTrans.gameObject.GetComponent <CubeLocationScript> (); cubeScript._panelScriptChild = panelScript; cubeScript._isPanel = true; panelScript.cubeScriptParent = cubeScript; panelScript._camera = _gameManager._playerManager._playerObject.GetComponent <Camera>(); switch (panel) { case "Floor": panelObject.transform.localPosition = new Vector3(0, 0, 0); panelObject.transform.localEulerAngles = new Vector3(90, angle, 0); panelObject.transform.tag = ("Panel_Floor"); break; case "Wall": panelObject.transform.localPosition = new Vector3(0, 0, 0); if (rotations == 0) // Seems good { if (angle == 0) // across { if (cubeScript.CubeAngle == 0) { angle = 180; } else if (cubeScript.CubeAngle == -180) { angle = 180; } else if (cubeScript.CubeAngle == -90) { angle = 0; } else if (cubeScript.CubeAngle == -270) { angle = 0; } else { Debug.Log("Got a wierd issue here!!"); } } else if (angle == 90) // Down { if (cubeScript.CubeAngle == 0) { angle = 270; } else if (cubeScript.CubeAngle == -180) { angle = 270; } else if (cubeScript.CubeAngle == -90) { angle = 90; } else if (cubeScript.CubeAngle == -270) { angle = 90; } else { Debug.Log("Got a wierd issue here!!"); } } else { Debug.Log("Got a wierd issue here!!"); } } else if (rotations == 1) { if (angle == 0) // across { if (cubeScript.CubeAngle == 0) { angle = 180; } else if (cubeScript.CubeAngle == -180) { angle = 180; } else if (cubeScript.CubeAngle == -90) { angle = 0; } else if (cubeScript.CubeAngle == -270) { angle = 0; } else { Debug.Log("Got a wierd issue here!!"); } } else if (angle == 90) // Down { if (cubeScript.CubeAngle == 0) { angle = 90; } else if (cubeScript.CubeAngle == -180) { angle = 90; } else if (cubeScript.CubeAngle == -90) { angle = 270; } else if (cubeScript.CubeAngle == -270) { angle = 270; } else { Debug.Log("Got a wierd issue here!!"); } } else { Debug.Log("Got a wierd issue here!!"); } } else if (rotations == 2) { if (angle == 0) // across { if (cubeScript.CubeAngle == 0) { angle = 0; } else if (cubeScript.CubeAngle == -180) { angle = 0; } else if (cubeScript.CubeAngle == -90) { angle = 0; } else if (cubeScript.CubeAngle == -270) { angle = 0; } else { Debug.Log("Got a wierd issue here!!"); } } else if (angle == 90) // Down { if (cubeScript.CubeAngle == 0) { angle = 90; } else if (cubeScript.CubeAngle == -180) { angle = 90; } else if (cubeScript.CubeAngle == -90) { angle = 270; } else if (cubeScript.CubeAngle == -270) { angle = 270; } else { Debug.Log("Got a wierd issue here!!"); } } else { Debug.Log("Got a wierd issue here!!"); } } else if (rotations == 3) { if (angle == 0) // across { if (cubeScript.CubeAngle == 0) { angle = 0; } else if (cubeScript.CubeAngle == -180) { angle = 0; } else if (cubeScript.CubeAngle == -90) { angle = 180; } else if (cubeScript.CubeAngle == -270) { angle = 180; } else { Debug.Log("Got a wierd issue here!!"); } } else if (angle == 90) // Down { if (cubeScript.CubeAngle == 0) { angle = 90; } else if (cubeScript.CubeAngle == -180) { angle = 90; } else if (cubeScript.CubeAngle == -90) { angle = 90; } else if (cubeScript.CubeAngle == -270) { angle = 90; } else { Debug.Log("Got a wierd issue here!!"); } } else { Debug.Log("Got a wierd issue here!!"); } } panelObject.transform.localEulerAngles = new Vector3(0, angle, 0); // here needs to be set to only 2 options panelObject.transform.tag = ("Panel_Wall"); break; case "FloorAngle": panelObject.transform.localPosition = new Vector3(0, 0, 0); panelObject.transform.localEulerAngles = new Vector3(-135, angle, 0); panelObject.transform.localScale = new Vector3(20, 30, 1); panelObject.transform.tag = ("Panel_FloorAngle"); break; case "CeilingAngle": panelObject.transform.localPosition = new Vector3(0, 0, 0); panelObject.transform.localEulerAngles = new Vector3(135, angle, 0); panelObject.transform.localScale = new Vector3(20, 30, 1); panelObject.transform.tag = ("Panel_CeilingAngle"); break; default: Debug.Log("Got a wierd issue here!!"); break; } panelScript.panelAngle = angle; }
private void SetUpFloorPanel(CubeLocationScript cubeScript, PanelPieceScript panelScript) { Vector3 leftVect, rightVect; CubeLocationScript cubeScriptLeft = null; CubeLocationScript cubeScriptRight = null; Vector3 cubeLoc = cubeScript.CubeLocVector; leftVect = new Vector3(cubeLoc.x, cubeLoc.y - 1, cubeLoc.z); cubeScriptLeft = _locationManager.GetLocationScript(leftVect); // underneath panel if (cubeScriptLeft != null) { panelScript.cubeScriptLeft = cubeScriptLeft; panelScript.cubeLeftVector = leftVect; panelScript.leftPosNode = new Vector3(0, 0, -4.5f); if (!cubeScriptLeft._isPanel) { cubeScriptLeft.IsAlienWalkable = true; } // make edges empty spaces for climbing over MakeClimbableEdges(new Vector3(leftVect.x, leftVect.y, leftVect.z - 2)); // South MakeClimbableEdges(new Vector3(leftVect.x - 2, leftVect.y, leftVect.z)); // West MakeClimbableEdges(new Vector3(leftVect.x, leftVect.y, leftVect.z + 2)); // North MakeClimbableEdges(new Vector3(leftVect.x + 2, leftVect.y, leftVect.z)); // East } rightVect = new Vector3(cubeLoc.x, cubeLoc.y + 1, cubeLoc.z); cubeScriptRight = _locationManager.GetLocationScript(rightVect); // Ontop of panel if (cubeScriptRight != null) { panelScript.cubeScriptRight = cubeScriptRight; panelScript.cubeRightVector = rightVect; panelScript.rightPosNode = new Vector3(0, 0, 4.5f); if (!cubeScriptRight._isPanel) { cubeScriptRight.IsHumanWalkable = true; cubeScriptRight.IsAlienWalkable = true; } // make edges empty spaces for climbing over MakeClimbableEdges(new Vector3(rightVect.x, rightVect.y, rightVect.z - 2)); // South MakeClimbableEdges(new Vector3(rightVect.x - 2, rightVect.y, rightVect.z)); // West MakeClimbableEdges(new Vector3(rightVect.x, rightVect.y, rightVect.z + 2)); // North MakeClimbableEdges(new Vector3(rightVect.x + 2, rightVect.y, rightVect.z)); // East } // 8 points for each panel /* * DoHalfPointsForWalls (new Vector3 (cubeLoc.x - 1, cubeLoc.y, cubeLoc.z - 1)); * DoHalfPointsForWalls (new Vector3 (cubeLoc.x + 0, cubeLoc.y, cubeLoc.z - 1)); * DoHalfPointsForWalls (new Vector3 (cubeLoc.x + 1, cubeLoc.y, cubeLoc.z - 1)); * DoHalfPointsForWalls (new Vector3 (cubeLoc.x - 1, cubeLoc.y, cubeLoc.z + 0)); * // middle * DoHalfPointsForWalls (new Vector3 (cubeLoc.x + 1, cubeLoc.y, cubeLoc.z + 0)); * DoHalfPointsForWalls (new Vector3 (cubeLoc.x - 1, cubeLoc.y, cubeLoc.z + 1)); * DoHalfPointsForWalls (new Vector3 (cubeLoc.x + 0, cubeLoc.y, cubeLoc.z + 1)); * DoHalfPointsForWalls (new Vector3 (cubeLoc.x + 1, cubeLoc.y, cubeLoc.z + 1)); */ if (cubeScriptLeft == null) { panelScript.cubeScriptLeft = panelScript.cubeScriptRight; panelScript.cubeLeftVector = panelScript.cubeRightVector; panelScript.leftPosNode = panelScript.rightPosNode; //Debug.LogWarning("cubeScript == null so making neighbours same cube"); } if (cubeScriptRight == null) { panelScript.cubeScriptRight = panelScript.cubeScriptLeft; panelScript.cubeRightVector = panelScript.cubeLeftVector; panelScript.rightPosNode = panelScript.leftPosNode; //Debug.LogWarning("cubeScript == null so making neighbours same cube"); } }
//////////////////////////////////////////////// public void ChangeUnitsAngleAndCameraPivot() { PanelPieceScript panelScript = null; if (_currTargetPanelScript != null) { panelScript = _currTargetPanelScript; } else { panelScript = unitScript.CubeUnitIsOn._platform_Panel_Cube._panelScriptChild; } unitContainerTransformLOCAL.localEulerAngles = new Vector3(0, unitContainerTransformLOCAL.localEulerAngles.y, 0); unitContainerPIVOT.localEulerAngles = new Vector3(0, 0, 0); bool localState = CameraPivot.CameraStateIsLocal; switch (panelScript.name) { case "Panel_Floor": unitScript.UnitAngle = 0; unitContainerAnglesGLOBAL.localEulerAngles = new Vector3(0, 0, 0); break; case "Panel_Wall": unitScript.UnitAngle = 90; unitContainerAnglesGLOBAL.localEulerAngles = new Vector3(0, 0, 90); if (!localState) { unitContainerPIVOT.localEulerAngles = new Vector3(0, 0, -90); } break; case "Panel_Angle": // angles put in half points unitScript.UnitAngle = 45; int panelYaxis = _currTargetPanelScript._panelYAxis; if (panelYaxis == 0) { unitContainerAnglesGLOBAL.localEulerAngles = new Vector3(-45, 0, 0); if (!localState) { unitContainerPIVOT.localEulerAngles = new Vector3(45, 0, 0); } } else if (panelYaxis == 90) { unitContainerAnglesGLOBAL.localEulerAngles = new Vector3(0, 0, 45); if (!localState) { unitContainerPIVOT.localEulerAngles = new Vector3(0, 0, -45); } } else if (panelYaxis == 180) { unitContainerAnglesGLOBAL.localEulerAngles = new Vector3(45, 0, 0); if (!localState) { unitContainerPIVOT.localEulerAngles = new Vector3(-45, 0, 0); } } else if (panelYaxis == 270) { unitContainerAnglesGLOBAL.localEulerAngles = new Vector3(0, 0, -45); if (!localState) { unitContainerPIVOT.localEulerAngles = new Vector3(0, 0, 45); } } break; default: Debug.LogError("F**K got error here " + _currTargetPanelScript.name); break; } }
private void SetUpFloorPanel(CubeLocationScript cubeScript, PanelPieceScript panelScript) { Vector3 leftVect, rightVect; GameObject cubeLeft, cubeRight; CubeLocationScript cubeScriptLeft = null; CubeLocationScript cubeScriptRight = null; Vector3 cubeLoc = cubeScript.cubeLoc; leftVect = new Vector3(cubeLoc.x, cubeLoc.y - 1, cubeLoc.z); cubeScriptLeft = _locationManager.GetLocationScript(leftVect); if (cubeScriptLeft != null) { panelScript.cubeScriptLeft = cubeScriptLeft; panelScript.cubeLeftVector = leftVect; panelScript.leftPosNode = new Vector3(0, 0, -4.5f); if (!cubeScriptLeft._isPanel) { cubeScriptLeft._isHumanWalkable = true; } // make edges empty spaces for climbing over MakeClimbableEdges(new Vector3(leftVect.x, leftVect.y, leftVect.z - 2)); // South MakeClimbableEdges(new Vector3(leftVect.x - 2, leftVect.y, leftVect.z)); // West MakeClimbableEdges(new Vector3(leftVect.x, leftVect.y, leftVect.z + 2)); // North MakeClimbableEdges(new Vector3(leftVect.x + 2, leftVect.y, leftVect.z)); // East } rightVect = new Vector3(cubeLoc.x, cubeLoc.y + 1, cubeLoc.z); cubeScriptRight = _locationManager.GetLocationScript(rightVect); if (cubeScriptRight != null) { panelScript.cubeScriptRight = cubeScriptRight; panelScript.cubeRightVector = rightVect; panelScript.rightPosNode = new Vector3(0, 0, 4.5f); if (!cubeScriptRight._isPanel) { cubeScriptRight._isHumanWalkable = true; } // make edges empty spaces for climbing over MakeClimbableEdges(new Vector3(rightVect.x, rightVect.y, rightVect.z - 2)); // South MakeClimbableEdges(new Vector3(rightVect.x - 2, rightVect.y, rightVect.z)); // West MakeClimbableEdges(new Vector3(rightVect.x, rightVect.y, rightVect.z + 2)); // North MakeClimbableEdges(new Vector3(rightVect.x + 2, rightVect.y, rightVect.z)); // East } // 8 points for each panel DoHalfPointsForWalls(new Vector3(cubeLoc.x - 1, cubeLoc.y, cubeLoc.z - 1)); DoHalfPointsForWalls(new Vector3(cubeLoc.x + 0, cubeLoc.y, cubeLoc.z - 1)); DoHalfPointsForWalls(new Vector3(cubeLoc.x + 1, cubeLoc.y, cubeLoc.z - 1)); DoHalfPointsForWalls(new Vector3(cubeLoc.x - 1, cubeLoc.y, cubeLoc.z + 0)); // middle DoHalfPointsForWalls(new Vector3(cubeLoc.x + 1, cubeLoc.y, cubeLoc.z + 0)); DoHalfPointsForWalls(new Vector3(cubeLoc.x - 1, cubeLoc.y, cubeLoc.z + 1)); DoHalfPointsForWalls(new Vector3(cubeLoc.x + 0, cubeLoc.y, cubeLoc.z + 1)); DoHalfPointsForWalls(new Vector3(cubeLoc.x + 1, cubeLoc.y, cubeLoc.z + 1)); if (cubeScriptLeft == null) { panelScript.cubeScriptLeft = panelScript.cubeScriptRight; panelScript.cubeLeftVector = panelScript.cubeRightVector; panelScript.leftPosNode = panelScript.rightPosNode; } if (cubeScriptRight == null) { panelScript.cubeScriptRight = panelScript.cubeScriptLeft; panelScript.cubeRightVector = panelScript.cubeLeftVector; panelScript.rightPosNode = panelScript.leftPosNode; } }
private void SetUpWallPanel(CubeLocationScript cubeScript, PanelPieceScript panelScript) { Vector3 cubeLoc = cubeScript.CubeLocVector; Vector3 leftVect, rightVect; CubeLocationScript cubeScriptLeft = null; CubeLocationScript cubeScriptRight = null; int cubeAngle = cubeScript.CubeAngle; int panelAngle = panelScript.panelAngle; //panelScript._isLadder = true; int result = (cubeAngle - panelAngle); result = (((result + 180) % 360 + 360) % 360) - 180; //Debug.Log ("cubeAngle: " + cubeAngle + " panelAngle: " + panelAngle + " result: " + result); if (result == 180 || result == -180 || result == 0) // Down { leftVect = new Vector3(cubeLoc.x, cubeLoc.y, cubeLoc.z - 1); cubeScriptLeft = _locationManager.GetLocationScript(leftVect); if (cubeScriptLeft != null) { panelScript.cubeScriptLeft = cubeScriptLeft; panelScript.cubeLeftVector = leftVect; panelScript.leftPosNode = new Vector3(0, 0, -4.5f); if (panelScript._isLadder) { cubeScriptLeft.IsHumanClimbable = true; } cubeScriptLeft.IsAlienClimbable = true; // make edges empty spaces for climbing over /* * MakeClimbableEdges (new Vector3 (leftVect.x, leftVect.y - 2, leftVect.z)); // South * MakeClimbableEdges (new Vector3 (leftVect.x - 2, leftVect.y, leftVect.z)); // West * MakeClimbableEdges (new Vector3 (leftVect.x, leftVect.y + 2, leftVect.z)); // North * MakeClimbableEdges (new Vector3 (leftVect.x + 2, leftVect.y, leftVect.z)); // East */ } rightVect = new Vector3(cubeLoc.x, cubeLoc.y, cubeLoc.z + 1); cubeScriptRight = _locationManager.GetLocationScript(rightVect); if (cubeScriptRight != null) { panelScript.cubeScriptRight = cubeScriptRight; panelScript.cubeRightVector = rightVect; panelScript.rightPosNode = new Vector3(0, 0, 4.5f); if (panelScript._isLadder && !cubeScriptRight._isPanel) { cubeScriptRight.IsHumanClimbable = true; } cubeScriptRight.IsAlienClimbable = true; // make edges empty spaces for climbing over /* * MakeClimbableEdges (new Vector3 (rightVect.x, rightVect.y - 2, rightVect.z)); // South * MakeClimbableEdges (new Vector3 (rightVect.x - 2, rightVect.y, rightVect.z)); // West * MakeClimbableEdges (new Vector3 (rightVect.x, rightVect.y + 2, rightVect.z)); // North * MakeClimbableEdges (new Vector3 (rightVect.x + 2, rightVect.y, rightVect.z)); // East */ } // 8 points for each panel /* * DoHalfPointsForWalls (new Vector3 (cubeLoc.x - 1, cubeLoc.y - 1, cubeLoc.z + 0)); * DoHalfPointsForWalls (new Vector3 (cubeLoc.x + 0, cubeLoc.y - 1, cubeLoc.z + 0)); * DoHalfPointsForWalls (new Vector3 (cubeLoc.x + 1, cubeLoc.y - 1, cubeLoc.z + 0)); * DoHalfPointsForWalls (new Vector3 (cubeLoc.x - 1, cubeLoc.y + 0, cubeLoc.z + 0)); * // middle * DoHalfPointsForWalls (new Vector3 (cubeLoc.x + 1, cubeLoc.y + 0, cubeLoc.z + 0)); * DoHalfPointsForWalls (new Vector3 (cubeLoc.x - 1, cubeLoc.y + 1, cubeLoc.z + 0)); * DoHalfPointsForWalls (new Vector3 (cubeLoc.x + 0, cubeLoc.y + 1, cubeLoc.z + 0)); * DoHalfPointsForWalls (new Vector3 (cubeLoc.x + 1, cubeLoc.y + 1, cubeLoc.z + 0)); */ } else if (result == 90 || result == -90) //across { leftVect = new Vector3(cubeLoc.x - 1, cubeLoc.y, cubeLoc.z); cubeScriptLeft = _locationManager.GetLocationScript(leftVect); if (cubeScriptLeft != null) { panelScript.cubeScriptLeft = cubeScriptLeft; panelScript.cubeLeftVector = leftVect; panelScript.leftPosNode = new Vector3(-4.5f, 0, 0); if (panelScript._isLadder && !cubeScriptLeft._isPanel) { cubeScriptLeft.IsHumanClimbable = true; } cubeScriptLeft.IsAlienClimbable = true; // make edges empty spaces for climbing over /* * MakeClimbableEdges (new Vector3 (leftVect.x, leftVect.y - 2, leftVect.z)); // South * MakeClimbableEdges (new Vector3 (leftVect.x, leftVect.y, leftVect.z - 2)); // West * MakeClimbableEdges (new Vector3 (leftVect.x, leftVect.y + 2, leftVect.z)); // North * MakeClimbableEdges (new Vector3 (leftVect.x, leftVect.y, leftVect.z + 2)); // East */ } rightVect = new Vector3(cubeLoc.x + 1, cubeLoc.y, cubeLoc.z); cubeScriptRight = _locationManager.GetLocationScript(rightVect); if (cubeScriptRight != null) { panelScript.cubeScriptRight = cubeScriptRight; panelScript.cubeRightVector = rightVect; panelScript.rightPosNode = new Vector3(4.5f, 0, 0); if (panelScript._isLadder) { cubeScriptRight.IsHumanClimbable = true; } cubeScriptRight.IsAlienClimbable = true; // make edges empty spaces for climbing over /* * MakeClimbableEdges (new Vector3 (rightVect.x, rightVect.y - 2, rightVect.z)); // South * MakeClimbableEdges (new Vector3 (rightVect.x, rightVect.y, rightVect.z - 2)); // West * MakeClimbableEdges (new Vector3 (rightVect.x, rightVect.y + 2, rightVect.z)); // North * MakeClimbableEdges (new Vector3 (rightVect.x, rightVect.y, rightVect.z + 2)); // East */ } // 8 points for each panel /* * DoHalfPointsForWalls (new Vector3 (cubeLoc.x + 0, cubeLoc.y - 1, cubeLoc.z - 1)); * DoHalfPointsForWalls (new Vector3 (cubeLoc.x + 0, cubeLoc.y - 1, cubeLoc.z + 0)); * DoHalfPointsForWalls (new Vector3 (cubeLoc.x + 0, cubeLoc.y - 1, cubeLoc.z + 1)); * DoHalfPointsForWalls (new Vector3 (cubeLoc.x + 0, cubeLoc.y + 0, cubeLoc.z - 1)); * // middle * DoHalfPointsForWalls (new Vector3 (cubeLoc.x + 0, cubeLoc.y + 0, cubeLoc.z + 1)); * DoHalfPointsForWalls (new Vector3 (cubeLoc.x + 0, cubeLoc.y + 1, cubeLoc.z - 1)); * DoHalfPointsForWalls (new Vector3 (cubeLoc.x + 0, cubeLoc.y + 1, cubeLoc.z + 0)); * DoHalfPointsForWalls (new Vector3 (cubeLoc.x + 0, cubeLoc.y + 1, cubeLoc.z + 1)); */ } else { Debug.Log("SOMETHING weird: cubeAngle: " + cubeAngle + " panelAngle: " + panelAngle + " <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<"); } if (cubeScriptLeft == null) { panelScript.cubeScriptLeft = panelScript.cubeScriptRight; panelScript.cubeLeftVector = panelScript.cubeRightVector; panelScript.leftPosNode = panelScript.rightPosNode; } if (cubeScriptRight == null) { panelScript.cubeScriptRight = panelScript.cubeScriptLeft; panelScript.cubeRightVector = panelScript.cubeLeftVector; panelScript.rightPosNode = panelScript.leftPosNode; } }
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"); } }
private static void SetUpWallPanel(CubeLocationScript neighbourHalfScript, PanelPieceScript panelScript) { CubeLocationScript cubeScriptLeft = null; CubeLocationScript cubeScriptRight = null; Vector3 cubeHalfLoc = neighbourHalfScript.CubeStaticLocVector; int cubeAngle = neighbourHalfScript.CubeAngle; int panelAngle = panelScript.panelAngle; //panelScript._isLadder = true; int result = (cubeAngle - panelAngle); result = (((result + 180) % 360 + 360) % 360) - 180; //Debug.Log ("cubeAngle: " + cubeAngle + " panelAngle: " + panelAngle + " result: " + result); if (result == 180 || result == -180 || result == 0) // Down { Vector3 leftVect = new Vector3(cubeHalfLoc.x, cubeHalfLoc.y, cubeHalfLoc.z - 1); cubeScriptLeft = LocationManager.GetLocationScript_CLIENT(leftVect); if (cubeScriptLeft != null) { panelScript.cubeScriptLeft = cubeScriptLeft; panelScript.cubeLeftVector = leftVect; panelScript.leftPosNode = new Vector3(0, 0, 0); if (panelScript._isLadder) { SetHumanCubeRules(cubeScriptLeft, true, true, true); } else { SetHumanCubeRules(cubeScriptLeft, false, false, false); } SetAlienCubeRules(cubeScriptLeft, true, true, true); } Vector3 rightVect = new Vector3(cubeHalfLoc.x, cubeHalfLoc.y, cubeHalfLoc.z + 1); cubeScriptRight = LocationManager.GetLocationScript_CLIENT(rightVect); if (cubeScriptRight != null) { panelScript.cubeScriptRight = cubeScriptRight; panelScript.cubeRightVector = rightVect; panelScript.rightPosNode = new Vector3(0, 0, 0); if (panelScript._isLadder) { SetHumanCubeRules(cubeScriptRight, true, true, true); } else { SetHumanCubeRules(cubeScriptRight, false, false, false); } SetAlienCubeRules(cubeScriptRight, true, true, true); } } else if (result == 90 || result == -90) //across { Vector3 leftVect = new Vector3(cubeHalfLoc.x - 1, cubeHalfLoc.y, cubeHalfLoc.z); cubeScriptLeft = LocationManager.GetLocationScript_CLIENT(leftVect); if (cubeScriptLeft != null) { panelScript.cubeScriptLeft = cubeScriptLeft; panelScript.cubeLeftVector = leftVect; panelScript.leftPosNode = new Vector3(0, 0, 0); if (panelScript._isLadder) { SetHumanCubeRules(cubeScriptLeft, true, true, true); } else { SetHumanCubeRules(cubeScriptLeft, false, false, false); } SetAlienCubeRules(cubeScriptLeft, true, true, true); } Vector3 rightVect = new Vector3(cubeHalfLoc.x + 1, cubeHalfLoc.y, cubeHalfLoc.z); cubeScriptRight = LocationManager.GetLocationScript_CLIENT(rightVect); if (cubeScriptRight != null) { panelScript.cubeScriptRight = cubeScriptRight; panelScript.cubeRightVector = rightVect; panelScript.rightPosNode = new Vector3(0, 0, 0); if (panelScript._isLadder) { SetHumanCubeRules(cubeScriptRight, true, true, true); } else { SetHumanCubeRules(cubeScriptRight, false, false, false); } SetAlienCubeRules(cubeScriptRight, true, true, true); } } else { Debug.Log("SOMETHING weird: cubeAngle: " + cubeAngle + " panelAngle: " + panelAngle + " <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<"); } if (cubeScriptLeft == null) { panelScript.cubeScriptLeft = panelScript.cubeScriptRight; panelScript.cubeLeftVector = panelScript.cubeRightVector; panelScript.leftPosNode = panelScript.rightPosNode; } if (cubeScriptRight == null) { panelScript.cubeScriptRight = panelScript.cubeScriptLeft; panelScript.cubeRightVector = panelScript.cubeLeftVector; panelScript.rightPosNode = panelScript.leftPosNode; } }