public static ShippingTargetManager FindManager(SubRoot subRoot)
        {
            if (subRoot.isBase || subRoot.isCyclops) //Changed To allow in cyclops
            {
                QuickLogger.Debug($"Processing SubRoot = {subRoot.GetInstanceID()}");

                var manager = Managers.Find(x => x.InstanceID == subRoot.GetInstanceID() && x.Habitat == subRoot);

                return(manager ?? CreateNewManager(subRoot));
            }

            return(null);
        }
        internal static BaseManager FindManager(SubRoot subRoot)
        {
            QuickLogger.Debug($"Processing SubRoot = {subRoot.GetInstanceID()} || Name {subRoot.GetSubName()}");

            var pre = subRoot.gameObject.GetComponent <PrefabIdentifier>();

            var manager = Managers.Find(x => x.InstanceID == subRoot.GetInstanceID() && x.Habitat == subRoot);

            if (manager == null)
            {
                QuickLogger.Debug("No manager found on base");
            }

            return(manager ?? CreateNewManager(subRoot));
        }
        internal static BaseManager FindManager(SubRoot subRoot)
        {
            QuickLogger.Debug($"Processing SubRoot = {subRoot.GetInstanceID()} || Name {subRoot.GetSubName()}");
            var g       = FindManager(subRoot.gameObject.GetComponentInChildren <PrefabIdentifier>()?.Id);
            var manager = Managers.Find(x => x.InstanceID == g?.InstanceID && x.Habitat == subRoot);

            return(manager ?? CreateNewManager(subRoot));
        }
Exemple #4
0
        public BaseManager(SubRoot habitat)
        {
            Habitat    = habitat;
            InstanceID = habitat.GetInstanceID();
            var mono = habitat.gameObject.GetComponent <MonoBehaviour>();

            mono.StartCoroutine(AutoSystem());
        }
 public CyclopsManager(SubRoot cyclops, UpgradeManager upgradeManager, PowerManager powerManager, CyclopsHUDManager hUDManager, ChargeManager chargeManager)
 {
     UpgradeManager = upgradeManager;
     PowerManager   = powerManager;
     HUDManager     = hUDManager;
     ChargeManager  = chargeManager;
     Cyclops        = cyclops;
     InstanceID     = cyclops.GetInstanceID();
 }
        private static CyclopsManager GetManager(int id, SubRoot cyclops)
        {
            if (cyclops.isBase || !cyclops.isCyclops)
            {
                return(null);
            }

            CyclopsManager mgr = Managers.Find(m => m.InstanceID == cyclops.GetInstanceID());

            return(mgr ?? CreateNewManagers(cyclops));
        }
        private CyclopsManager(SubRoot cyclops)
        {
            QuickLogger.Debug($"Creating new main CyclopsManager");
            Cyclops    = cyclops;
            InstanceID = cyclops.GetInstanceID();

            Upgrade = new UpgradeManager(cyclops);
            Charge  = new ChargeManager(cyclops);
            HUD     = new CyclopsHUDManager(cyclops);
            Engine  = new PowerRatingManager(cyclops);
        }
Exemple #8
0
        internal static BaseManager FindManager(SubRoot subRoot)
        {
            if (subRoot == null || !subRoot.isBase)
            {
                return(null);
            }

            var manager = Managers.Find(x => x.InstanceID == subRoot.GetInstanceID() && x.Habitat == subRoot);

            if (manager == null)
            {
                QuickLogger.Debug("No manager found on base");
            }

            return(manager ?? CreateNewManager(subRoot));
        }
        internal static CyclopsManager GetManager(ref SubRoot cyclops)
        {
            if (cyclops == null || cyclops.isBase || !cyclops.isCyclops)
            {
                return(null);
            }

            for (int m = 0; m < Managers.Count; m++)
            {
                CyclopsManager mgr = Managers[m];
                if (mgr.Cyclops == cyclops && mgr.InstanceID == cyclops.GetInstanceID())
                {
                    return(mgr);
                }
            }

            return(CreateNewCyclopsManager(ref cyclops));
        }
 public static CyclopsHUDManager GetHUDManager(SubRoot cyclops)
 {
     return(GetManager(cyclops.GetInstanceID(), cyclops)?.HUDManager);
 }
 public static List <CyBioReactorMono> GetBioReactors(SubRoot cyclops)
 {
     return(GetManager(cyclops.GetInstanceID(), cyclops)?.BioReactors);
 }
 public static PowerManager GetPowerManager(SubRoot cyclops)
 {
     return(GetManager(cyclops.GetInstanceID(), cyclops)?.PowerManager);
 }
 public static UpgradeManager GetUpgradeManager(SubRoot cyclops)
 {
     return(GetManager(cyclops.GetInstanceID(), cyclops)?.UpgradeManager);
 }
 public static CyclopsManager GetAllManagers(SubRoot cyclops)
 {
     return(GetManager(cyclops.GetInstanceID(), cyclops));
 }
 public static CyclopsManager GetAllManagers(SubRoot cyclops) => GetManager(cyclops.GetInstanceID(), cyclops);
 public static UpgradeManager GetUpgradeManager(SubRoot cyclops) => GetManager(cyclops.GetInstanceID(), cyclops)?.UpgradeManager;
 public ShippingTargetManager(SubRoot habitat)
 {
     Habitat    = habitat;
     InstanceID = habitat.GetInstanceID();
 }
 public static PowerManager GetPowerManager(SubRoot cyclops) => GetManager(cyclops.GetInstanceID(), cyclops)?.PowerManager;
 public BaseManager(SubRoot habitat)
 {
     Habitat    = habitat;
     InstanceID = habitat.GetInstanceID();
 }
        public override GameObject GetGameObject()
        {
            SubRoot currentSub = Player.main.currentSub;

            if (currentSub != null)
            {
                QuickLogger.Debug($"Current Sub = {currentSub.GetInstanceID()}", true);

                var manager = ShippingTargetManager.FindManager(currentSub);

                QuickLogger.Debug($"Manager {manager}", true);

                if (manager != null && manager.ShippingTargets.Count >= ShippingTargetManager.MaxShippingContainers)
                {
                    ErrorMessage.AddMessage(Language.main.Get(OverLimitKey));
                    return(null);
                }
            }
            else
            {
                QuickLogger.Debug($"Current Sub is null");
            }
            var        prefab       = GameObject.Instantiate(_Prefab);
            GameObject consoleModel = prefab.FindChild("model");

            // Update sky applier
            SkyApplier skyApplier = prefab.AddComponent <SkyApplier>();

            skyApplier.renderers = consoleModel.GetComponentsInChildren <MeshRenderer>();
            skyApplier.anchorSky = Skies.Auto;

            //Add the constructable component to the prefab
            Constructable constructable = prefab.AddComponent <Constructable>();

            constructable.allowedInBase           = true; // Only allowed in Base
            constructable.allowedInSub            = true; // Not allowed in Cyclops
            constructable.allowedOutside          = false;
            constructable.allowedOnCeiling        = false;
            constructable.allowedOnGround         = true; // Only on ground
            constructable.allowedOnWall           = false;
            constructable.allowedOnConstructables = false;
            constructable.controlModelState       = true;
            constructable.rotationEnabled         = true;
            constructable.techType = this.TechType;
            constructable.model    = consoleModel;

            var center = new Vector3(0f, 1.022878f, 0.3840232f);       // Y reduced to allow tube fitting
            var size   = new Vector3(1.63731f, 1.920672f, 0.8025026f); // Y reduced to allow tube fitting

            GameObjectHelpers.AddConstructableBounds(prefab, size, center);

            prefab.EnsureComponent <AlterraShippingTransferHandler>();

            prefab.EnsureComponent <AlterraShippingDisplay>();

            prefab.EnsureComponent <AlterraShippingAnimator>();

            prefab.EnsureComponent <AlterraShippingTarget>();

            //Add the prefabIdentifier
            PrefabIdentifier prefabID = prefab.AddComponent <PrefabIdentifier>();

            prefabID.ClassId = this.ClassID;

            return(prefab);
        }
 protected CyclopsManager(SubRoot cyclops)
 {
     this.Cyclops = cyclops;
     InstanceID   = cyclops.GetInstanceID();
 }