コード例 #1
0
        private void CreateBodySection(string body, int count)
        {
            if (BodyObjectPrefab == null || BodyObjectTransform == null)
            {
                return;
            }

            GameObject sectionObject = Instantiate(BodyObjectPrefab);

            if (sectionObject == null)
            {
                return;
            }

            sectionObject.transform.SetParent(BodyObjectTransform, false);

            SEP_CelestialBodyObject bodyObject = sectionObject.GetComponent <SEP_CelestialBodyObject>();

            if (bodyObject == null)
            {
                return;
            }

            bodyObject.setBody(body, count);

            currentBodies.Add(bodyObject);
        }
コード例 #2
0
        public void SetCurrentBody(string body)
        {
            if (windowInterface == null)
            {
                return;
            }

            for (int i = currentVessels.Count - 1; i >= 0; i--)
            {
                SEP_VesselSection vessel = currentVessels[i];

                if (vessel == null)
                {
                    continue;
                }

                vessel.gameObject.SetActive(false);

                Destroy(vessel.gameObject);
            }

            for (int i = currentBodies.Count - 1; i >= 0; i--)
            {
                SEP_CelestialBodyObject b = currentBodies[i];

                if (b == null)
                {
                    continue;
                }

                if (b.Body == body)
                {
                    continue;
                }

                b.DisableBody();
            }

            var vessels = windowInterface.GetBodyVessels(body);

            if (vessels.Count <= 0)
            {
                return;
            }

            currentBody = body;

            windowInterface.CurrentBody = body;

            CreateVesselSections(vessels);
        }
コード例 #3
0
        public void UpdateBodySection(string body, int count)
        {
            for (int i = currentBodies.Count - 1; i >= 0; i--)
            {
                SEP_CelestialBodyObject b = currentBodies[i];

                if (b == null)
                {
                    continue;
                }

                if (b.Body != body)
                {
                    continue;
                }

                b.UpdateCount(count);
                break;
            }
        }
コード例 #4
0
        public void RemoveBodySection(string body)
        {
            for (int i = currentBodies.Count - 1; i >= 0; i--)
            {
                SEP_CelestialBodyObject b = currentBodies[i];

                if (b == null)
                {
                    continue;
                }

                if (b.Body != body)
                {
                    continue;
                }

                currentBodies.RemoveAt(i);
                Destroy(b.gameObject);
                break;
            }
        }