// Called when the button is clicked void TaskOnClick() { if (button.name == "Item Button 1") { Debug.Log("b1"); UserInputInformation.AddChair((GameObject)Instantiate(objectToAdd, new Vector3(0.0f, 0.0f, 0.0f), new Quaternion(0.0f, 0.0f, 0.0f, 0.0f))); } else if (button.name == "Item Button 2") { Debug.Log("b2"); UserInputInformation.AddChest((GameObject)Instantiate(objectToAdd, new Vector3(0.0f, 0.0f, 0.0f), new Quaternion(0.0f, 0.0f, 0.0f, 0.0f))); } else if (button.name == "Item Button 3") { Debug.Log("b3"); } else if (button.name == "Item Button 4") { Debug.Log("b4"); } else if (button.name == "Item Button 5") { UserInputInformation.AddRoom((GameObject)Instantiate(objectToAdd, new Vector3(0.0f, 0.0f, 0.0f), new Quaternion(0.0f, 0.0f, 0.0f, 0.0f))); } }
public void Init(float roombaSpeed, int batteryLife, PathType pathType, float vacEff, float whiskerEff) { UserInputInformation.RoombaStop = false; UserInputInformation.setstartTime(); timeLimitReached = false; SetDefaults(); Time.timeScale = simSpeed; this.batteryLife = batteryLife; this.whiskerEff = whiskerEff; this.vacEff = vacEff; this.roombaSpeed = roombaSpeed; SetStartPosition(); SetPathType(pathType); path.SetFields(this.roombaSpeed, vacuum); if (pathType == PathType.Spiral) { path.SetDirection(new Vector3(0, 1F, 0)); } else { path.Launch(); } timerStarted = true; }
public void Accept() { string roomHeightStripped = roomHeight.text.Replace("\u200B", ""); string roomWidthStripped = roomWidth.text.Replace("\u200B", ""); if ((checkFileName() == true) && (checkSqft(roomHeightStripped, roomWidthStripped) == true)) { UserInputInformation.FileNameGS = fileName.text.Replace("\u200B", ""); UserInputInformation.carpetTypeGS = carpetType.text.Replace("\u200B", ""); clearLists(); // on creation of a new file, all of the old information must be erased from the current scene GameObject newRoom = Instantiate(objectToAdd, new Vector3(0f, 0f, 0f), new Quaternion(0f, 0f, 0f, 0f)); //UserInputInformation.AddRoom((GameObject)Instantiate(objectToAdd, new Vector3(0.0f, 0.0f, 0.0f), new Quaternion(0.0f, 0.0f, 0.0f, 0.0f))); if (roomHeightStripped != "" && roomWidthStripped != "") { // Set the Width and Height from what the user entered int width = int.Parse(roomHeightStripped); int height = int.Parse(roomWidthStripped); newRoom.GetComponent <Room>().SetStart(new Vector2(-((float)width / 2f), -((float)height / 2f))); newRoom.GetComponent <Room>().SetStop(new Vector2((float)width / 2f, (float)height / 2f)); } UserInputInformation.AddRoom(newRoom); Close(); } }
public Vector2 SetStop(Vector2 position) { Vector2 temp = this.stop; this.stop.x = Mathf.Round(position.x + 0.5f); this.stop.y = Mathf.Round(position.y + 0.5f); if (this.width < 2 || this.height < 2) { this.stop = temp; } UserInputInformation.AddStopVector(RoomID, stop); return(stop); }
public Vector2 SetStart(Vector2 position) { Vector2 temp = this.start; this.start.x = Mathf.Round(position.x + 0.5f); this.start.y = Mathf.Round(position.y + 0.5f); if (this.width < 2 || this.height < 2) { this.start = temp; } //Debug.Log("Using Room ID: " + RoomID); UserInputInformation.AddStartVector(RoomID, start); return(start); }
public void loadRooms(JsonData saveInformation) { UserInputInformation.stopVals.Clear(); UserInputInformation.startVals.Clear(); for (int i = 0; i < saveInformation["rooms"].Count; i++) { double stopX = (double)saveData["stopValues"][i]["x"]; double stopY = (double)saveData["stopValues"][i]["y"]; double startX = (double)saveData["startValues"][i]["x"]; double startY = (double)saveData["startValues"][i]["y"]; Vector2 start = new Vector2((float)startX, (float)startY); Vector2 stop = new Vector2((float)stopX, (float)stopY); Debug.Log(start + ";" + stop); room = (GameObject)Instantiate(room, new Vector3(0.0f, 0.0f, 0.0f), new Quaternion(0.0f, 0.0f, 0.0f, 0.0f)); room.GetComponent <Room>().SetStart(start); room.GetComponent <Room>().SetStart(stop); UserInputInformation.AddRoom(room); } }