コード例 #1
0
        public Overlay(string planet, float altitude, Material scaledMaterial, Material macroMaterial, Vector2 rotation, int layer, Transform celestialTransform, bool mainMenu, bool matchTerrain)
        {
            this.MainMenu          = mainMenu;
            this.OverlayGameObject = new GameObject();
            this.Body               = planet;
            this.Rotation           = rotation;
            this.scaledMaterial     = scaledMaterial;
            this.macroMaterial      = macroMaterial;
            this.OriginalLayer      = layer;
            this.celestialTransform = celestialTransform;
            this.altitude           = altitude;
            this.matchTerrain       = matchTerrain;

            CelestialBody[] celestialBodies = (CelestialBody[])CelestialBody.FindObjectsOfType(typeof(CelestialBody));
            celestialBody = celestialBodies.First(n => n.bodyName == this.Body);

            if (!mainMenu && matchTerrain)
            {
                IsoSphere.Create(OverlayGameObject, this.altitude, celestialBody);
            }
            else
            {
                IsoSphere.Create(OverlayGameObject, this.Radius, null);
            }

            var mr = OverlayGameObject.AddComponent <MeshRenderer>();

            mr.sharedMaterial = scaledMaterial;
            mr.castShadows    = false;
            mr.receiveShadows = false;
            //mr.enabled = mainMenu;
            mr.enabled = true;
        }
コード例 #2
0
    public void Reset()
    {
        Destroy(_mesh);
        _mesh = IsoSphere.Create(recursionLevel);
        var meshFilter = GetComponent <MeshFilter>();

        meshFilter.mesh = _mesh;
    }