private void Initialize() { TechTypeHelpers.Initialize(); ARSeaBreezeFCS32Awake_Patcher.AddEventHandlerIfMissing(AlertedNewSeaBreezePlaced); ARSeaBreezeFCS32Destroy_Patcher.AddEventHandlerIfMissing(AlertedSeaBreezeDestroyed); if (FoodManager == null) { FoodManager = gameObject.AddComponent <FoodManager>(); FoodManager.Initialize(this); } if (StorageManager == null) { StorageManager = new SCStorageManager(); StorageManager.Initialize(this); } if (GasManager == null) { GasManager = new GasManager(); GasManager.Initialize(this); } if (PowerManager == null) { PowerManager = new PowerManager(); PowerManager.Initialize(this); StartCoroutine(UpdatePowerState()); } AnimationManager = gameObject.GetComponent <AnimationManager>(); if (DisplayManager == null) { DisplayManager = gameObject.AddComponent <SCDisplayManager>(); } if (ColorManager == null) { ColorManager = gameObject.AddComponent <ColorManager>(); ColorManager.Initialize(gameObject, SeaCookerBuildable.BodyMaterial); } if (AudioManager == null) { AudioManager = new AudioManager(gameObject.GetComponent <FMOD_CustomLoopingEmitter>()); //InvokeRepeating(nameof(UpdateAudio), 0, 1); } if (PlayerInteraction == null) { PlayerInteraction = gameObject.GetComponent <PlayerInteraction>(); } PlayerInteraction.Initialize(this); //FindHabitat(); IsInitialized = true; }
private IEnumerator UpdatePowerState() { while (true) { yield return(new WaitForSeconds(1)); PowerManager.UpdatePowerState(); } }
private void Update() { PowerManager?.ConsumePower(); }