コード例 #1
0
        public override void Initialize()
        {
            if (NameController == null)
            {
                NameController = new ExStorageDepotNameManager();
                NameController.Initialize(this);
            }

            if (AnimationManager == null)
            {
                AnimationManager = gameObject.AddComponent <ExStorageDepotAnimationManager>();
            }

            if (Storage == null)
            {
                Storage = gameObject.AddComponent <ExStorageDepotStorageManager>();
                Storage.Initialize(this);
            }

            if (DumpContainer == null)
            {
                DumpContainer = gameObject.AddComponent <DumpContainer>();
                DumpContainer.Initialize(transform, ExStorageDepotBuildable.DumpContainerLabel(), ExStorageDepotBuildable.FoodNotAllowed(), ExStorageDepotBuildable.ContainerFullMessage(), Storage);
                DumpContainer.OnDumpContainerClosed += Storage.OnDumpContainerClosed;
            }

            if (Display == null)
            {
                Display = gameObject.AddComponent <ExStorageDepotDisplayManager>();
                Display.Initialize(this);
            }

            var locker = GameObjectHelpers.FindGameObject(gameObject, "Locker", SearchOption.StartsWith);
            var sRoot  = GameObjectHelpers.FindGameObject(gameObject, "StorageRoot");

            if (locker != null)
            {
                Destroy(locker);
            }

            if (sRoot != null)
            {
                Destroy(sRoot);
            }

            if (FCSConnectableDevice == null)
            {
                FCSConnectableDevice = gameObject.AddComponent <FCSConnectableDevice>();
                FCSConnectableDevice.Initialize(this, Storage, new ExStoragePowerManager(), true);
                FCSTechFabricator.FcTechFabricatorService.PublicAPI.RegisterDevice(FCSConnectableDevice, GetPrefabID(), Mod.ExStorageTabID);
            }

            _initialized = true;
        }
コード例 #2
0
        public override void Initialize()
        {
            if (PowerManager == null)
            {
                PowerManager = gameObject.AddComponent <AlterraGenPowerManager>();
            }

            if (ColorManager == null)
            {
                ColorManager = gameObject.AddComponent <ColorManager>();
                ColorManager.Initialize(gameObject, AlterraGenBuildable.BodyMaterial);
            }

            if (AnimationManager == null)
            {
                AnimationManager = gameObject.AddComponent <AnimationManager>();
            }

            if (DumpContainer == null)
            {
                DumpContainer = gameObject.AddComponent <DumpContainer>();
                DumpContainer.Initialize(transform, "AlterraGen Receptacle", AlterraGenBuildable.NotAllowedItem(), AlterraGenBuildable.StorageFullMessage(), PowerManager, 3, 3);
            }

            if (_fcsConnectableDevice == null)
            {
                _fcsConnectableDevice = gameObject.AddComponent <FCSConnectableDevice>();
                _fcsConnectableDevice.Initialize(this, PowerManager, PowerManager);
                FCSTechFabricator.FcTechFabricatorService.PublicAPI.RegisterDevice(_fcsConnectableDevice, GetPrefabID(), Mod.ModTabID);
            }


            if (DisplayManager == null)
            {
                DisplayManager = gameObject.AddComponent <AlterraGenDisplayManager>();
                DisplayManager.Setup(this);
            }

            _xBubbles = GameObjectHelpers.FindGameObject(gameObject, "xBubbles");

            IsInitialized = true;
        }
コード例 #3
0
        public override void Initialize()
        {
            if (PowerManager == null)
            {
                PowerManager = gameObject.AddComponent <AlterraGenPowerManager>();
            }

            if (ColorManager == null)
            {
                ColorManager = gameObject.AddComponent <ColorManager>();
                ColorManager.Initialize(gameObject, AlterraGenBuildable.BodyMaterial);
            }

            if (AnimationManager == null)
            {
                AnimationManager = gameObject.AddComponent <AnimationManager>();
            }

            if (DumpContainer == null)
            {
                DumpContainer = gameObject.AddComponent <DumpContainer>();
                DumpContainer.Initialize(transform, "AlterraGen Receptacle", "", AlterraGenBuildable.NotAllowedItem(), PowerManager);
            }

            if (_fcsConnectableDevice == null)
            {
                _fcsConnectableDevice = gameObject.AddComponent <FCSConnectableDevice>();
                _fcsConnectableDevice.Initialize(this, PowerManager, PowerManager);
            }


            if (DisplayManager == null)
            {
                DisplayManager = gameObject.AddComponent <AlterraGenDisplayManager>();
                DisplayManager.Setup(this);
            }

            _xBubbles = GameObjectHelpers.FindGameObject(gameObject, "xBubbles");

            IsInitialized = true;
        }
コード例 #4
0
        public override void Initialize()
        {
            if (NameController == null)
            {
                NameController = new ExStorageDepotNameManager();
                NameController.Initialize(this);
            }

            if (AnimationManager == null)
            {
                AnimationManager = gameObject.AddComponent <ExStorageDepotAnimationManager>();
            }

            if (Storage == null)
            {
                Storage = gameObject.AddComponent <ExStorageDepotStorageManager>();
                Storage.Initialize(this);
            }

            if (DumpContainer == null)
            {
                DumpContainer = gameObject.AddComponent <DumpContainer>();
                DumpContainer.Initialize(transform, ExStorageDepotBuildable.DumpContainerLabel(), ExStorageDepotBuildable.FoodNotAllowed(), ExStorageDepotBuildable.ContainerFullMessage(), Storage);
                DumpContainer.OnDumpContainerClosed += Storage.OnDumpContainerClosed;
            }

            if (Display == null)
            {
                Display = gameObject.AddComponent <ExStorageDepotDisplayManager>();
                Display.Initialize(this);
            }

            if (FCSConnectableDevice == null)
            {
                FCSConnectableDevice = gameObject.AddComponent <FCSConnectableDevice>();
                FCSConnectableDevice.Initialize(this, Storage);
            }

            _initialized = true;
        }
        public override void Initialize()
        {
            PageStateHash = Animator.StringToHash("PageState");

            QPatch.Configuration.OnModModeChanged += OnModModeChanged;

            if (PrefabId == null)
            {
                PrefabId = GetComponentInParent <PrefabIdentifier>() ?? GetComponent <PrefabIdentifier>();
            }

            if (PowerManager == null)
            {
                PowerManager = gameObject.AddComponent <ARSolutionsSeaBreezePowerManager>();
                PowerManager.Initialize(this);
                PowerManager.OnBreakerTripped += OnBreakerTripped;
                PowerManager.OnBreakerReset   += OnBreakerReset;
                PowerManager.OnPowerResume    += OnPowerResume;
                PowerManager.OnPowerOutage    += OnPowerOutage;
            }

            if (FridgeComponent == null)
            {
                FridgeComponent = gameObject.AddComponent <Fridge>();
                FridgeComponent.Initialize(this, QPatch.Configuration.StorageLimit);
                FridgeComponent.OnContainerUpdate += OnContainerUpdate;
                FridgeComponent.SetModMode(QPatch.Configuration.ModMode);
            }

            if (ColorManager == null)
            {
                ColorManager = gameObject.AddComponent <ColorManager>();
                ColorManager.Initialize(gameObject, ARSSeaBreezeFCS32Buildable.BodyMaterial);
            }

            if (FridgeDumpContainer == null)
            {
                FridgeDumpContainer = gameObject.AddComponent <DumpContainer>();
                FridgeDumpContainer.Initialize(gameObject.transform, ARSSeaBreezeFCS32Buildable.StorageLabel(),
                                               ARSSeaBreezeFCS32Buildable.ItemNotAllowed(),
                                               ARSSeaBreezeFCS32Buildable.SeaBreezeFull(),
                                               FridgeComponent, _dumpStorageSizeXY, _dumpStorageSizeXY);
            }

            if (NameController == null)
            {
                NameController = gameObject.EnsureComponent <NameController>();
                NameController.Initialize(ARSSeaBreezeFCS32Buildable.Submit(), Mod.FriendlyName);
                NameController.SetCurrentName(Mod.GetNewSeabreezeName());
                NameController.OnLabelChanged += OnLabelChangedMethod;
            }

            if (AnimationManager == null)
            {
                AnimationManager = gameObject.AddComponent <AnimationManager>();
            }

            if (DisplayManager == null)
            {
                DisplayManager = gameObject.AddComponent <ARSolutionsSeaBreezeDisplay>();
                DisplayManager.Setup(this);
            }

            if (FCSConnectableDevice == null)
            {
                FCSConnectableDevice = gameObject.AddComponent <FCSConnectableDevice>();
                FCSConnectableDevice.Initialize(this, FridgeComponent);
            }

            IsInitialized = true;
        }
コード例 #6
0
        public override void Initialize()
        {
            QuickLogger.Debug($"Initializing");

            var listSolar = new List <GameObject>
            {
                GameObjectHelpers.FindGameObject(gameObject, "Cube_2_2"),
                GameObjectHelpers.FindGameObject(gameObject, "Cube_1_2"),
                GameObjectHelpers.FindGameObject(gameObject, "Cube_1"),
                GameObjectHelpers.FindGameObject(gameObject, "Cube_2"),
                GameObjectHelpers.FindGameObject(gameObject, "Cube_2_3"),
                GameObjectHelpers.FindGameObject(gameObject, "Cube_1_4"),
                GameObjectHelpers.FindGameObject(gameObject, "Cube_2_4")
            };

            foreach (GameObject solarObj in listSolar)
            {
                var sController = solarObj.AddComponent <FCSDeepDrillerSolarController>();
                sController.Setup(this);
            }

            SolarStateHash = Animator.StringToHash("SolarState");

            InvokeRepeating(nameof(UpdateDrillShaftSate), 1, 1);

            if (OilHandler == null)
            {
                OilHandler = gameObject.AddComponent <FCSDeepDrillerOilHandler>();
                OilHandler.Initialize(this);
            }

            if (_prefabId == null)
            {
                QuickLogger.Error("Prefab Identifier Component was not found");
            }

            if (_buildable == null)
            {
                _buildable = GetComponentInParent <Constructable>();
            }

            OreGenerator = gameObject.AddComponent <FCSDeepDrillerOreGenerator>();
            OreGenerator.Initialize(this);
            OreGenerator.OnAddCreated += OreGeneratorOnAddCreated;

            if (PowerManager == null)
            {
                PowerManager = gameObject.AddComponent <FCSDeepDrillerPowerHandler>();
                PowerManager.Initialize(this);
                var powerRelay = gameObject.AddComponent <PowerRelay>();
                PowerManager.SetPowerRelay(powerRelay);
            }

            if (LaserManager == null)
            {
                LaserManager = new LaserManager();
                LaserManager.Setup(this);
            }

            if (ColorManager == null)
            {
                ColorManager = gameObject.AddComponent <ColorManager>();
                ColorManager.Initialize(gameObject, FCSDeepDrillerBuildable.BodyMaterial);
            }

            AudioManager = new AudioManager(gameObject.GetComponent <FMOD_CustomLoopingEmitter>());

            DeepDrillerContainer = new FCSDeepDrillerContainer();
            DeepDrillerContainer.Setup(this);


            AnimationHandler = gameObject.AddComponent <FCSDeepDrillerAnimationHandler>();
            AnimationHandler.Initialize(this);

            LavaPitHandler = gameObject.AddComponent <FCSDeepDrillerLavaPitHandler>();
            LavaPitHandler.Initialize(this);

            if (OilDumpContainer == null)
            {
                OilDumpContainer = gameObject.AddComponent <DumpContainer>();
                OilDumpContainer.Initialize(transform,
                                            FCSDeepDrillerBuildable.OilDropContainerTitle(),
                                            FCSDeepDrillerBuildable.NotAllowedItem(),
                                            FCSDeepDrillerBuildable.StorageFull(),
                                            OilHandler, 4, 4);
            }

            if (PowercellDumpContainer == null)
            {
                PowercellDumpContainer = gameObject.AddComponent <DumpContainer>();
                PowercellDumpContainer.Initialize(transform,
                                                  FCSDeepDrillerBuildable.PowercellDumpContainerTitle(),
                                                  FCSDeepDrillerBuildable.NotAllowedItem(),
                                                  FCSDeepDrillerBuildable.StorageFull(),
                                                  PowerManager, 1, 1);
            }

            if (TransferManager == null)
            {
                TransferManager = gameObject.AddComponent <FCSDeepDrillerTransferManager>();
                TransferManager.Initialize(this);
            }

            if (UpgradeManager == null)
            {
                UpgradeManager = gameObject.AddComponent <FCSDeepDrillerUpgradeManager>();
                UpgradeManager.Initialize(this);
            }

            _line = gameObject.GetComponent <LineRenderer>();
            _line.SetVertexCount(Segments + 1);
            _line.useWorldSpace = false;

            if (FCSConnectableDevice == null)
            {
                FCSConnectableDevice = gameObject.AddComponent <FCSConnectableDevice>();
                FCSConnectableDevice.Initialize(this, DeepDrillerContainer, PowerManager);
                FCSTechFabricator.FcTechFabricatorService.PublicAPI.RegisterDevice(FCSConnectableDevice, GetPrefabID(), Mod.DeepDrillerTabID);
            }

            OnGenerate();

            IsInitialized = true;

            QuickLogger.Debug($"Initializing Completed");
        }