Beispiel #1
0
        // Grabs a PQSMod of type T from a parameter with a given PQS
        public override void Create(PQSLandControl mod, PQS pqsVersion)
        {
            base.Create(mod, pqsVersion);

            // Create the callback list for Scatters
            Scatters = new CallbackList <LandClassScatterLoader>(e =>
            {
                foreach (LandClassScatterLoader loader in Scatters)
                {
                    loader.Scatter.transform.parent = Mod.transform;
                }

                Mod.scatters = Scatters.Where(scatter => !scatter.Delete)
                               .Select(scatter => scatter.Value).ToArray();
            });

            // Load Scatters
            if (Mod.scatters != null)
            {
                for (Int32 i = 0; i < Mod.scatters.Length; i++)
                {
                    // Only activate the callback if we are adding the last loader
                    Scatters.Add(new LandClassScatterLoader(Mod.scatters[i]), i == Mod.scatters.Length - 1);
                }
            }
            else
            {
                Mod.scatters = new PQSLandControl.LandClassScatter[0];
            }

            // Create the callback list for LandClasses
            LandClasses = new CallbackList <LandClassLoader>(e =>
            {
                // Assign each scatter amount with their corresponding scatter
                foreach (PQSLandControl.LandClassScatterAmount amount in e.Scatter)
                {
                    Int32 i = 0;
                    while (i < Mod.scatters.Length)
                    {
                        if (Mod.scatters[i].scatterName.Equals(amount.scatterName))
                        {
                            break;
                        }

                        i++;
                    }

                    if (i >= Mod.scatters.Length)
                    {
                        continue;
                    }
                    amount.scatterIndex = i;
                    amount.scatter      = Mod.scatters[i];
                }

                // Assign the new values
                Mod.landClasses = LandClasses.Where(landClass => !landClass.Delete)
                                  .Select(landClass => landClass.Value).ToArray();
            });

            // Load LandClasses
            if (Mod.landClasses != null)
            {
                for (Int32 i = 0; i < Mod.landClasses.Length; i++)
                {
                    // Only activate the callback if we are adding the last loader
                    LandClasses.Add(new LandClassLoader(Mod.landClasses[i]), i == Mod.landClasses.Length - 1);
                }
            }
            else
            {
                Mod.landClasses = new PQSLandControl.LandClass[0];
            }
        }
Beispiel #2
0
        // Creates the a PQSMod of type T with given PQS
        public override void Create(PQS pqsVersion)
        {
            base.Create(pqsVersion);

            // Initialize default parameters
            Mod.altitudeSeed         = 1;
            Mod.altitudeOctaves      = 1;
            Mod.altitudePersistance  = 1;
            Mod.altitudeFrequency    = 1;
            Mod.latitudeSeed         = 1;
            Mod.latitudeOctaves      = 1;
            Mod.latitudePersistance  = 1;
            Mod.latitudeFrequency    = 1;
            Mod.longitudeSeed        = 1;
            Mod.longitudeOctaves     = 1;
            Mod.longitudePersistance = 1;
            Mod.longitudeFrequency   = 1;

            // Create the callback list for Scatters
            Scatters = new CallbackList <LandClassScatterLoader>(e =>
            {
                foreach (LandClassScatterLoader loader in Scatters)
                {
                    loader.Scatter.transform.parent = Mod.transform;
                }

                Mod.scatters = Scatters.Where(scatter => !scatter.Delete)
                               .Select(scatter => scatter.Value).ToArray();
            });
            Mod.scatters = new PQSLandControl.LandClassScatter[0];

            // Create the callback list for LandClasses
            LandClasses = new CallbackList <LandClassLoader>(e =>
            {
                // Assign each scatter amount with their corresponding scatter
                foreach (PQSLandControl.LandClassScatterAmount amount in e.Scatter)
                {
                    Int32 i = 0;
                    while (i < Mod.scatters.Length)
                    {
                        if (Mod.scatters[i].scatterName.Equals(amount.scatterName))
                        {
                            break;
                        }

                        i++;
                    }

                    if (i >= Mod.scatters.Length)
                    {
                        continue;
                    }
                    amount.scatterIndex = i;
                    amount.scatter      = Mod.scatters[i];
                }

                // Assign the new values
                Mod.landClasses = LandClasses.Where(landClass => !landClass.Delete)
                                  .Select(landClass => landClass.Value).ToArray();
            });
            Mod.landClasses = new PQSLandControl.LandClass[0];
        }