//////////////////////////////////////////////// ////////////////////////////////////////////// // trying to connection neighbours early so this is here public static void SetPanelsNeighbours() { foreach (CubeLocationScript script in halfCubesWithPanels) { script.AssignCubeNeighbours(); Vector3Int cubeLoc = script.CubeID; CubeObjectTypes panelType = script.GetCubePanel.gameObject.GetComponent <ObjectScript>().objectType; int panelYAxis = script.GetCubePanel._panelYAxis; CubeLocationScript halfScript = null; switch (panelType) { case CubeObjectTypes.Panel_Floor: for (int i = 5; i <= 12; i++) { halfScript = LocationManager.GetHalfLocationScript_CLIENT(script.NeighbourHalfVects[i]); if (halfScript != null) { halfScript.CubeIsPanel = true; } ; } break; case CubeObjectTypes.Panel_Wall: if (panelYAxis == 0) { int[] indexs = new int[8] { 0, 2, 4, 6, 11, 13, 15, 17 }; foreach (int i in indexs) { halfScript = LocationManager.GetHalfLocationScript_CLIENT(script.NeighbourHalfVects[i]); if (halfScript != null) { halfScript.CubeIsPanel = true; } ; } } if (panelYAxis == 90) { int[] indexs = new int[8] { 1, 2, 3, 8, 9, 14, 15, 16 }; foreach (int i in indexs) { halfScript = LocationManager.GetHalfLocationScript_CLIENT(script.NeighbourHalfVects[i]); if (halfScript != null) { halfScript.CubeIsPanel = true; } ; } } break; case CubeObjectTypes.Panel_Angle: if (panelYAxis == 0) { } if (panelYAxis == 90) { } if (panelYAxis == 180) { } if (panelYAxis == 270) { } break; default: break; } } halfCubesWithPanels.Clear(); }
////////////////////////////////////////////// void OnMouseOver() { if (EventSystem.current.IsPointerOverGameObject()) { return; } RaycastHit hitPoint; if (Physics.Raycast(mainCamera.ScreenPointToRay(Input.mousePosition), out hitPoint, 100.0F)) { //Debug.Log("f**k hitPoint.gameObject " + hitPoint.transform.gameObject.name); if (!PlayerManager.CameraAgent.Camera_Pivot.CAMERA_MOVING) { _panelHitIndex = 0; int[] surface1 = new int[2] { 2, 3 }; // << Put surface triangle Indexs in here int[] surface2 = new int[2] { 6, 7 }; // << Put surface triangle Indexs in here int triIndex = hitPoint.triangleIndex; //Debug.Log("Hit Triangle index : " + hitPoint.triangleIndex); if (triIndex != surface1[0] && triIndex != surface1[1] && triIndex != surface2[0] && triIndex != surface2[1]) { _activeCubeScript = null; Debug.Log("Hit Triangle index NOT REGISTERED: " + triIndex); return; } if (hitPoint.collider.gameObject.GetComponent <PanelPieceScript>() != null) { CubeObjectTypes panelType = hitPoint.collider.gameObject.GetComponent <ObjectScript>().objectType; if (panelType == CubeObjectTypes.Panel_Floor) { if (triIndex == surface1[0] || triIndex == surface1[1]) // (if floor) To sit BELOW of panels { _activeCubeScript = cubeScriptRight; } if (triIndex == surface2[0] || triIndex == surface2[1]) // (if floor) To sit OnTop of panels { _activeCubeScript = cubeScriptLeft; } } if (panelType == CubeObjectTypes.Panel_Wall) { if (triIndex == surface1[0] || triIndex == surface1[1]) // either 0 or 90 angle { _activeCubeScript = cubeScriptRight; } if (triIndex == surface2[0] || triIndex == surface2[1]) // either 0 or 90 angle { _activeCubeScript = cubeScriptLeft; } } if (panelType == CubeObjectTypes.Panel_Angle) { if (triIndex == surface1[0] || triIndex == surface1[1]) // (if floor) To sit OnTop of panels { _activeCubeScript = cubeScriptRight; } if (triIndex == surface2[0] || triIndex == surface2[1]) // (if floor) To sit OnTop of panels { _activeCubeScript = cubeScriptLeft; } } if (MovementManager.BuildMovementPath(_activeCubeScript)) { //Debug.Log("f**k _movementPossible "); //PanelPieceChangeColor("Pink"); _movementPossible = true; } else { //PanelPieceChangeColor("White"); _movementPossible = false; } } } } }