12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394 |
- using System.Collections.Generic;
- using System.Collections;
- using Blue;
- using SC.XR.Unity.Module_InputSystem;
- using UnityEngine;
- using UnityEngine.UI;
- using static BoundingBox;
- public class Patch_VideoController : AbstractController
- {
- [SerializeField] private BoundingBox boundingBox;
- [SerializeField] private ManipulationHandler manipulationHandler;
- [SerializeField] private GameObject obj_BoundingBox;
- void Start()
- {
- if (GetComponent<ManipulationHandler>() != null)
- {
- Destroy(manipulationHandler);
- }
- if (GetComponent<BoundingBox>() != null)
- {
- Destroy(boundingBox);
- }
-
-
- toggle = GameObject.Find("SetBtn/Canvas/Parent/EditorBtn/Toggle").GetComponent<Toggle>();
- }
- private Toggle toggle;
- private void Update()
- {
- if(!toggle.isOn)
- {
- if (transform.Find("BoundingBox").gameObject != null)
- Destroy(transform.Find("BoundingBox").gameObject);
- if(manipulationHandler!=null)
- Destroy(manipulationHandler);
- if(boundingBox!=null)
- Destroy(boundingBox);
- }
- else
- {
- if (manipulationHandler == null)
- {
- manipulationHandler = gameObject.AddComponent<ManipulationHandler>();
- if(manipulationHandler.enabled==false)
- {
- manipulationHandler.enabled = true;
- }
- }
- if (boundingBox == null)
- {
- boundingBox = gameObject.AddComponent<BoundingBox>();
- if(boundingBox.enabled==false)
- {
- boundingBox.enabled = true;
- StartCoroutine(Set());
- Debug.LogError(boundingBox.ActiveHandle);
- }
- else
- {
- boundingBox.FlattenAxis = FlattenModeType.FlattenZ;
- boundingBox.ActiveHandle = HandleType.Rotation | HandleType.Scale;
- }
- }
- }
- }
- private IEnumerator Set()
- {
- yield return null;
- boundingBox.FlattenAxis = FlattenModeType.FlattenZ;
- boundingBox.ActiveHandle = HandleType.Rotation | HandleType.Scale;
- }
- }
|