CleanUp() public static method

public static CleanUp ( ) : void
return void
示例#1
0
    public static void Start()
    {
        // Attach an EgoComponent Component to each GameObject
        var gameObjects   = Object.FindObjectsOfType <GameObject>();
        var egoComponents = new List <EgoComponent>();

        foreach (var gameObject in gameObjects)
        {
            var egoComponent = gameObject.GetComponent <EgoComponent>();
            if (!egoComponent)
            {
                egoComponent = gameObject.AddComponent <EgoComponent>();
            }
            egoComponent.CreateMask();
            egoComponents.Add(egoComponent);
        }

        // Create System bundles
        foreach (var system in _systems)
        {
            system.CreateBundles(egoComponents.ToArray());
        }

        // Start all Systems
        foreach (var system in _systems)
        {
            system.Start();
        }

        // Invoke all queued Events
        EgoEvents.Invoke();

        // Clean up Destroyed Components & GameObjects
        EgoCleanUp.CleanUp();
    }
    public static void Start()
    {
        var sceneCount = SceneManager.sceneCount;

        for (var sceneIndex = 0; sceneIndex < sceneCount; sceneIndex++)
        {
            var scene           = SceneManager.GetSceneAt(sceneIndex);
            var rootGameObjects = scene.GetRootGameObjects();

            // Attach an EgoComponent Component to every GameObject in the scene
            foreach (var go in rootGameObjects)
            {
                InitEgoComponent(go);
            }

            // Add every GameObject to any relevant system
            foreach (var system in _systems)
            {
                foreach (var go in rootGameObjects)
                {
                    var egoComponent = go.GetComponent <EgoComponent>();
                    system.CreateBundles(egoComponent);
                }
            }
        }

        //     var gameObjects = Object.FindObjectsOfType<GameObject>();
        //     var egoComponents = new List<EgoComponent>();
        //     foreach( var gameObject in gameObjects )
        //     {
        //         var egoComponent = gameObject.GetComponent<EgoComponent>();
        //         if( !egoComponent ) egoComponent = gameObject.AddComponent<EgoComponent>();
        //         egoComponent.CreateMask();
        //egoComponents.Add( egoComponent );
        //     }

        //     // Create System bundles
        //     foreach( var system in _systems )
        //     {
        //         system.CreateBundles( egoComponents.ToArray() );
        //     }

        // Start all Systems
        foreach (var system in _systems)
        {
            system.Start();
        }

        // Invoke all queued Events
        EgoEvents.Invoke();

        // Clean up Destroyed Components & GameObjects
        EgoCleanUp.CleanUp();
    }
    public static void Update()
    {
        // Update all Systems
        foreach (var system in _systems)
        {
#if UNITY_EDITOR
            if (system.enabled)
            {
                system.Update();
            }
#else
            system.Update();
#endif
        }

        // Invoke all queued Events
        EgoEvents.Invoke();

        // Clean up Destroyed Components & GameObjects
        EgoCleanUp.CleanUp();
    }
示例#4
0
    public static void Start()
    {
        var sceneCount = SceneManager.sceneCount;

        for (var sceneIndex = 0; sceneIndex < sceneCount; sceneIndex++)
        {
            var scene           = SceneManager.GetSceneAt(sceneIndex);
            var rootGameObjects = scene.GetRootGameObjects();

            // Attach an EgoComponent Component to every GameObject in the scene
            foreach (var go in rootGameObjects)
            {
                InitEgoComponent(go);
            }

            // Add every GameObject to any relevant system
            foreach (var system in _systems)
            {
                foreach (var go in rootGameObjects)
                {
                    var egoComponent = go.GetComponent <EgoComponent>();
                    system.CreateBundles(egoComponent);
                }
            }
        }

        EgoEvents.Start();

        // Start all Systems
        foreach (var system in _systems)
        {
            system.Start();
        }

        // Invoke all queued Events
        EgoEvents.Invoke();

        // Clean up Destroyed Components & GameObjects
        EgoCleanUp.CleanUp();
    }