private void DrawInfo() { cubeType = (CubeTypes)EditorGUILayout.EnumPopup("My CubeType is ", cubeType); cubeLayers = (CubeLayers)EditorGUILayout.EnumPopup("My CubeLayer is ", cubeLayers); facingDirection = (FacingDirection)EditorGUILayout.EnumPopup("My FacingDirection is ", facingDirection); cubeOnPosition = (GameObject)EditorGUILayout.ObjectField("The Object is ", cubeOnPosition, typeof(GameObject), true); worldPosition = (Vector3)EditorGUILayout.Vector3Field("The Object's Position is ", worldPosition); }
//set the node's information relevant to the cube type, then send the Transform information to the cube void SetCubeInfo(_CubeBase cube, CubeLayers cubeLayers, CubeTypes cubeTypes, bool _static) { cube.myIndex = currentNode.nodeIndex; cube.myCubeType = cubeTypes; cube.myCubeLayer = cubeLayers; cube.isStatic = _static; cube.facingDirection = currentNode.facingDirection; //sets rotation and position according to the values of the relevant node in kuboGrid cube.OnLoadSetTransform(); }
private void DrawWindow() { GUILayout.BeginHorizontal(EditorStyles.toolbar); GUILayout.FlexibleSpace(); searchIndex = EditorGUILayout.IntField(searchIndex, EditorStyles.toolbarTextField); GUILayout.EndHorizontal(); cubeType = _Grid.instance.kuboGrid[searchIndex - 1].cubeType; cubeLayers = _Grid.instance.kuboGrid[searchIndex - 1].cubeLayers; facingDirection = _Grid.instance.kuboGrid[searchIndex - 1].facingDirection; cubeOnPosition = _Grid.instance.kuboGrid[searchIndex - 1].cubeOnPosition; worldPosition = _Grid.instance.kuboGrid[searchIndex - 1].worldPosition; }
void SendInfoToCube(_CubeBase cubeBase, CubeTypes cubeType, CubeLayers cubeLayer, bool _static) { //Cube info if (cubeBase.gameObject.GetComponent <_CubeScanner>() != null) { cubeBase.facingDirection = FacingDirection.forward; } cubeBase.myIndex = GetCubeIndex(); cubeBase.isStatic = _static; cubeBase.myCubeLayer = cubeLayer; cubeBase.myCubeType = cubeType; cubeBase.gameObject.transform.position = GetCubePosition(); cubeBase.gameObject.transform.parent = grid.transform; cubeBase.SetRelevantNodeInfo(); }
void SetNodeInfo(GameObject newCube, int nodeIndex, Vector3 worldPosition, Vector3 worldRotation, FacingDirection facingDirection, CubeLayers cubeLayers, CubeTypes cubeTypes) { grid.kuboGrid[currentNode.nodeIndex - 1].cubeOnPosition = newCube; grid.kuboGrid[currentNode.nodeIndex - 1].nodeIndex = nodeIndex; grid.kuboGrid[currentNode.nodeIndex - 1].worldPosition = worldPosition; grid.kuboGrid[currentNode.nodeIndex - 1].worldRotation = worldRotation; grid.kuboGrid[currentNode.nodeIndex - 1].facingDirection = facingDirection; grid.kuboGrid[currentNode.nodeIndex - 1].cubeLayers = cubeLayers; grid.kuboGrid[currentNode.nodeIndex - 1].cubeType = cubeTypes; }