Example #1
0
        //---------------------------------//
        private void _AddEvent( BlockEventBase.EventType eventType )
        //---------------------------------//
        {
            GameObject go = new GameObject( eventType.ToString() + " Event" );
            go.transform.parent = transform;

            string newComponentName = "BrandXR.BlockEvent" + eventType.ToString();
            Type componentType = ComponentHelper.FindType( newComponentName );
            
            BlockEventHelper helper = new BlockEventHelper( eventType );
            helper.SetBlockEventBase( (BlockEventBase)go.AddComponent( componentType ) );
            helper.GetBlockEventBase()._PrefabManager = _PrefabManager;

            blockEventHelpers.Add( helper );

            if( showDebug )
            {
                Debug.Log( "BlockEvent.cs _AddEvent() Added new Helper(" + helper.GetBlockEventBase().name + ")! blockEventHelpers.Count = " + blockEventHelpers.Count );
            }

        } //END AddEvent
Example #2
0
        } //END Start

        //----------------------------------//
        private void SetBlockEvent()
        //----------------------------------//
        {
            //If our events list is empty, yet there are BlockEvent as children GameObjects, add them to our list
            if( blockEventHelpers == null || ( blockEventHelpers != null && blockEventHelpers.Count() == 0 ) )
            {
                if( gameObject.GetComponentsInChildren<BlockEventBase>() != null )
                {
                    List<BlockEventBase> foundEventBases = gameObject.GetComponentsInChildren<BlockEventBase>().ToList();

                    foreach( BlockEventBase blockEventBase in foundEventBases )
                    {
                        BlockEventHelper helper = new BlockEventHelper( blockEventBase.GetEventType() );
                        helper.SetBlockEventBase( blockEventBase );

                        blockEventHelpers.Add( helper );
                    }
                }
            }

        } //END SetBlockEvent