Beispiel #1
0
        internal static void DeActivateInstance(StaticInstance instance)
        {
            switch (instance.FacilityType)
            {
            case "Hangar":
                HangarGUI.CacheHangaredCraft(instance);
                break;

            case "LandingGuide":
                LandingGuideUI.instance.drawLandingGuide(null);
                break;

            case "TouchdownGuideL":
                LandingGuideUI.instance.drawTouchDownGuideL(null);
                break;

            case "TouchdownGuideR":
                LandingGuideUI.instance.drawTouchDownGuideR(null);
                break;
            }
        }
Beispiel #2
0
        /// <summary>
        /// gets called every second, when in flight by KerbalKonsructs.updateCache (InvokeRepeating) and through StaticDatabase.UpdateCache
        /// </summary>
        /// <param name="playerPos"></param>
        public void ActivateGroupMembers()
        {
            if (isActive)
            {
                return;
            }

            isActive = true;

            Log.Normal("Activate calles for group: " + name);

            foreach (StaticInstance instance in groupInstances)
            {
                string sFacType = instance.FacilityType;

                if (sFacType == "Hangar")
                {
                    HangarGUI.CacheHangaredCraft(instance);
                }

                if (sFacType == "LandingGuide")
                {
                    LandingGuideUI.instance.drawLandingGuide(instance);
                }

                if (sFacType == "TouchdownGuideL")
                {
                    LandingGuideUI.instance.drawTouchDownGuideL(instance);
                }

                if (sFacType == "TouchdownGuideR")
                {
                    LandingGuideUI.instance.drawTouchDownGuideR(instance);
                }

                InstanceUtil.SetActiveRecursively(instance, true);
            }
            groupCenter.gameObject.SetActive(true);
        }
        /// <summary>
        /// Deactivates the Statics of an Group
        /// </summary>
        public void DeactivateGroupMembers()
        {
            if (!isActive)
            {
                return;
            }

            Log.Normal("Deactivate calles for group: " + name);

            isActive = false;
            foreach (StaticInstance instance in groupInstances)
            {
                string sFacType = instance.FacilityType;

                if (sFacType == "Hangar")
                {
                    HangarGUI.CacheHangaredCraft(instance);
                }

                if (sFacType == "LandingGuide")
                {
                    LandingGuideUI.instance.drawLandingGuide(null);
                }

                if (sFacType == "TouchdownGuideL")
                {
                    LandingGuideUI.instance.drawTouchDownGuideL(null);
                }

                if (sFacType == "TouchdownGuideR")
                {
                    LandingGuideUI.instance.drawTouchDownGuideR(null);
                }

                InstanceUtil.SetActiveRecursively(instance, false);
            }
        }
Beispiel #4
0
        public void updateCache(Vector3 playerPos)
        {
            foreach (StaticObject obj in childObjects)
            {
                float dist    = Vector3.Distance(obj.gameObject.transform.position, playerPos);
                bool  visible = (dist < (float)obj.getSetting("VisibilityRange"));

                string sFacType = (string)obj.getSetting("FacilityType");

                if (sFacType == "Hangar")
                {
                    if (visible)
                    {
                        HangarGUI.CacheHangaredCraft(obj);
                    }
                }

                if (sFacType == "LandingGuide")
                {
                    if (visible)
                    {
                        KerbalKonstructs.instance.drawLandingGuide(obj);
                    }
                    else
                    {
                        KerbalKonstructs.instance.drawLandingGuide(null);
                    }
                }

                if (sFacType == "TouchdownGuideL")
                {
                    if (visible)
                    {
                        KerbalKonstructs.instance.drawTouchDownGuideL(obj);
                    }
                    else
                    {
                        KerbalKonstructs.instance.drawTouchDownGuideL(null);
                    }
                }

                if (sFacType == "TouchdownGuideR")
                {
                    if (visible)
                    {
                        KerbalKonstructs.instance.drawTouchDownGuideR(obj);
                    }
                    else
                    {
                        KerbalKonstructs.instance.drawTouchDownGuideR(null);
                    }
                }

                if (sFacType == "CityLights")
                {
                    if (dist < 65000f)
                    {
                        SetActiveRecursively(obj.gameObject, false);
                        return;
                    }
                }

                if (visible)
                {
                    SetActiveRecursively(obj.gameObject, true);
                }
                else
                {
                    SetActiveRecursively(obj.gameObject, false);
                }
            }
        }
        /// <summary>
        /// gets called every second, when in flight by KerbalKonsructs.updateCache (InvokeRepeating) and through StaticDatabase.UpdateCache
        /// </summary>
        /// <param name="playerPos"></param>
        public void CheckUngrouped(Vector3 playerPos)
        {
            //Log.Normal("Check ungrouped assets");
            foreach (StaticInstance instance in groupInstances)
            {
                float  dist     = Vector3.Distance(instance.gameObject.transform.position, playerPos);
                bool   visible  = (dist < visibilityRange);
                string sFacType = instance.FacilityType;

                if (sFacType == "Hangar")
                {
                    HangarGUI.CacheHangaredCraft(instance);
                }

                if (sFacType == "LandingGuide")
                {
                    if (visible)
                    {
                        LandingGuideUI.instance.drawLandingGuide(instance);
                    }
                    else
                    {
                        LandingGuideUI.instance.drawLandingGuide(null);
                    }
                }

                if (sFacType == "TouchdownGuideL")
                {
                    if (visible)
                    {
                        LandingGuideUI.instance.drawTouchDownGuideL(instance);
                    }
                    else
                    {
                        LandingGuideUI.instance.drawTouchDownGuideL(null);
                    }
                }

                if (sFacType == "TouchdownGuideR")
                {
                    if (visible)
                    {
                        LandingGuideUI.instance.drawTouchDownGuideR(instance);
                    }
                    else
                    {
                        LandingGuideUI.instance.drawTouchDownGuideR(null);
                    }
                }

                if (sFacType == "CityLights")
                {
                    if (dist < 65000f)
                    {
                        InstanceUtil.SetActiveRecursively(instance, false);
                        return;
                    }
                }

                if (visible)
                {
                    InstanceUtil.SetActiveRecursively(instance, true);
                }
                else
                {
                    InstanceUtil.SetActiveRecursively(instance, false);
                }
            }
        }