1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- 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;
- void Start()
- {
- if (GetComponent<ManipulationHandler>() != null)
- {
- GetComponent<ManipulationHandler>().enabled = false;
- }
- if (GetComponent<BoundingBox>() != null)
- {
- GetComponent<BoundingBox>().enabled = false;
- }
- toggle = GameObject.Find("SetBtn/2.1/Canvas/Parent/EditorBtn/Toggle").GetComponent<Toggle>();
- }
- private Toggle toggle;
- private void Update()
- {
- if(toggle)
- {
- if (!toggle.isOn)
- {
- if (manipulationHandler != null)
- manipulationHandler.enabled=false;
- if (boundingBox != null)
- {
- boundingBox.enabled = false;
- if (transform.Find("BoundingBox")&&transform.Find("BoundingBox").gameObject != null)
- transform.Find("BoundingBox").gameObject.SetActive(false);
- }
- }
- else
- {
- if (manipulationHandler == null)
- {
- manipulationHandler = gameObject.AddComponent<ManipulationHandler>();
- }
- else
- {
- manipulationHandler.enabled = true;
- }
- if (boundingBox == null)
- {
- boundingBox = gameObject.AddComponent<BoundingBox>();
- boundingBox.FlattenAxis = FlattenModeType.FlattenZ;
- boundingBox.ActiveHandle = HandleType.Rotation | HandleType.Scale;
- }else
- {
- boundingBox.enabled = true;
- }
- }
- }
- }
- }
|