void Start() { if (m_Manipulators.Length > 0 && m_SelectionTransforms.Length > 0) { foreach (var m in m_Manipulators) { var manipulator = (IManipulator)m; var state = new ManipulatorSelectionState(manipulator); var activeTransform = m_SelectionTransforms[0]; state.Reset(m_ManipulatorPivotSettings, m_SelectionTransforms, activeTransform); m_States.Add(new Tuple <IManipulator, ManipulatorSelectionState>(manipulator, state)); } } else { Debug.LogError("Manipulator Selection Controller is not configured properly. It must have at least one manipulator and one selection transform.", this); } }
void CreateManipulator(GameObject prefab) { prefab.SetActive(false); var parent = ModuleLoaderCore.instance.GetModuleParent().transform; var go = Instantiate(prefab, parent); foreach (var mb in go.GetComponentsInChildren <MonoBehaviour>()) { this.InjectFunctionalitySingle(mb); } var manipulator = go.GetComponent <IManipulator>(); var state = new ManipulatorSelectionState(manipulator); manipulator.dragStarted += OnDragStarted; m_ManipulatorStates.Add(manipulator, state); m_AllManipulators.Add(manipulator); }