Example #1
0
    /// <summary>
    /// Added this code to a method so that I could call it from the Editor script
    /// </summary>
    public void Generate()
    {
        // Setup parameters based on user settings
        if (!CustomSeed)
        {
            Seed = Random.Range(0, 100000000);
        }

        if (!CustomSize)
        {
            Size = AvailableSizes[Random.Range(0, AvailableSizes.Length)];
        }

        if (!CustomColor)
        {
            //MainColor = AvailableColors[Random.Range(0, AvailableColors.Length)];
            SS_Random random = new SS_Random(Seed);
            MainColor = random.NextColor();
        }

        if (SS_StellarSprite.Threaded)
        {
            // Create the Stellar Sprite Object in it's own thread
            Thread generatorThread = new Thread(new ThreadStart(GenerateSprite));
            generatorThread.Start();
        }
        else
        {
            GenerateSprite();
        }
    }
Example #2
0
    /// <summary>
    /// Added this code to a method so that I could call it from the Editor script
    /// </summary>
    public void Generate()
    {
        // Setup parameters based on user settings
        if (!CustomSeed)
        {
            Seed = Random.Range(0, 100000000);
        }

        if (!CustomStationType)
        {
            System.Array values = System.Enum.GetValues(typeof(SS_StationType));
            StationType = (SS_StationType)values.GetValue(Random.Range(0, values.Length));
        }

        if (!CustomTint)
        {
            Tint = new Color(Random.Range(0f, 1f), Random.Range(0f, 1f), Random.Range(0f, 1f));
        }

        if (!CustomPods)
        {
            SS_Random random = new SS_Random(Seed);
            NumberOfPods = random.RangeEven(2, 10);
        }

        if (SS_StellarSprite.Threaded)
        {
            // Create the Stellar Sprite Object in it's own thread
            Thread generatorThread = new Thread(new ThreadStart(GenerateSprite));
            generatorThread.Start();
        }
        else
        {
            GenerateSprite();
        }
    }