Ejemplo n.º 1
0
        public override void DebugDrawGizmos()
        {
            if (cityConfig == null)
            {
                cityConfig = GetComponent <CircularCityDungeonConfig>();
                if (cityConfig == null)
                {
                    return;
                }
            }

            if (model == null)
            {
                model = GetComponent <CircularCityDungeonModel>();
            }

            if (cityModel == null)
            {
                cityModel = model as CircularCityDungeonModel;
            }

            if (cityModel == null)
            {
                return;
            }

            DebugDrawGraphGizmo(cityModel.roadGraph, Color.green, Color.red);
            DebugDrawGraphGizmo(cityModel.layoutGraph, Color.yellow, Color.blue);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Builds the dungeon layout.  In this method, you should build your dungeon layout and save it in your model file
        /// No markers should be emitted here.   (EmitMarkers function will be called later by the engine to do that)
        /// </summary>
        /// <param name="config">The builder configuration</param>
        /// <param name="model">The dungeon model that the builder will populate</param>
        public override void BuildDungeon(DungeonConfig config, DungeonModel model)
        {
            var sw = System.Diagnostics.Stopwatch.StartNew();

            base.BuildDungeon(config, model);

            random = new System.Random((int)config.Seed);

            // We know that the dungeon prefab would have the appropriate config and models attached to it
            // Cast and save it for future reference
            cityConfig       = config as CircularCityDungeonConfig;
            cityModel        = model as CircularCityDungeonModel;
            cityModel.Config = cityConfig;

            // Generate the city layout and save it in a model.   No markers are emitted here.
            GenerateCityLayout();

            sw.Stop();
            Debug.Log("Time elapsed: " + (sw.ElapsedMilliseconds / 1000.0f) + " s");
        }