コード例 #1
0
 protected virtual void OnEnable()
 {
     instance                  = (InteractableToggleCollection)target;
     toggleListProperty        = serializedObject.FindProperty("toggleList");
     currentIndexProperty      = serializedObject.FindProperty("currentIndex");
     onSelectionEventsProperty = serializedObject.FindProperty("OnSelectionEvents");
 }
コード例 #2
0
        /// <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);
            }
        }
コード例 #3
0
        /// <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>();
        }
コード例 #4
0
        /// <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>();
        }