Beispiel #1
0
 public BigMob(BigMob other)
 {
     if (other is null)
     {
         throw new ArgumentNullException(nameof(other));
     }
     DefaultColor = other.DefaultColor;
     Location     = other.Location;
     Facing       = other.Facing;
     foreach (var(dir, mtr) in other.Reps)
     {
         Reps[dir] = new MultiTileRepresentation(mtr);
     }
     Blocking = other.Blocking;
 }
Beispiel #2
0
        private void InitObjects()
        {
            player = new Mob {
                Rep = new Representation {
                    Glyph = '@', Color = Color.Aquamarine
                }
            };
            playerPhysical = new Physical()
            {
                Name     = "Rogue",
                Class    = "Delivery Driver",
                Health   = 23,
                Strength = 4,
                Luck     = 12,
                Wiles    = 2,
                XP       = 0
            };

            wagon = new BigMob(Prototype.Wagon);
            bigMobs.Add(wagon);

            for (int i = 0; i < 20; i++)
            {
                bigMobs.Add(new BigMob(Prototype.Log)
                {
                    Location = Coord.Get(rng.NextInt(width), rng.NextInt(height)),
                    Facing   = rng.RandomElement(DirectionTools.Cardinals)
                });
            }

            for (int x = 0; x < width; x++)
            {
                for (int y = 0; y < height; y++)
                {
                    byte blue = BlueNoise.GetSeeded(x, y, 1234567u);
                    if (blue < 7)
                    {
                        littleMobs.Add(new Mob(Prototype.Pebble)
                        {
                            Location = Coord.Get(x, y)
                        });
                    }
                    else if (blue < 30)
                    {
                        littleMobs.Add(new Mob(Prototype.Bush)
                        {
                            Location = Coord.Get(x, y)
                        });
                    }
                    else
                    {
                        littleMobs.Add(new Mob(Prototype.Grass)
                        {
                            Location = Coord.Get(x, y)
                        });
                    }
                }
            }

            // TODO - check that space is clear enough for them to get placed
            wagon.Location  = Coord.Get(width / 2, height / 2);
            player.Location = Coord.Get(wagon.Location.X - 4, wagon.Location.Y);;
        }