Exemplo n.º 1
0
 public void ButtonMoveObject()
 {
     if (!removedState)
     {
         if (canMove)
         {
             canMove = false;
             StartCoroutine(MoveOverSeconds(gameObject, moveDirection, duration));
             buttonUIScript.AddUserAction("Move " + gameObject.name);
             removedState = !removedState;
         }
     }
     buttonUIScript.ClearButton();
 }
Exemplo n.º 2
0
 public void ButtonScrewObject()
 {
     if (!screwedState)
     {
         if (canScrew)
         {
             canScrew = false;
             StartCoroutine(ScrewOverSeconds(gameObject, screwMoveDirection, duration));
             buttonUIScript.AddUserAction("Screw " + gameObject.name);
             screwedState = !screwedState;
         }
     }
     buttonUIScript.ClearButton();
 }
Exemplo n.º 3
0
 void ButtonRotateObject()
 {
     if (!rotatedState)
     {
         if (canRotate)
         {
             canRotate = false;
             StartCoroutine(RotateOverSeconds(gameObject, rotateAngle, duration));
             buttonUIScript.AddUserAction("Rotate " + gameObject.name);
             rotatedState = !rotatedState;
         }
     }
     buttonUIScript.ClearButton();
 }
Exemplo n.º 4
0
    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);
    }
Exemplo n.º 5
0
 public void PressedButton()
 {
     if (canMove)
     {
         canMove = false;
         StartCoroutine(PressedOverSeconds(gameObject, pressedPosition, 0.1f));
         buttonUIScript.AddUserAction("Button Pressed " + gameObject.name);
     }
     buttonUIScript.ClearButton();
 }
Exemplo n.º 6
0
 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();
 }