public Economy(Faction faction, float currentMoney, PlayState state, string companyName, string companyMotto, NamedImageFrame companyLogo, Color companyColor) { PlayState = state; Company = Company.GenerateRandom(currentMoney, 1.0f, Company.Sector.Exploration); Company.Name = companyName; Company.SecondaryColor = Color.White; Company.Logo = companyLogo; Company.Motto = companyMotto; Company.Assets = currentMoney; Company.BaseColor = companyColor; CurrentMoney = currentMoney; Faction = faction; Market = new List<Company> { Company, Company.GenerateRandom(1000, 1.0f, Company.Sector.Exploration), Company.GenerateRandom(1200, 5.0f, Company.Sector.Exploration), Company.GenerateRandom(1500, 10.0f, Company.Sector.Exploration), Company.GenerateRandom(1300, 10.0f, Company.Sector.Manufacturing), Company.GenerateRandom(1200, 10.0f, Company.Sector.Manufacturing), Company.GenerateRandom(1500, 15.0f, Company.Sector.Military), Company.GenerateRandom(1300, 10.0f, Company.Sector.Military), Company.GenerateRandom(1200, 15.0f, Company.Sector.Military), Company.GenerateRandom(1500, 25.0f, Company.Sector.Magic), Company.GenerateRandom(1200, 30.0f, Company.Sector.Magic), Company.GenerateRandom(1300, 40.0f, Company.Sector.Magic), Company.GenerateRandom(1500, 50.0f, Company.Sector.Finance), Company.GenerateRandom(1800, 60.0f, Company.Sector.Finance) }; PlayState.Time.NewDay += Time_NewDay; }
public Animation(NamedImageFrame frame) : this(GameState.Game.GraphicsDevice, new SpriteSheet(frame.AssetName), frame.AssetName, frame.SourceRect.Width, frame.SourceRect.Height, new List<Point>(), false, Color.White, 15.0f, frame.SourceRect.Width / 32.0f, frame.SourceRect.Height / 32.0f, false) { Frames.Add(new Point(frame.SourceRect.X / frame.SourceRect.Width, frame.SourceRect.Y / frame.SourceRect.Height)); CreatePrimitives(GameState.Game.GraphicsDevice); Speeds = new List<float>(); SpeedMultiplier = 1.0f; }
public Resource(ResourceLibrary.ResourceType type, float money, string description, NamedImageFrame image, params ResourceTags[] tags) { Type = type; MoneyValue = money; Description = description; Image = image; Tags = new List<ResourceTags>(); Tags.AddRange(tags); FoodContent = 0; }
public BuffSpell(params Creature.Buff[] buffs) { Buffs = buffs.ToList(); Mode = SpellMode.SelectEntities; Name = "Buff spell"; Description = "Apply buffs to selected creatures"; Hint = "Click and drag to select creatures"; ManaCost = 20; Image = new NamedImageFrame(ContentPaths.GUI.icons, 32, 0, 2); }
/// <summary> /// Draws an indicator image over the creature telling us what its thinking. /// </summary> public void DrawIndicator(NamedImageFrame image, Color tint) { if (!((DateTime.Now - LastIndicatorTime).TotalSeconds >= IndicatorRateLimit)) { return; } IndicatorManager.DrawIndicator(image, AI.Position + new Vector3(0, 0.5f, 0), 1, 1.5f, new Vector2(image.SourceRect.Width / 2.0f, -image.SourceRect.Height / 2.0f), tint); LastIndicatorTime = DateTime.Now; }
public MinimapIcon(Body parent, NamedImageFrame icon) : base(parent.Manager, "Icon", parent, Matrix.Identity, Vector3.One, Vector3.Zero) { Icon = icon; IconScale = 1.0f; AddToCollisionManager = false; FrustrumCull = false; IsVisible = false; AddCacheType(GameObjectCaching.MiniMapIconCache); }
public BuffSpell(WorldManager world, params Buff[] buffs) : base(world) { Buffs = buffs.ToList(); Mode = SpellMode.SelectEntities; Name = "Buff spell"; Description = "Apply buffs to selected creatures"; Hint = "Click and drag to select creatures"; ManaCost = 20; Image = new NamedImageFrame(ContentPaths.GUI.icons, 32, 0, 2); TileRef = 16; }
public Resource(ResourceLibrary.ResourceType type, float money, string description, NamedImageFrame image, int NewGuiSprite, Color tint, params ResourceTags[] tags) { Type = type; MoneyValue = money; Description = description; Image = image; this.NewGuiSprite = NewGuiSprite; Tint = tint; Tags = new List <ResourceTags>(); Tags.AddRange(tags); FoodContent = 0; }
public override void Render3D(DwarfGame game, DwarfTime time) { NamedImageFrame frame = new NamedImageFrame("newgui/pointers", 32, 5, 0); foreach (GameComponent tree in World.UserInterface.BodySelector.CurrentBodies) { if (tree.Tags.Contains("Vegetation")) { Drawer3D.DrawBox(tree.BoundingBox, Color.LightGreen, 0.1f, false); Drawer2D.DrawSprite(frame, tree.BoundingBox.Center(), Vector2.One * 0.5f, Vector2.Zero, new Color(255, 255, 255, 100)); } } }
void Create(DwarfGame game) { WorldSize = new Point((game.GraphicsDevice.Viewport.Width / TileSize.X) + 4, 10); World = new Tile[WorldSize.X, WorldSize.Y]; String[] sheets = { ContentPaths.Entities.Dwarf.Sprites.soldier, ContentPaths.Entities.Dwarf.Sprites.worker, ContentPaths.Entities.Dwarf.Sprites.crafter, ContentPaths.Entities.Dwarf.Sprites.wizard, ContentPaths.Entities.Dwarf.Sprites.musket }; Texture2D tiles = AssetManager.GetContentTexture(ContentPaths.Terrain.terrain_tiles); Balloon = AssetManager.GetContentTexture(ContentPaths.Entities.Balloon.Sprites.balloon); Dwarf = AssetManager.GetContentTexture(Datastructures.SelectRandom(sheets)); Soil = new NamedImageFrame(ContentPaths.Terrain.terrain_tiles, 32, 2, 0); Grass = new NamedImageFrame(ContentPaths.Terrain.terrain_tiles, 32, 3, 0); DwarfFrames = new List <ImageFrame>(new ImageFrame[] { new ImageFrame(Dwarf, new Rectangle(0, 80, 32, 40)), new ImageFrame(Dwarf, new Rectangle(32, 80, 32, 40)), new ImageFrame(Dwarf, new Rectangle(64, 80, 32, 40)), new ImageFrame(Dwarf, new Rectangle(96, 80, 32, 40)), }); UpFrame = new NamedImageFrame(AssetManager.GetContentTexture(Datastructures.SelectRandom(sheets)), new Rectangle(0, 239, 32, 40)); DownFrame = new NamedImageFrame(AssetManager.GetContentTexture(Datastructures.SelectRandom(sheets)), new Rectangle(32, 239, 32, 40)); for (var x = 0; x < WorldSize.X; ++x) { World[x, 0] = new Tile { Solid = true, Image = Soil } } ; for (var x = 0; x < WorldSize.X; ++x) { World[x, 1] = new Tile { Solid = true, Image = Grass } } ; }
public void Initialize(List <SpriteSheet> sprites) { Images = new List <NamedImageFrame>(); foreach (SpriteSheet sprite in sprites) { Images.AddRange(sprite.GenerateFrames()); } if (Images.Count > 0) { DefaultTexture = Images.First(); } OnTextureSelected += TextureLoadDialog_OnTextureSelected; int rc = Math.Max((int)(Math.Round(Math.Sqrt(Images.Count) + 0.5f)), 2); if (SpriteLayout == null) { SpriteLayout = new GridLayout(GUI, Layout, rc, rc) { WidthSizeMode = SizeMode.Fixed, HeightSizeMode = SizeMode.Fixed }; } else { RemoveChild(SpriteLayout); SpriteLayout = new GridLayout(GUI, Layout, rc, rc) { WidthSizeMode = SizeMode.Fixed, HeightSizeMode = SizeMode.Fixed }; } Layout.SetComponentPosition(SpriteLayout, 0, 1, 4, 2); Layout.UpdateSizes(); for (int i = 0; i < Images.Count; i++) { ImagePanel img = new ImagePanel(GUI, SpriteLayout, Images[i]) { Highlight = true, KeepAspectRatio = true, AssetName = Images[i].AssetName, ConstrainSize = true }; int row = i / rc; int col = i % rc; NamedImageFrame texFile = Images[i]; img.OnClicked += () => img_OnClicked(texFile); SpriteLayout.SetComponentPosition(img, col, row, 1, 1); } }
public static void DrawIndicator(NamedImageFrame image, Vector3 position, float time, float scale, Vector2 offset, Color tint) { lock (IndicatorLock) { Indicators.Add(new Indicator { CurrentTime = new Timer(time, true), Image = image, Position = position, MaxScale = scale, Offset = offset, Tint = tint }); } }
public override void Render3D(DwarfGame game, DwarfTime time) { NamedImageFrame frame = new NamedImageFrame("newgui/pointers", 32, 6, 0); foreach (var body in World.UserInterface.BodySelector.CurrentBodies) { if (body.Tags.Contains("Resource")) { Drawer2D.DrawText(body.Name, body.Position, Color.White, Color.Black); BoundingBox bounds = body.BoundingBox; Drawer3D.DrawBox(bounds, Color.Orange, 0.02f, false); Drawer2D.DrawSprite(frame, body.Position + Vector3.One * 0.5f, Vector2.One * 0.5f, Vector2.Zero, new Color(255, 255, 255, 100)); } } }
public BatchBillboardPrimitive( NamedImageFrame spriteSheet, int frameWidth, int frameHeight, Point frame, float width, float height, bool flipped, List <Matrix> relativeTransforms, List <Color> tints, List <Color> vertColors) { RelativeTransforms = relativeTransforms; UVs = new BillboardPrimitive.BoardTextureCoords(spriteSheet.SafeGetImage().Width, spriteSheet.SafeGetImage().Height, frameWidth, frameHeight, frame, flipped); Width = width; Tints = tints; VertColors = vertColors; Height = height; CreateVerticies(Color.White); Texture = spriteSheet; }
public static void Initialize(GraphicsDevice graphics, ContentManager content) { Primitives = new Dictionary <string, GeometricPrimitive>(); List <Matrix> treeTransforms = new List <Matrix> { Matrix.Identity, Matrix.CreateRotationY((float)Math.PI / 2.0f) }; List <Color> treeTints = new List <Color> { Color.White, Color.White }; var primitives = FileUtils.LoadJsonListFromMultipleSources <PrimitiveRecord>(ContentPaths.primitives, null, p => p.Name); foreach (var prim in primitives) { var spriteSheet = new NamedImageFrame(prim.Asset); int width = spriteSheet.SafeGetImage().Width; int height = spriteSheet.SafeGetImage().Height; switch (prim.Type) { case PrimitiveType.Box: Primitives[prim.Name] = new OldBoxPrimitive(graphics, prim.BoxSize.X, prim.BoxSize.Y, prim.BoxSize.Z, new OldBoxPrimitive.BoxTextureCoords(width, height, prim.BoxFaceData[0], prim.BoxFaceData[1], prim.BoxFaceData[2], prim.BoxFaceData[3], prim.BoxFaceData[4], prim.BoxFaceData[5])); // WTF break; case PrimitiveType.Cross: Primitives[prim.Name] = new BatchBillboardPrimitive(graphics, spriteSheet, width, height, new Point(0, 0), width / 32.0f, height / 32.0f, false, treeTransforms, treeTints, treeTints); break; case PrimitiveType.Quad: Primitives[prim.Name] = new BatchBillboardPrimitive(graphics, spriteSheet, width, height, new Point(0, 0), width / 32.0f, height / 32.0f, false, new List <Matrix> { treeTransforms[0] }, new List <Color> { treeTints[0] }, new List <Color> { treeTints[0] }); break; } } }
public static Company GenerateRandom(float assets, float stockPrice, Sector industry) { Texture2D texture = TextureManager.GetTexture(ContentPaths.Logos.logos); int row = 0; switch (industry) { case Sector.Magic: row = 3; break; case Sector.Finance: row = 3; break; case Sector.Exploration: row = 0; break; case Sector.Manufacturing: row = 1; break; case Sector.Military: row = 2; break; } NamedImageFrame image = new NamedImageFrame(ContentPaths.Logos.logos, 32, PlayState.Random.Next(0, texture.Width / 32), row); Color c = new Color(PlayState.Random.Next(0, 255), PlayState.Random.Next(0, 255), PlayState.Random.Next(0, 255)); return(new Company() { Assets = assets, StockPrice = stockPrice, Industry = industry, Logo = image, Name = GenerateName(industry), Motto = GenerateMotto(), BaseColor = c, SecondaryColor = c, StockHistory = GenerateRandomStockHistory(stockPrice, 10), LastAssets = assets }); }
public Resource(ResourceLibrary.ResourceType type, DwarfBux money, string description, NamedImageFrame image, int WidgetsSprite, Color tint, params ResourceTags[] tags) { Type = type; MoneyValue = money; Description = description; Image = image; this.GuiLayers = new List <TileReference>(); GuiLayers.Add(new TileReference("resources", WidgetsSprite)); Tint = tint; Tags = new List <ResourceTags>(); Tags.AddRange(tags); FoodContent = 0; CanCraft = false; CraftPrereqs = new List <Quantitiy <Resource.ResourceTags> >(); CompositeLayers = null; AleName = ""; }
public override void Render(DwarfGame game, GraphicsDevice graphics, DwarfTime time) { NamedImageFrame frame = new NamedImageFrame("newgui/pointers", 32, 6, 0); // Draw a bounding box around the currently selected bodies. foreach (Body body in Player.BodySelector.CurrentBodies) { if (body.Tags.Contains("Resource")) { Drawer2D.DrawText(body.Name, body.Position, Color.White, Color.Black); BoundingBox bounds = body.BoundingBox; bounds.Min += Vector3.Up * 0.5f; bounds.Max += Vector3.Up * 0.5f; bounds = bounds.Expand(0.25f); Drawer3D.DrawBox(bounds, Color.Orange, 0.02f, false); Drawer2D.DrawSprite(frame, bounds.Center(), Vector2.One, Vector2.Zero, new Color(255, 255, 255, 100)); } } }
public override void CreateCosmeticChildren(ComponentManager Manager) { base.CreateCosmeticChildren(Manager); if (SharedPrimitive == null) { var spriteSheet = new NamedImageFrame("Entities\\Furniture\\bedtex"); SharedPrimitive = new OldBoxPrimitive(DwarfGame.GuiSkin.Device, 0.8f, 0.5f, 1.8f, new OldBoxPrimitive.BoxTextureCoords(spriteSheet.SafeGetImage().Width, spriteSheet.SafeGetImage().Height, new OldBoxPrimitive.FaceData(new Rectangle(0, 24, 24, 16), true), new OldBoxPrimitive.FaceData(new Rectangle(72, 24, 24, 16), true), new OldBoxPrimitive.FaceData(new Rectangle(24, 0, 48, 24), false), new OldBoxPrimitive.FaceData(new Rectangle(0, 0, 1, 1), true), new OldBoxPrimitive.FaceData(new Rectangle(24, 24, 48, 16), true), new OldBoxPrimitive.FaceData(new Rectangle(24, 40, 48, 16), true))); } AddChild(new PrimitiveComponent(Manager, Matrix.CreateTranslation(-0.40f, 0.00f, -0.45f) * Matrix.CreateRotationY((float)Math.PI * 0.5f), new Vector3(1.0f, 1.0f, 2.0f), new Vector3(0.0f, 0.0f, 0.0f), SharedPrimitive, "Entities\\Furniture\\bedtex")) .SetFlag(Flag.ShouldSerialize, false) .SetFlag(Flag.RotateBoundingBox, true); AddChild(new GenericVoxelListener(Manager, Matrix.Identity, new Vector3(1.5f, 0.5f, 0.75f), // Position just below surface. new Vector3(0.5f, -0.30f, 0.0f), (v) => { if (v.Type == VoxelChangeEventType.VoxelTypeChanged && v.NewVoxelType == 0) { Die(); } })) .SetFlag(Flag.ShouldSerialize, false) .SetFlag(Flag.RotateBoundingBox, true); }
public void Initialize(PlayState state, string name, string motto, NamedImageFrame logo, Color color) { Races = new Dictionary<string, Race>(); /* Races["Dwarf"] = new Race() { Name = "Dwarf", CreatureTypes = new List<string> {"Dwarf", "AxeDwarf"}, IsIntelligent = true, IsNative = false, FactionNameFile = ContentPaths.Text.Templates.nations_dwarf, NameFile = ContentPaths.Text.Templates.names_dwarf, FactionNameTemplates = TextGenerator.GetAtoms(ContentPaths.Text.Templates.nations_dwarf) }; Races["Goblins"] = new Race() { Name = "Goblins", CreatureTypes = new List<string> { "Goblin"}, IsIntelligent = true, IsNative = true, FactionNameFile = ContentPaths.Text.Templates.nations_dwarf, NameFile = ContentPaths.Text.Templates.names_goblin, FactionNameTemplates = TextGenerator.GetAtoms(ContentPaths.Text.Templates.nations_goblin) }; Races["Molemen"] = new Race() { Name = "Molemen", CreatureTypes = new List<string> { "Moleman" }, IsIntelligent = true, IsNative = true, FactionNameFile = ContentPaths.Text.Templates.nations_dwarf, NameFile = ContentPaths.Text.Templates.names_dwarf, FactionNameTemplates = TextGenerator.GetAtoms(ContentPaths.Text.Templates.nations_goblin) }; Races["Elf"] = new Race() { Name = "Elf", CreatureTypes = new List<string> { "Elf" }, IsIntelligent = true, IsNative = true, FactionNameFile = ContentPaths.Text.Templates.nations_elf, NameFile = ContentPaths.Text.Templates.names_elf, FactionNameTemplates = TextGenerator.GetAtoms(ContentPaths.Text.Templates.nations_elf) }; Races["Undead"] = new Race() { Name = "Undead", CreatureTypes = new List<string> { "Necromancer", "Skeleton" }, IsIntelligent = true, IsNative = true, FactionNameFile = ContentPaths.Text.Templates.nations_undead, NameFile = ContentPaths.Text.Templates.names_undead, FactionNameTemplates = TextGenerator.GetAtoms(ContentPaths.Text.Templates.nations_undead) }; Races["Herbivore"] = new Race() { Name = "Herbivore", CreatureTypes = new List<string> { "Bird", "Deer" }, IsIntelligent = false, IsNative = true, FactionNameFile = ContentPaths.Text.Templates.nations_dwarf, NameFile = ContentPaths.Text.Templates.names_dwarf, }; */ Races = ContentPaths.LoadFromJson<Dictionary<string, Race>>(ContentPaths.World.races); Factions = new Dictionary<string, Faction>(); Factions["Player"] = new Faction { Name = "Player", Race = Races["Dwarf"] }; Factions["Player"].Economy = new Economy(Factions["Player"], 300.0f, state, name, motto, logo, color); Factions["Goblins"] = new Faction { Name = "Goblins", Race = Races["Goblins"] }; Factions["Elf"] = new Faction { Name = "Elf", Race = Races["Elf"] }; Factions["Undead"] = new Faction { Name = "Undead", Race = Races["Undead"] }; Factions["Herbivore"] = new Faction { Name = "Herbivore", Race = Races["Herbivore"] }; Factions["Molemen"] = new Faction { Name = "Molemen", Race = Races["Molemen"] }; }
private void img_OnClicked(NamedImageFrame image) { OnTextureSelected.Invoke(image); Close(ReturnStatus.Ok); }
private void TextureLoadDialog_OnTextureSelected(NamedImageFrame arg) { //throw new NotImplementedException(); }
public ComponentManager(PlayState state, string companyName, string companyMotto, NamedImageFrame companyLogo, Color companyColor, List <Faction> natives) { Components = new Dictionary <uint, GameComponent>(); Removals = new List <GameComponent>(); Additions = new List <GameComponent>(); Camera = null; AdditionMutex = new Mutex(); RemovalMutex = new Mutex(); Factions = new FactionLibrary(); if (natives != null && natives.Count > 0) { Factions.AddFactions(natives); } Factions.Initialize(state, companyName, companyMotto, companyLogo, companyColor); }
public static void DrawIndicator(NamedImageFrame image, Vector3 position, float time, float scale, Vector2 offset) { DrawIndicator(image, position, time, scale, offset, Color.White); }
public static Company GenerateRandom(float assets, float stockPrice, Sector industry) { Texture2D texture = TextureManager.GetTexture(ContentPaths.Logos.logos); int row = 0; switch (industry) { case Sector.Magic: row = 3; break; case Sector.Finance: row = 3; break; case Sector.Exploration: row = 0; break; case Sector.Manufacturing: row = 1; break; case Sector.Military: row = 2; break; } NamedImageFrame image = new NamedImageFrame(ContentPaths.Logos.logos, 32, PlayState.Random.Next(0, texture.Width / 32), row); Color c = new Color(PlayState.Random.Next(0, 255), PlayState.Random.Next(0, 255), PlayState.Random.Next(0, 255)); return new Company() { Assets = assets, StockPrice = stockPrice, Industry = industry, Logo = image, Name = GenerateName(industry), Motto = GenerateMotto(), BaseColor = c, SecondaryColor = c, StockHistory = GenerateRandomStockHistory(stockPrice, 10), LastAssets = assets }; }
public void Initialize(PlayState state, string name, string motto, NamedImageFrame logo, Color color) { if (Races == null) { InitializeRaces(); } if (Factions == null) { Factions = new Dictionary <string, Faction>(); Factions["Player"] = new Faction { Name = "Player", Race = Races["Dwarf"] }; Factions["Motherland"] = new Faction() { Name = "Motherland", Race = Races["Dwarf"], IsRaceFaction = false, TradeMoney = 10000 }; } Factions["Goblins"] = new Faction { Name = "Goblins", Race = Races["Goblins"], IsRaceFaction = true }; Factions["Elf"] = new Faction { Name = "Elf", Race = Races["Elf"], IsRaceFaction = true }; Factions["Undead"] = new Faction { Name = "Undead", Race = Races["Undead"], IsRaceFaction = true }; Factions["Demon"] = new Faction { Name = "Demon", Race = Races["Demon"], IsRaceFaction = true }; Factions["Herbivore"] = new Faction { Name = "Herbivore", Race = Races["Herbivore"], IsRaceFaction = true }; Factions["Carnivore"] = new Faction { Name = "Carnivore", Race = Races["Carnivore"], IsRaceFaction = true }; Factions["Molemen"] = new Faction { Name = "Molemen", Race = Races["Molemen"], IsRaceFaction = true }; Factions["Player"].Economy = new Economy(Factions["Player"], 300.0f, state, name, motto, logo, color); }
public Economy(Faction faction, float currentMoney, PlayState state, string companyName, string companyMotto, NamedImageFrame companyLogo, Color companyColor) { PlayState = state; Company = Company.GenerateRandom(currentMoney, 1.0f, Company.Sector.Exploration); Company.Name = companyName; Company.SecondaryColor = Color.White; Company.Logo = companyLogo; Company.Motto = companyMotto; Company.Assets = currentMoney; Company.BaseColor = companyColor; CurrentMoney = currentMoney; Faction = faction; Market = new List <Company> { Company, Company.GenerateRandom(1000, 1.0f, Company.Sector.Exploration), Company.GenerateRandom(1200, 5.0f, Company.Sector.Exploration), Company.GenerateRandom(1500, 10.0f, Company.Sector.Exploration), Company.GenerateRandom(1300, 10.0f, Company.Sector.Manufacturing), Company.GenerateRandom(1200, 10.0f, Company.Sector.Manufacturing), Company.GenerateRandom(1500, 15.0f, Company.Sector.Military), Company.GenerateRandom(1300, 10.0f, Company.Sector.Military), Company.GenerateRandom(1200, 15.0f, Company.Sector.Military), Company.GenerateRandom(1500, 25.0f, Company.Sector.Magic), Company.GenerateRandom(1200, 30.0f, Company.Sector.Magic), Company.GenerateRandom(1300, 40.0f, Company.Sector.Magic), Company.GenerateRandom(1500, 50.0f, Company.Sector.Finance), Company.GenerateRandom(1800, 60.0f, Company.Sector.Finance) }; PlayState.Time.NewDay += Time_NewDay; }
public void Initialize(PlayState state, string name, string motto, NamedImageFrame logo, Color color) { Races = new Dictionary <string, Race>(); /* * Races["Dwarf"] = new Race() * { * Name = "Dwarf", * CreatureTypes = new List<string> {"Dwarf", "AxeDwarf"}, * IsIntelligent = true, * IsNative = false, * FactionNameFile = ContentPaths.Text.Templates.nations_dwarf, * NameFile = ContentPaths.Text.Templates.names_dwarf, * FactionNameTemplates = TextGenerator.GetAtoms(ContentPaths.Text.Templates.nations_dwarf) * }; * * Races["Goblins"] = new Race() * { * Name = "Goblins", * CreatureTypes = new List<string> { "Goblin"}, * IsIntelligent = true, * IsNative = true, * FactionNameFile = ContentPaths.Text.Templates.nations_dwarf, * NameFile = ContentPaths.Text.Templates.names_goblin, * FactionNameTemplates = TextGenerator.GetAtoms(ContentPaths.Text.Templates.nations_goblin) * }; * * Races["Molemen"] = new Race() * { * Name = "Molemen", * CreatureTypes = new List<string> { "Moleman" }, * IsIntelligent = true, * IsNative = true, * FactionNameFile = ContentPaths.Text.Templates.nations_dwarf, * NameFile = ContentPaths.Text.Templates.names_dwarf, * FactionNameTemplates = TextGenerator.GetAtoms(ContentPaths.Text.Templates.nations_goblin) * }; * * Races["Elf"] = new Race() * { * Name = "Elf", * CreatureTypes = new List<string> { "Elf" }, * IsIntelligent = true, * IsNative = true, * FactionNameFile = ContentPaths.Text.Templates.nations_elf, * NameFile = ContentPaths.Text.Templates.names_elf, * FactionNameTemplates = TextGenerator.GetAtoms(ContentPaths.Text.Templates.nations_elf) * }; * * Races["Undead"] = new Race() * { * Name = "Undead", * CreatureTypes = new List<string> { "Necromancer", "Skeleton" }, * IsIntelligent = true, * IsNative = true, * FactionNameFile = ContentPaths.Text.Templates.nations_undead, * NameFile = ContentPaths.Text.Templates.names_undead, * FactionNameTemplates = TextGenerator.GetAtoms(ContentPaths.Text.Templates.nations_undead) * }; * * * Races["Herbivore"] = new Race() * { * Name = "Herbivore", * CreatureTypes = new List<string> { "Bird", "Deer" }, * IsIntelligent = false, * IsNative = true, * FactionNameFile = ContentPaths.Text.Templates.nations_dwarf, * NameFile = ContentPaths.Text.Templates.names_dwarf, * }; */ Races = ContentPaths.LoadFromJson <Dictionary <string, Race> >(ContentPaths.World.races); Factions = new Dictionary <string, Faction>(); Factions["Player"] = new Faction { Name = "Player", Race = Races["Dwarf"] }; Factions["Player"].Economy = new Economy(Factions["Player"], 300.0f, state, name, motto, logo, color); Factions["Goblins"] = new Faction { Name = "Goblins", Race = Races["Goblins"] }; Factions["Elf"] = new Faction { Name = "Elf", Race = Races["Elf"] }; Factions["Undead"] = new Faction { Name = "Undead", Race = Races["Undead"] }; Factions["Herbivore"] = new Faction { Name = "Herbivore", Race = Races["Herbivore"] }; Factions["Molemen"] = new Faction { Name = "Molemen", Race = Races["Molemen"] }; }
public void Initialize(PlayState state, string name, string motto, NamedImageFrame logo, Color color) { if (Races == null) { InitializeRaces(); } if (Factions == null) { Factions = new Dictionary<string, Faction>(); Factions["Player"] = new Faction { Name = "Player", Race = Races["Dwarf"] }; } Factions["Goblins"] = new Faction { Name = "Goblins", Race = Races["Goblins"], IsRaceFaction = true }; Factions["Elf"] = new Faction { Name = "Elf", Race = Races["Elf"], IsRaceFaction = true }; Factions["Undead"] = new Faction { Name = "Undead", Race = Races["Undead"], IsRaceFaction = true }; Factions["Herbivore"] = new Faction { Name = "Herbivore", Race = Races["Herbivore"], IsRaceFaction = true }; Factions["Molemen"] = new Faction { Name = "Molemen", Race = Races["Molemen"], IsRaceFaction = true }; Factions["Player"].Economy = new Economy(Factions["Player"], 300.0f, state, name, motto, logo, color); }
public ComponentManager(PlayState state, string companyName, string companyMotto, NamedImageFrame companyLogo, Color companyColor, List <Faction> natives) { Components = new Dictionary <uint, GameComponent>(); Removals = new List <GameComponent>(); Additions = new List <GameComponent>(); Camera = null; AdditionMutex = new Mutex(); RemovalMutex = new Mutex(); Factions = new FactionLibrary(); if (natives != null && natives.Count > 0) { Factions.AddFactions(natives); } Factions.Initialize(state, companyName, companyMotto, companyLogo, companyColor); Point playerOrigin = new Point((int)(PlayState.WorldOrigin.X), (int)(PlayState.WorldOrigin.Y)); Factions.Factions["Player"].Center = playerOrigin; Factions.Factions["Motherland"].Center = new Point(playerOrigin.X + 50, playerOrigin.Y + 50); }
public Resource(ResourceLibrary.ResourceType type, float money, string description, NamedImageFrame image, params ResourceTags[] tags) { Type = type; MoneyValue = money; Description = description; Image = image; Tags = new List <ResourceTags>(); Tags.AddRange(tags); FoodContent = 0; }