Exemplo n.º 1
0
        private void Start()
        {
            ///////////////
            /// SINGLETON
            ///////////////
            if (Instance != null && this != Instance)
            {
                // There can be only one
                Debug.LogError("Destroying WorldController - there can be only one active WorldController in the scene");
                Destroy(this);
            }
            Instance = this;

            //////////////////////////////
            /// INITIALIZE DICTIONARIES
            //////////////////////////////
            guidGameObjectMap  = new Dictionary <string, GameObject>();
            spawnedGameObjects = new List <GameObject>();

            //////////////////////////////
            /// REGISTER CALLBACKS
            //////////////////////////////
            spawnHandler.RegisterPrefabSpawnedCallback(OnPrefabSpawned);

            // Search the scene for existing GameObjects with UniqueID components.
            // Add them to the dictionary if they're not already there.
            // Eventually we may want to replace this with a scene load operation.
            RegisterExistingUniqueGameObjects();
        }
Exemplo n.º 2
0
 public virtual void OnDisable()
 {
     WorldController.UnregisterSaveCallback(Save);
 }
Exemplo n.º 3
0
 public virtual void OnEnable()
 {
     WorldController.RegisterSaveCallback(Save);
 }