Пример #1
0
        /// <summary>
        /// Invoked when a level has completed the loading process.
        /// </summary>
        /// <param name="mode">Defines what kind of level was just loaded</param>
        public void OnLevelLoaded(LoadMode mode)
        {
            // Checks if we are in gameplay mode and creates the main utility
            switch (mode)
            {
            case LoadMode.NewGame:
            case LoadMode.LoadGame:
                // Removes old attached tool
                if (IndustryTool.instance != null)
                {
                    Object.Destroy(IndustryTool.instance);
                }

                // Creates a new tool instance
                IndustryTool.instance = GameObjectUtils.AddObjectWithComponent <IndustryTool>();
                break;
            }
        }
Пример #2
0
        private void SetupOptionButtons()
        {
            // Zoning option
            var zoningTemplate = GameObjectUtils.AddObjectWithComponent <UIZoningButton>();

            AddTab(UIZoningButton.Name, zoningTemplate, false);

            // Zone movement option
            var moveZoneTemplate = GameObjectUtils.AddObjectWithComponent <UIMoveZoneButton>();

            AddTab(UIMoveZoneButton.Name, moveZoneTemplate, false);

            // Zoning option
            var buildZoneTemplate = GameObjectUtils.AddObjectWithComponent <UIBuildZoneButton>();

            AddTab(UIBuildZoneButton.Name, buildZoneTemplate, false);

            // Set disabled buttons
            DisableTab(1);
            DisableTab(2);

            // Set width
            width = padding.left + zoningTemplate.width + padding.right + padding.left + moveZoneTemplate.width + padding.right + padding.left + buildZoneTemplate.width + padding.right;
        }