예제 #1
0
        internal void Initialize(AIJetStreamT242Controller mono)
        {
            _mono = mono;

            _liveMixin = GetComponent <LiveMixin>() ?? GetComponentInParent <LiveMixin>();

            _damagePerSecond = DayNight / _damagePerDay;

            if (_liveMixin != null)
            {
                if (_liveMixin.data == null)
                {
                    QuickLogger.Debug($"Creating Data");
                    _liveMixin.data = CustomLiveMixinData.Get();
                    QuickLogger.Debug($"Created Data");
                }
                else
                {
                    _liveMixin.data.weldable = true;
                }

                InvokeRepeating("HealthChecks", 0, 1);
            }
            else
            {
                QuickLogger.Error($"LiveMixing not found!");
            }

            _initialized = true;
        }
        internal void Initialize(OxStationController mono)
        {
            QuickLogger.Debug("Health Initialize");
            _mono            = mono;
            _liveMixin       = mono.gameObject.AddComponent <LiveMixin>();
            _damagePerSecond = DayNight / DamagePerDay;

            if (_liveMixin != null)
            {
                if (_liveMixin.data == null)
                {
                    QuickLogger.Debug($"Creating Data");
                    _liveMixin.data = CustomLiveMixinData.Get();
                    QuickLogger.Debug($"Created Data");
                }
            }
            else
            {
                QuickLogger.Error($"LiveMixing not found!");
            }
        }
        /// <summary>
        /// This is the first thing to set before using this controller.
        /// If no live mixing data in supplied it will use the default live mixing data in <see cref="CustomLiveMixinData.Get"/>
        /// </summary>
        /// <param name="liveMixinData"></param>
        public void Initialize(LiveMixin liveMixin, LiveMixinData liveMixinData = null)
        {
            if (liveMixin == null)
            {
                QuickLogger.Error($"{typeof(HealthController)}|| LiveMixing cannot be null!");
                return;
            }

            LiveMixin = liveMixin;

            if (liveMixinData == null)
            {
                QuickLogger.Error($"LiveMixing Data  is null!");
                QuickLogger.Info($"Creating Data");
                LiveMixin.data = CustomLiveMixinData.Get();
                QuickLogger.Info($"Created Data");
            }
            else
            {
                LiveMixin.data = liveMixinData;
            }
        }
예제 #4
0
        internal void Initialize(FCSDeepDrillerController mono)
        {
            _mono      = mono;
            _liveMixin = mono.gameObject.AddComponent <LiveMixin>();

            _damagePerSecond = DayNight / _damagePerDay;

            if (_liveMixin != null)
            {
                if (_liveMixin.data == null)
                {
                    QuickLogger.Debug($"Creating Data");
                    _liveMixin.data = CustomLiveMixinData.Get();
                    QuickLogger.Debug($"Created Data");
                }


                InvokeRepeating("HealthChecks", 0, 1);
            }
            else
            {
                QuickLogger.Error($"LiveMixing not found!");
            }
        }
        public override GameObject GetGameObject()
        {
            try
            {
                QuickLogger.Debug("Making GameObject");

                QuickLogger.Debug("Instantiate GameObject");

                var prefab = GameObject.Instantiate(_Prefab);

                // Add large world entity ALLOWS YOU TO SAVE ON TERRAIN
                var lwe = prefab.AddComponent <LargeWorldEntity>();
                lwe.cellLevel = LargeWorldEntity.CellLevel.Far;

                var model = prefab.FindChild("model");

                SkyApplier skyApplier = prefab.AddComponent <SkyApplier>();
                skyApplier.renderers = model.GetComponentsInChildren <MeshRenderer>();
                skyApplier.anchorSky = Skies.Auto;

                //========== Allows the building animation and material colors ==========//

                QuickLogger.Debug("Adding Constructible");

                // Add constructible
                var constructable = prefab.AddComponent <Constructable>();
                constructable.allowedOnWall           = false;
                constructable.allowedOnGround         = true;
                constructable.allowedInSub            = false;
                constructable.allowedInBase           = false;
                constructable.allowedOnCeiling        = false;
                constructable.allowedOutside          = true;
                constructable.model                   = model;
                constructable.rotationEnabled         = true;
                constructable.allowedOnConstructables = false;
                constructable.techType                = TechType;

                var center = new Vector3(0f, 2.970485f, 0f);
                var size   = new Vector3(4.03422f, 5.701298f, 3.179399f);
                GameObjectHelpers.AddConstructableBounds(prefab, size, center);

                PrefabIdentifier prefabID = prefab.AddComponent <PrefabIdentifier>();
                prefabID.ClassId = this.ClassID;

                var lm = prefab.AddComponent <LiveMixin>();
                lm.data = CustomLiveMixinData.Get();

                prefab.AddComponent <TechTag>().type = TechType;

                prefab.AddComponent <BeaconController>();

                prefab.AddComponent <AIJetStreamT242Display>();

                prefab.AddComponent <AIJetStreamT242PowerManager>();

                prefab.AddComponent <AIJetStreamT242HealthManager>();

                prefab.AddComponent <AIJetStreamT242AnimationManager>();

                prefab.AddComponent <AIJetStreamT242Controller>();

                return(prefab);
            }
            catch (Exception e)
            {
                QuickLogger.Error(e.Message);
                return(null);
            }
        }