示例#1
0
        public void Setup(SeaCookerController mono)
        {
            _mono = mono;

            _showProcess = Animator.StringToHash("ShowProcess");
            _page        = Animator.StringToHash("Page");

            _mono.FoodManager.OnFoodCookedAll += OnFoodCooked;
            _mono.FoodManager.OnCookingStart  += OnCookingStart;
            _colorPage     = mono.ColorManager;
            _seaBreezeGrid = gameObject.AddComponent <GridHelper>();

            if (FindAllComponents())
            {
                StartCoroutine(CompleteSetup());
            }
            else
            {
                QuickLogger.Error("// ============== Error getting all Components ============== //");
                return;
            }

            _colorPage.SetupGrid(42, SeaCookerBuildable.ColorItemPrefab, _colorGrid, _paginator, OnButtonClick);

            StartCoroutine(CompleteSetup());

            InvokeRepeating(nameof(UpdateScreen), 0, 0.5f);
        }
        internal void Initialize(SeaCookerController mono)
        {
            _mono = mono;

            var equipmentRoot = new GameObject("SCEquipmentRoot");

            equipmentRoot.transform.SetParent(_mono.transform, false);
            equipmentRoot.AddComponent <ChildObjectIdentifier>();
            equipmentRoot.SetActive(false);

            _equipment = new Equipment(mono.gameObject, equipmentRoot.transform);
            _equipment.SetLabel(SeaCookerBuildable.GasContainerLabel());
            _equipment.isAllowedToAdd    += IsAllowedToAdd;
            _equipment.isAllowedToRemove += IsAllowedToRemove;
            _equipment.onEquip           += OnEquipmentAdded;
            _equipment.onUnequip         += OnEquipmentRemoved;
            _equipment.AddSlot(Configuration.Configuration.SlotIDs[0]);

            _tank = Animator.StringToHash("Tank");
        }
        public void Initialize(SeaCookerController mono)
        {
            _mono = mono;

            _isConstructed = () => mono.IsConstructed;

            if (_containerRoot == null)
            {
                QuickLogger.Debug("Initializing StorageRoot");
                var storageRoot       = new GameObject("StorageRoot");
                var exportStorageRoot = new GameObject("ExportStorageRoot");
                storageRoot.transform.SetParent(mono.transform, false);
                _containerRoot       = storageRoot.AddComponent <ChildObjectIdentifier>();
                _exportContainerRoot = exportStorageRoot.AddComponent <ChildObjectIdentifier>();
            }

            if (_container == null)
            {
                QuickLogger.Debug("Initializing Container");

                _container = new ItemsContainer(_containerWidth, _containerHeight, _containerRoot.transform,
                                                SeaCookerBuildable.StorageLabel(), null);

                _container.isAllowedToAdd += IsAllowedToAddContainer;
            }

            if (_exportContainer == null)
            {
                QuickLogger.Debug("Initializing Export Container");

                _exportContainer = new ItemsContainer(_containerWidth, _containerHeight, _exportContainerRoot.transform,
                                                      SeaCookerBuildable.ExportStorageLabel(), null);
                _exportContainer.isAllowedToAdd += IsAllowedToAddExport;
            }

            _mono.FoodManager.OnFoodCookedAll += OnFoodCookedAll;
            _mono.FoodManager.OnCookingStart  += OnCookingStart;
        }
 internal void Initialize(SeaCookerController mono)
 {
     _mono = mono;
 }