Esempio n. 1
0
        /// <summary>
        /// Randomize building heights deterministically based on a random seed plus the structure's
        /// place id.
        /// </summary>
        public void OnWillCreateExtrudedStructure(WillCreateExtrudedStructureArgs args)
        {
            if (!enabled)
            {
                return;
            }

            string placeId = args.MapFeature.MapFeatureMetadata.PlaceId;
            PRNG   prng    = new PRNG(RandomSeed);

            for (int i = 0; i < placeId.Length; i++)
            {
                prng.Mix(placeId[i]);
            }

            ExtrudedStructureStyle.Builder builder = args.Style.AsBuilder();
            builder.ApplyFixedHeight = true;
            int minHeight = MinExtrudedStructureHeight;
            int maxHeight = MaxExtrudedStructureHeight;

            builder.FixedHeight = minHeight + prng.NextRandomFloat() * (maxHeight - minHeight);

            args.Style = builder.Build();
        }