コード例 #1
0
ファイル: Moveable.cs プロジェクト: BagusP12/ProjectVTS
 public void ButtonMoveObject()
 {
     if (!removedState)
     {
         if (canMove)
         {
             canMove = false;
             StartCoroutine(MoveOverSeconds(gameObject, moveDirection, duration));
             buttonUIScript.AddUserAction("Move " + gameObject.name);
             removedState = !removedState;
         }
     }
     buttonUIScript.ClearButton();
 }
コード例 #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();
 }
コード例 #3
0
ファイル: Rotatable.cs プロジェクト: BagusP12/ProjectVTS
 void ButtonRotateObject()
 {
     if (!rotatedState)
     {
         if (canRotate)
         {
             canRotate = false;
             StartCoroutine(RotateOverSeconds(gameObject, rotateAngle, duration));
             buttonUIScript.AddUserAction("Rotate " + gameObject.name);
             rotatedState = !rotatedState;
         }
     }
     buttonUIScript.ClearButton();
 }
コード例 #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);
    }
コード例 #5
0
 public void PressedButton()
 {
     if (canMove)
     {
         canMove = false;
         StartCoroutine(PressedOverSeconds(gameObject, pressedPosition, 0.1f));
         buttonUIScript.AddUserAction("Button Pressed " + gameObject.name);
     }
     buttonUIScript.ClearButton();
 }
コード例 #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();
 }