Beispiel #1
0
        private void Awake()
        {
            // We put the trail object under the planet, but we want it to be the parented to the parent of the planet ...
            // which will be the solar system
            planet = GetComponentInParent <OrbitUpdater>();

            container = new GameObject("Orbit Container " + planet.name);

            var planetTransform = planet.transform;

            container.transform.SetParent(planetTransform.parent, worldPositionStays: false);

            FindSunIfNeeded();

            container.AddComponent <NoAutomaticFade>();

            List <Vector3> realPositions, schematicPositions;

            GeneratePositionsForOrbit(out realPositions, out schematicPositions);

            var orbitsRenderer = OrbitsRenderer.GetOrCreate(planet.transform.parent);

            orbitsRenderer.AddOrbit(this, realPositions, schematicPositions);
            originalGlobalScale = orbitMaterial.GetFloat("_GlobalScale");
            originalWidth       = orbitMaterial.GetFloat("_Width");
            if (MyAppPlatformManager.Platform == MyAppPlatformManager.PlatformId.ImmersiveHMD)
            {
                orbitMaterial.SetFloat("_Width", MyAppPlatformManager.OrbitalTrailFixedWidth);
            }

            orbitsRenderer.orbitsMaterial = orbitMaterial;
        }
        private void Awake()
        {
            // We put the trail object under the planet, but we want it to be the parented to the parent of the planet ...
            // which will be the solar system
            if (Planet == null)
            {
                Planet = GetComponentInParent <OrbitUpdater>();
            }

            if (container == null)
            {
                container = new GameObject("Orbit Container " + Planet.name);
                container.transform.SetParent(Planet.transform.parent, worldPositionStays: false);
            }

            container.AddComponent <NoAutomaticFade>();

            StartCoroutine(AwakeCoroutine());
        }