protected virtual void OnEnable() { instance = (InteractableToggleCollection)target; toggleListProperty = serializedObject.FindProperty("toggleList"); currentIndexProperty = serializedObject.FindProperty("currentIndex"); onSelectionEventsProperty = serializedObject.FindProperty("OnSelectionEvents"); }
/// <summary> /// Override InputSystemGlobalListener Start() method for additional one-time setup. /// </summary> protected override void Start() { base.Start(); radioSet = gameObject.GetComponent <InteractableToggleCollection>(); SetupLineRenderer(); SyncRadioSet(); int pillarLayer = LayerMask.NameToLayer("Pillared"); int spatialMappingLayer = LayerMask.NameToLayer("SpatialMapping"); if (pillarLayer == -1) { Debug.LogWarning("Undefined layer 'Pillared', spatial mapping objects might interfere with pillars and beams"); } if (spatialMappingLayer == -1) { Debug.LogWarning("Undefined layer 'SpatialMapping', spatial mapping objects might interfere with pillars and beams"); } if (pillarLayer != -1 && spatialMappingLayer != -1) { Physics.IgnoreLayerCollision(pillarLayer, spatialMappingLayer, true); } }
/// <summary> /// Create a shared orienter, and create space pins for any spacePinPoints set in the inspector. /// </summary> protected override void Start() { base.Start(); orienter = gameObject.AddComponent <Orienter>(); CreateSpacePins(); radioSet = gameObject.GetComponentInChildren <InteractableToggleCollection>(); }
/// <summary> /// Generates an InteractableToggleCollection from radial prefabs /// </summary> private void AssembleInteractableToggleCollection(out InteractableToggleCollection interactableToggleCollection, int numRadials, Vector3 pos) { GameObject toggleCollection = new GameObject("ToggleCollection"); interactableToggleCollection = toggleCollection.AddComponent <InteractableToggleCollection>(); // Instantiate radial prefabs with toggleCollection as the parent for (int i = 0; i < numRadials; i++) { var radial = TestButtonUtilities.InstantiateInteractableFromPath(pos + new Vector3(0.1f, i * 0.1f, 0), Quaternion.identity, RadialPrefabAssetPath); radial.name = "Radial " + i; Assert.IsNotNull(radial); radial.transform.parent = toggleCollection.transform; } interactableToggleCollection.ToggleList = toggleCollection.GetComponentsInChildren <Interactable>(); }