public void ButtonMoveObject() { if (!removedState) { if (canMove) { canMove = false; StartCoroutine(MoveOverSeconds(gameObject, moveDirection, duration)); buttonUIScript.AddUserAction("Move " + gameObject.name); removedState = !removedState; } } buttonUIScript.ClearButton(); }
public void ButtonScrewObject() { if (!screwedState) { if (canScrew) { canScrew = false; StartCoroutine(ScrewOverSeconds(gameObject, screwMoveDirection, duration)); buttonUIScript.AddUserAction("Screw " + gameObject.name); screwedState = !screwedState; } } buttonUIScript.ClearButton(); }
void ButtonRotateObject() { if (!rotatedState) { if (canRotate) { canRotate = false; StartCoroutine(RotateOverSeconds(gameObject, rotateAngle, duration)); buttonUIScript.AddUserAction("Rotate " + gameObject.name); rotatedState = !rotatedState; } } buttonUIScript.ClearButton(); }
public void ActivateTool() { Destroy(inventoryUIScript.activeTool); GameObject tool = Instantiate(Resources.Load("ToolTemplate") as GameObject); tool.transform.Find("Icon").GetComponent <Image>().sprite = toolIcon; tool.transform.Find("Name").GetComponent <TextMeshProUGUI>().text = toolName; tool.GetComponent <Button>().onClick.AddListener(() => { UnselectToolButton(); }); tool.transform.SetParent(inventoryUIScript.transform.Find("ActiveTool").transform); tool.GetComponent <RectTransform>().anchoredPosition = new Vector2(0, 0); inventoryUIScript.activeTool = tool; buttonUIScript.AddUserAction("Select " + toolName); }
public void PressedButton() { if (canMove) { canMove = false; StartCoroutine(PressedOverSeconds(gameObject, pressedPosition, 0.1f)); buttonUIScript.AddUserAction("Button Pressed " + gameObject.name); } buttonUIScript.ClearButton(); }
public void ButtonRotateStepObject(int index) { if (indexRotation != index) { if (canRotate) { canRotate = false; for (int i = 0; i < rotateAngleData.Length; i++) { if (i == index) { StartCoroutine(RotateStepOverSeconds(gameObject, rotateAngleData[i].rotateAngle, duration)); buttonUIScript.AddUserAction("Rotate " + rotateAngleData[i].rotateName + " " + gameObject.name); indexRotation = index; } } } } buttonUIScript.ClearButton(); }