Ejemplo n.º 1
0
 public PatrolPlacer(Random random, World world, PatrolPlacerInfo info)
 {
     this.random = random;
     this.world  = world;
     bounds      = world.Map.Bounds;
     this.info   = info;
 }
Ejemplo n.º 2
0
        MapType(string name, List <TextNode> nodes)
        {
            Name = name;

            var fields = TypeLoader.GetFields(this);

            foreach (var node in nodes)
            {
                switch (node.Key)
                {
                case nameof(TerrainGenerationBase):
                    TerrainGenerationBase = new TerrainGeneratorInfo(node.Convert <int>(), node.Children);

                    break;

                case nameof(NoiseMaps):
                    NoiseMaps = new NoiseMapInfo[node.Children.Count];

                    for (int i = 0; i < NoiseMaps.Length; i++)
                    {
                        var child = node.Children[i];
                        NoiseMaps[i] = new NoiseMapInfo(child.Convert <int>(), child.Children);
                    }

                    break;

                case nameof(PatrolPlacers):
                    PatrolPlacers = new PatrolPlacerInfo[node.Children.Count];

                    for (int i = 0; i < PatrolPlacers.Length; i++)
                    {
                        PatrolPlacers[i] = new PatrolPlacerInfo(node.Children[i].Children);
                    }

                    break;

                case nameof(WeatherEffects):
                    WeatherEffects = new WeatherEffect[node.Children.Count];

                    for (int i = 0; i < WeatherEffects.Length; i++)
                    {
                        WeatherEffects[i] = new WeatherEffect(node.Children[i].Children);
                    }

                    break;

                default:
                    TypeLoader.SetValue(this, fields, node);

                    break;
                }
            }

            if (TerrainGenerationBase == null)
            {
                throw new MissingNodeException(name, "BaseTerrainGeneration");
            }
        }