public void EditGroup(Transform square) { if (square.parent != null) { groupy = square.parent; } else { groupy = square; } editing = true; darkThingOn(); state = 2; if (sizeStuff != null) { openMenu.closeTheMenu(); sizeStuff.deselect(); optionStuff.deselect(); } textMesh.text = "exit Group"; }
void blub(int Pos) { //GameObject thing = GetObject(history[Pos].tag, history[Pos].number, Pos); if (history[Pos].tag != "") { GameObject thing = allThings[history[Pos].number]; int WTD = history[Pos].whatToDo; float[] lol = history[Pos].größen; sizeThing = null; bool change = false; if (GameObject.Find("sizeStuff(Clone)")) { sizeThing = GameObject.Find("sizeStuff(Clone)").GetComponent <sizeThing>(); if (history[Pos].number != sizeThing.square.GetComponent <Draggable>().ObjectLPos) { change = true; } } switch (WTD) { case 0: if (thing.activeSelf) { thing.layer = 0; //thing.transform.Find("outline").gameObject.SetActive(false); thing.SetActive(false); if (sizeThing != null && !change) { menu.closeTheMenu(); sizeThing.deselect(); } change = false; } else { thing.SetActive(true); } break; case 1: print("lol"); thing.transform.position = new Vector3(lol[0], lol[1], lol[2]); thing.transform.localScale = new Vector3(lol[3], lol[4], 0); if (sizeThing != null && !change) { sizeThing.reselect(thing.transform); optionStuff.changePosition(); optionStuff.changeScale(); } break; case 2: thing.transform.position = new Vector3(lol[0], lol[1], lol[2]); if (sizeThing != null && !change) { sizeThing.reselect(thing.transform); optionStuff.changePosition(); } break; case 3: thing.transform.rotation = Quaternion.Euler(0, 0, lol[0]); if (sizeThing != null && !change) { optionStuff.changeRotation(); sizeThing.reselect(thing.transform); } break; case 4: Color coloryy = new Color(lol[0], lol[1], lol[2], lol[3]); thing.GetComponent <SpriteRenderer>().color = coloryy; if (!change) { optionStuff.changeColor(coloryy); } break; case 7: thing.GetComponent <water>().waterForceX = lol[0]; Color colory = new Color(lol[1], lol[2], lol[3], lol[4]); thing.GetComponent <SpriteRenderer>().color = colory; if (!change) { optionStuff.changeWaterX(); optionStuff.changeColor(colory); } break; case 8: thing.GetComponent <water>().waterForceY = lol[0]; Color color = new Color(lol[1], lol[2], lol[3], lol[4]); thing.GetComponent <SpriteRenderer>().color = color; if (!change) { optionStuff.changeWaterY(); optionStuff.changeColor(color); } break; case 9: if (thing.tag == "Player") { thing.GetComponent <CircleCollider2D>().enabled = false; } else { thing.GetComponents <PolygonCollider2D>()[2].enabled = false; } thing.GetComponents <PolygonCollider2D>()[1].enabled = false; thing.GetComponents <PolygonCollider2D>()[0].enabled = false; if (sizeThing == null || change) { thing.GetComponent <BoxCollider2D>().enabled = false; } int shape = (int)lol[0]; switch (shape) { case 0: thing.GetComponent <BoxCollider2D>().enabled = true; break; case 1: if (thing.tag == "Player") { thing.GetComponent <CircleCollider2D>().enabled = true; } else { thing.GetComponents <PolygonCollider2D>()[2].enabled = true; } break; case 2: thing.GetComponents <PolygonCollider2D>()[1].enabled = true; break; case 3: thing.GetComponents <PolygonCollider2D>()[0].enabled = true; break; } thing.GetComponent <SpriteRenderer>().sprite = shapes[shape]; if (!change) { optionStuff.changeTheShape(); } break; case 10: thing.transform.localScale = new Vector3(lol[3], lol[4], 0); if (sizeThing != null && !change) { optionStuff.changeScale(); sizeThing.reselect(thing.transform); } break; case 11: thing.GetComponent <Draggable>().bounciness = lol[0]; if (!change) { optionStuff.changeBounciness(); } break; case 12: thing.GetComponent <Draggable>().falling = lol[0] == 1; if (!change) { optionStuff.changeFalling(); } break; case 13: thing.GetComponent <Draggable>().mass = lol[0]; if (!change) { optionStuff.changeMass(); } break; case 14: if (thing.transform.parent == allThings[(int)lol[0]].transform) { allThings[(int)lol[0]].SetActive(false); thing.transform.parent = null; if (createGroup.groupy == allThings[(int)lol[0]].transform && createGroup.editing) { createGroup.darkThingOff(); createGroup.editing = false; } } else { allThings[(int)lol[0]].SetActive(true); thing.transform.parent = allThings[(int)lol[0]].transform; if (sizeThing != null && !change) { //change = false; sizeThing.reselect(thing.transform); } } break; case 15: thing.transform.rotation = Quaternion.Euler(0, 0, lol[0]); thing.transform.position = new Vector3(lol[1], lol[2], thing.transform.position.z); if (sizeThing != null && !change) { sizeThing.reselect(thing.transform); optionStuff.changePosition(); } break; } if (change) { sizeThing.reselect(thing.transform); optionStuff.select(thing); } /*thing.transform.position = lol.pos; * thing.transform.localScale = lol.scale; * thing.transform.rotation = lol.rotation; * thing.GetComponent<SpriteRenderer>().color = lol.color; * if(thing.tag == "water"){ * thing.GetComponent<water>().waterForceX = lol.WaterPower.x; * thing.GetComponent<water>().waterForceY = lol.WaterPower.y; * } * if(GameObject.Find("sizeStuff(Clone)")){ * sizeThing sizeStuff = GameObject.Find("sizeStuff(Clone)").GetComponent<sizeThing>(); * if(sizeStuff.square.gameObject == thing){ * sizeStuff.reselect(thing.transform); * } * }*/ } else { float[] lol = history[Pos].größen; Color col = new Color(lol[0], lol[1], lol[2], 1); if (history[Pos].whatToDo == 5) { cam.bg1 = col; print("undo Zeugs"); cam.GetComponent <Camera>().backgroundColor = col; } else { cam.bg2 = col; } //changeBackground.changebgColor(); } HisPos = Pos; }