Exemplo n.º 1
0
 virtual public void updateColSetFromParent(ColourSettings new_col_set)
 {
     Debug.Log("update col set from p");
     col_set = new_col_set;
     mesh_renderer.sharedMaterial = col_set.mat;
     updateMesh();
 }
Exemplo n.º 2
0
    private void OnValidate()
    {
        planetMaterial = Resources.Load("Materials/StandartMaterial") as Material;

        m_ShapeSettings  = Resources.Load("Settings/Shape") as ShapeSettings;
        m_ColourSettings = Resources.Load("Settings/Colour") as ColourSettings;
    }
Exemplo n.º 3
0
 public void UpdateSettings(ColourSettings settings)
 {
     this.settings = settings;
     if (texture == null)
     {
         this.texture = new Texture2D(textureResolution, 1);
     }
 }
 public void UpdateSettings(ColourSettings colourSettings)
 {
     ColourSettings = colourSettings;
     if (Texture == null)
     {
         Texture = new Texture2D(TextureResolution, 1);
     }
 }
Exemplo n.º 5
0
 public void UpdateSettings(ColourSettings settings)
 {
     this.settings = settings;
     if (texture == null)
     {
         texture = new Texture2D(textureResolution * 2, 1, TextureFormat.RGBA32, false);
     }
 }
Exemplo n.º 6
0
 private void Start()
 {
     planet         = GetComponent <Planet>();
     shape          = planet.shapeSettings;
     colour         = planet.colourSettings;
     noiseSettings0 = shape.noiseLayers[0].noiseSettings;
     noiseSettings1 = shape.noiseLayers[1].noiseSettings;
 }
Exemplo n.º 7
0
 public void UpdateSettings(ColourSettings _settings)
 {
     settings = _settings;
     if (texture == null || texture.height != settings.biomeColorSettings.biomes.Length)
     {
         texture = new Texture2D(textureResolution * 2, settings.biomeColorSettings.biomes.Length, TextureFormat.RGBA32, false);
     }
     biomeNoiseFilter = NoiseFilterFactory.CreateNoiseFilter(settings.biomeColorSettings.noise);
 }
Exemplo n.º 8
0
 public void UpdateSettings(ColourSettings settings)
 {
     _settings = settings;
     if (_texture2D == null || _texture2D.height != settings.BiomeColourSettings.Biomes.Length)
     {
         _texture2D = new Texture2D(_textureResolution, settings.BiomeColourSettings.Biomes.Length);
     }
     biomeNoiseFilter = NoiseFilterFactory.CreateNoiseFilter(settings.BiomeColourSettings.NoiseSettings);
 }
Exemplo n.º 9
0
 public void UpdateSettings(ColourSettings settings)
 {
     this.settings = settings;
     if (texture == null || texture.height != settings.biomeColourSettings.biomes.Length)
     {
         texture = new Texture2D(textureResolution, settings.biomeColourSettings.biomes.Length);
     }
     biomeNoiseFilter = NoiseFilterFactory.CreateNoiseFilter(settings.biomeColourSettings.noise);
 }
Exemplo n.º 10
0
    public System.Random rand = new System.Random();  // Randomisation of planet settings

    // ********************************************************************** //

    public void UpdateSettings(ColourSettings settings, bool reset, ColourSamplingStatistics colorStats)
    {
        this.settings = reset ? RandomizeColourSettings(settings, colorStats) : settings;       // generate a new random planet
        if (texture == null || texture.height != settings.biomeColourSettings.biomes.Length)
        {
            texture = new Texture2D(textureResolution * 2, settings.biomeColourSettings.biomes.Length, TextureFormat.RGBA32, false);  // first half of this is the ocean, second half is the biomes/icy north pole etc
        }
        biomeNoiseFilter = NoiseFilterFactory.CreateNoiseFilter(settings.biomeColourSettings.noise);
        tintColor        = settings.biomeColourSettings.biomes[0].tint;
    }
Exemplo n.º 11
0
 private void ReverseSettings()
 {
     activate                 = true;
     scaleSettings            = scaleSettings.Reversed();
     rotateSettings           = rotateSettings.Reversed();
     worldPositionSettings    = worldPositionSettings.Reversed();
     anchoredPositionSettings = anchoredPositionSettings.Reversed();
     colourSettings           = colourSettings.Reversed();
     fadeSettings             = fadeSettings.Reversed();
 }
Exemplo n.º 12
0
    public void Init()
    {
        if (!_ShapeSettings)
        {
            _ShapeSettings = Resources.Load("Script/Shape", typeof(ShapeSettings)) as ShapeSettings;
        }

        if (!_ColourSettings)
        {
            _ColourSettings = Resources.Load("Script/Colour") as ColourSettings;
        }

        if (!_AtmosphereMaterial)
        {
            _AtmosphereMaterial = Resources.Load("Material/Atmosphere", typeof(Material)) as Material;
        }

        if (_NomDuSoleil == "")
        {
            _NomDuSoleil = "Sun";
        }

        _Planete = gameObject;

        _Planete.transform.SetParent(GameObject.Find("Map").transform);

        if (!gameObject.GetComponent <Planet>())
        {
            _Planete.AddComponent <Planet>();
        }

        _Planete.GetComponent <Planet>().shapeSettings                     = _ShapeSettings;
        _Planete.GetComponent <Planet>().colourSettings                    = _ColourSettings;
        _Planete.GetComponent <Planet>().resolution                        = _Resolution;
        _Planete.GetComponent <Planet>().shapeSettings.planetRadius        = _Radius;
        _Planete.GetComponent <Planet>().colourSettings.atmosphereMaterial = _AtmosphereMaterial;

        Debug.Log("[" + GetType().Name + "] Nom du material: " + _PlaneteMaterial.name);
        Debug.Log("[" + GetType().Name + "] Nom du colorsitting: " + _ColourSettings);

        _Planete.GetComponent <Planet>().colourSettings.planetMaterial = _PlaneteMaterial;

        if (!gameObject.GetComponent <Attractor>())
        {
            _Planete.AddComponent <Attractor>();
        }
        _Planete.GetComponent <Attractor>().impulsion      = _Impulsion;
        _Planete.GetComponent <Attractor>().isOrbit        = _IsOrbit;
        _Planete.GetComponent <Attractor>().orbitReference = GameObject.Find(_NomDuSoleil).GetComponent <Attractor>();
        //_Planete.transform.position = Vector3.zero;
        _Planete.transform.position = new Vector3(_DistWithSun, 0, 0);
        _Planete.GetComponent <Planet>().GeneratePlanet();
        Debug.Log("[" + GetType().Name + "] Impulsion donnée, is orbit= " + _IsOrbit);
        _Planete.GetComponent <Attractor>().StartImpulsion();
    }
Exemplo n.º 13
0
 public AstresDonnees(float impulsion, bool isOrbit, float radius, int resolution, float distWithSun, string name, ShapeSettings shape, ColourSettings color)
 {
     Impulsion   = impulsion;
     IsOrbit     = isOrbit;
     Radius      = radius;
     Resolution  = resolution;
     DistWithSun = distWithSun;
     Name        = name;
     Shape       = shape;
     Color       = color;
 }
Exemplo n.º 14
0
    virtual public void createdByParent(INoiseGenerator ng, ChunkSettings cs, Vector3 pos, ColourSettings new_col_set)
    {
        Debug.Log("created by parent");
        //noise_set = ns;
        chunk_set  = cs;
        has_parent = true;
        noise_gen  = ng;
        col_set    = new_col_set;

        init();
        updateMesh();
        transform.position = pos;
    }
Exemplo n.º 15
0
    public void UpdateSettings(ColourSettings settings)
    {
        this.settings = settings;

        if (texture == null || texture.height != settings.biomeColourSettings.biomes.Length) // update texture if null or if height not equal to nb of biomes
        {
            // first half of each texture strip is ocean texture
            texture = new Texture2D(textureResolution * 2, settings.biomeColourSettings.biomes.Length, TextureFormat.RGBA32, false); // width, height (each row stores the colour for a biome) // disable mipmapping (lowres texture version for viewing from far away)
        }

        // Initialise biome noise filter
        biomeNoiseFilter = NoiseFilterFactory.CreateNoiseFilter(settings.biomeColourSettings.noise);
    }
Exemplo n.º 16
0
        public Beatmap(string aCode, float?aStarRating = null, string aSongPath = null, string aMapPath = null)
        {
            code     = aCode;
            songPath = aSongPath;
            mapPath  = aMapPath;

            string[] lines = aCode.Split(new string[] { "\n" }, StringSplitOptions.None);

            generalSettings    = ParserStatic.GetSettings(lines, "General", aSectionLines => new GeneralSettings(aSectionLines));
            metadataSettings   = ParserStatic.GetSettings(lines, "Metadata", aSectionLines => new MetadataSettings(aSectionLines));
            difficultySettings = ParserStatic.GetSettings(lines, "Difficulty", aSectionLines => new DifficultySettings(aSectionLines));
            colourSettings     = ParserStatic.GetSettings(lines, "Colours", aSectionLines => new ColourSettings(aSectionLines));

            // event type 3 seems to be "background colour transformation" https://i.imgur.com/Tqlz3s5.png

            backgrounds = GetEvents(lines, new List <string>()
            {
                "Background", "0"
            }, anArgs => new Background(anArgs));
            videos = GetEvents(lines, new List <string>()
            {
                "Video", "1"
            }, anArgs => new Video(anArgs));
            breaks = GetEvents(lines, new List <string>()
            {
                "Break", "2"
            }, anArgs => new Break(anArgs));
            sprites = GetEvents(lines, new List <string>()
            {
                "Sprite", "4"
            }, anArgs => new Sprite(anArgs));
            storyHitSounds = GetEvents(lines, new List <string>()
            {
                "Sample", "5"
            }, anArgs => new StoryHitSound(anArgs));
            animations = GetEvents(lines, new List <string>()
            {
                "Animation", "6"
            }, anArgs => new Animation(anArgs));

            timingLines = GetTimingLines(lines);
            hitObjects  = GetHitobjects(lines);

            if (generalSettings.mode == Mode.Standard)
            {
                // Stacking is standard-only.
                ApplyStacking();

                starRating = aStarRating ?? (float)StandardDifficultyCalculator.Calculate(this).Item3;
            }
        }
Exemplo n.º 17
0
    //Devuelve un nuevo objeto copia del invocante
    public ColourSettings Clone()
    {
        ColourSettings newCS = CreateInstance <ColourSettings>();

        newCS.gradient       = this.gradient;
        newCS.oceanColour    = this.oceanColour;
        newCS.planetMaterial = this.planetMaterial;

        newCS.oceanTexture      = this.oceanTexture;
        newCS.oceanTextureScale = this.oceanTextureScale;

        newCS.terrainTexture      = this.terrainTexture;
        newCS.terrainTextureScale = this.terrainTextureScale;

        return(newCS);
    }
Exemplo n.º 18
0
    public AnimationOperation(AnimationOperation animationOperation)
    {
        targetObject = animationOperation.targetObject;
        type         = animationOperation.type;
        easing       = animationOperation.easing;
        delay        = animationOperation.delay;
        duration     = animationOperation.duration;

        activate                 = animationOperation.activate;
        scaleSettings            = animationOperation.scaleSettings;
        rotateSettings           = animationOperation.rotateSettings;
        worldPositionSettings    = animationOperation.worldPositionSettings;
        anchoredPositionSettings = animationOperation.anchoredPositionSettings;
        colourSettings           = animationOperation.colourSettings;
        fadeSettings             = animationOperation.fadeSettings;
    }
Exemplo n.º 19
0
    // ********************************************************************** //

    public ColourSettings RandomizeColourSettings(ColourSettings settings, ColourSamplingStatistics colorStats)
    {
        //tintColor = colorStats.setMean ? RandomColourAroundMean(colorStats) : RandomColour(saturation);
        tintColor = colorStats.setMean ? RandomSaturationAroundMean(colorStats) : RandomColour(); // manipulating saturation only now

        darkColor   = new Color(tintColor.r * .6f, tintColor.g * .6f, tintColor.b * .6f);
        colourLevel = colorStats.colourLevel;

        settings.oceanColour = RandomOceanGradient();

        // a gradient colour tint for the terrain/mountains
        settings.biomeColourSettings.biomes[0].gradient = RandomMountainGradient();

        for (int i = 0; i < settings.biomeColourSettings.biomes.Length; i++)
        {
            ColourSettings.BiomeColourSettings.Biome biome = settings.biomeColourSettings.biomes[i];

            // an overall colour tint
            biome.tintPercent = 0.1f; // HRS probably doesnt make much of a difference
            biome.tint        = tintColor;
        }
        return(settings);
    }
Exemplo n.º 20
0
        public Beatmap(string code, double?starRating = null, string songPath = null, string mapPath = null)
        {
            this.code     = code;
            this.songPath = songPath;
            this.mapPath  = mapPath;

            string[] lines = code.Split(new string[] { "\n" }, StringSplitOptions.None);

            generalSettings    = ParserStatic.GetSettings(lines, "General", sectionLines => new GeneralSettings(sectionLines));
            metadataSettings   = ParserStatic.GetSettings(lines, "Metadata", sectionLines => new MetadataSettings(sectionLines));
            difficultySettings = ParserStatic.GetSettings(lines, "Difficulty", sectionLines => new DifficultySettings(sectionLines));
            colourSettings     = ParserStatic.GetSettings(lines, "Colours", sectionLines => new ColourSettings(sectionLines));

            // event type 3 seems to be "background colour transformation" https://i.imgur.com/Tqlz3s5.png

            backgrounds = GetEvents(lines, new List <string>()
            {
                "Background", "0"
            }, args => new Background(args));
            videos = GetEvents(lines, new List <string>()
            {
                "Video", "1"
            }, args => new Video(args));
            breaks = GetEvents(lines, new List <string>()
            {
                "Break", "2"
            }, args => new Break(args));
            sprites = GetEvents(lines, new List <string>()
            {
                "Sprite", "4"
            }, args => new Sprite(args));
            samples = GetEvents(lines, new List <string>()
            {
                "Sample", "5"
            }, args => new Sample(args));
            animations = GetEvents(lines, new List <string>()
            {
                "Animation", "6"
            }, args => new Animation(args));

            timingLines = GetTimingLines(lines);
            hitObjects  = GetHitobjects(lines);

            if (generalSettings.mode != Mode.Standard)
            {
                return;
            }

            // Stacking is standard-only.
            ApplyStacking();

            if (starRating != null)
            {
                this.starRating = starRating.Value;
            }
            else
            {
                DifficultyAttributes attributes = new OsuDifficultyCalculator(this).Calculate();
                difficultyAttributes = attributes;
                this.starRating      = attributes.StarRating;
            }
        }
Exemplo n.º 21
0
 public ColourGenerator(ColourSettings cs)
 {
     this.col_set = cs;
     texture      = new Texture2D(texture_res, 1);
 }
Exemplo n.º 22
0
    // Start is called before the first frame update
    void Start()
    {
        if (!_errorText)
        {
            throw new Exception("You must define an error message text !");
        }

        _errorText.enabled = false;

        _IsOrbit = true;
        if (!ListeAstreDontDestroyOnLoad)
        {
            ListeAstreDontDestroyOnLoad = GameObject.Find("DontDestroyOnLoad").GetComponent <ListAstre>();
        }
        for (int i = 0; i < transform.childCount; i++)
        {
            if (transform.GetChild(i).name == "PanelPlanetSetting")
            {
                _PanelPlanetSetting = transform.GetChild(i);
            }
            if (transform.GetChild(i).name == "PanelListAstreInSolarSystem")
            {
                _PanelListAstreInSolarSystem = transform.GetChild(i);
            }
        }
        for (int i = 0; i < _PanelPlanetSetting.childCount; i++)
        {
            if (_PanelPlanetSetting.GetChild(i).name == "Name")
            {
                _NameInputField = _PanelPlanetSetting.GetChild(i).GetComponent <InputField>();
            }
            if (_PanelPlanetSetting.GetChild(i).name == "Resolution")
            {
                _ResolutionInputField = _PanelPlanetSetting.GetChild(i).GetComponent <InputField>();
            }
            if (_PanelPlanetSetting.GetChild(i).name == "Radius")
            {
                _RadiusInputField = _PanelPlanetSetting.GetChild(i).GetComponent <InputField>();
            }
            if (_PanelPlanetSetting.GetChild(i).name == "Impulsion")
            {
                _ImpulsionInputField = _PanelPlanetSetting.GetChild(i).GetComponent <InputField>();
            }
            if (_PanelPlanetSetting.GetChild(i).name == "Distance")
            {
                _DistInputField = _PanelPlanetSetting.GetChild(i).GetComponent <InputField>();
            }
            if (_PanelPlanetSetting.GetChild(i).name == "AddAstre")
            {
                _AddAstre = _PanelPlanetSetting.GetChild(i).GetComponent <Button>();
            }
            if (_PanelPlanetSetting.GetChild(i).name == "ShapeSetting")
            {
                _ShapeSettingDropDown = _PanelPlanetSetting.GetChild(i).GetComponent <Dropdown>();
            }
            if (_PanelPlanetSetting.GetChild(i).name == "ColourSetting")
            {
                _ColorSettingDropDown = _PanelPlanetSetting.GetChild(i).GetComponent <Dropdown>();
            }
        }

        for (int i = 0; i < _PanelListAstreInSolarSystem.childCount; i++)
        {
            if (_PanelListAstreInSolarSystem.GetChild(i).name == "ListeOfAstres")
            {
                _ListeOfAstreText = _PanelListAstreInSolarSystem.GetChild(i).GetComponent <Text>();
            }
        }

        _NameInputField.onEndEdit.AddListener(delegate { setName(); });
        _ResolutionInputField.onEndEdit.AddListener(delegate { setResolution(); });
        _RadiusInputField.onEndEdit.AddListener(delegate { setRadius(); });
        _ImpulsionInputField.onEndEdit.AddListener(delegate { setImpulsion(); });
        _DistInputField.onEndEdit.AddListener(delegate { setDistance(); });
        _AddAstre.onClick.AddListener(delegate { AddAstre(); });

        List <string> namesshapes = new List <string>();

        namesshapes.Add("EarthShape");
        namesshapes.Add("MarsShape");
        namesshapes.Add("VenusShape");
        _ShapeSettingDropDown.options.Clear();
        _ShapeSettingDropDown.AddOptions(namesshapes);
        _ShapeSetting = Resources.Load("Script/Shapes/" + _ShapeSettingDropDown.options[_ShapeSettingDropDown.value].text, typeof(ShapeSettings)) as ShapeSettings;
        _ShapeSettingDropDown.onValueChanged.AddListener(delegate { setShape(); });

        List <string> namescolors = new List <string>();

        namescolors.Add("EarthColor");
        namescolors.Add("MarsColor");
        namescolors.Add("VenusColor");
        _ColorSettingDropDown.options.Clear();
        _ColorSettingDropDown.AddOptions(namescolors);
        _ColorSetting = Resources.Load("Script/Colors/" + _ColorSettingDropDown.options[_ColorSettingDropDown.value].text, typeof(ColourSettings)) as ColourSettings;
        _ColorSettingDropDown.onValueChanged.AddListener(delegate { setColor(); });
    }
Exemplo n.º 23
0
 void setColor()
 {
     _ColorSetting = (Resources.Load("Script/Colors/" + _ColorSettingDropDown.options[_ColorSettingDropDown.value].text, typeof(ColourSettings)) as ColourSettings);
 }