Exemplo n.º 1
0
        public static Body GenerateTestMoleman(Vector3 position)
        {
            CreatureDef dwarfDef = ContentPaths.LoadFromJson <CreatureDef>(ContentPaths.Entities.Moleman.moleman);
            Creature    toReturn = new Creature(position, dwarfDef, "Moleman Miner", 0, "Molemen");

            toReturn.AI.AddThought(Thought.CreateStandardThought(Thought.ThoughtType.JustArrived, PlayState.Time.CurrentDate), false);
            return(toReturn.Physics);
        }
Exemplo n.º 2
0
 public static Race FindRace(String Name)
 {
     if (Races == null)
     {
         Races = ContentPaths.LoadFromJson <Dictionary <string, Race> >(ContentPaths.World.races);
     }
     return(Races[Name]);
 }
Exemplo n.º 3
0
        public static Body GenerateTestSeketon(WorldManager world, Vector3 position)
        {
            CreatureDef dwarfDef = ContentPaths.LoadFromJson <CreatureDef>(ContentPaths.Entities.Skeleton.skeleton);
            Creature    toReturn = new Creature(world.ComponentManager, position, dwarfDef, "Skeleton", 0, "Undead");

            toReturn.AI.AddThought(Thought.CreateStandardThought(Thought.ThoughtType.JustArrived, world.Time.CurrentDate), false);
            return(toReturn.Physics);
        }
Exemplo n.º 4
0
        public static void InitializeStatics()
        {
            Biomes = ContentPaths.LoadFromJson <List <BiomeData> >(ContentPaths.World.biomes);
            byte id = 0;

            foreach (var biome in Biomes)
            {
                biome.Biome = id;
                id++;
            }
        }
Exemplo n.º 5
0
        public override void OnEnter()
        {
            // Todo - HACK - Remove when input transition is complete.
            DwarfGame.GumInputMapper.GetInputQueue();

            CurrentScroll = 0;
            CreditsFont   = GameState.Game.Content.Load <SpriteFont>(ContentPaths.Fonts.Default);
            Entries       = ContentPaths.LoadFromJson <List <CreditEntry> >("credits.json");
            IsInitialized = true;
            IsDone        = false;
            base.OnEnter();
        }
Exemplo n.º 6
0
        public static void AddClasses(string file)
        {
            if (!staticClassInitialized)
            {
                InitializeClassStatics();
            }
            List <EmployeeClassDef> defs = ContentPaths.LoadFromJson <List <EmployeeClassDef> >(file);

            foreach (EmployeeClassDef empClass in defs)
            {
                Classes[empClass.Name] = new EmployeeClass(empClass);
            }
        }
Exemplo n.º 7
0
 public static void Initialize()
 {
     EmbarkmentLibrary = ContentPaths.LoadFromJson <Dictionary <string, Embarkment> >(ContentPaths.World.embarks);
     DefaultEmbarkment = EmbarkmentLibrary["Normal"];
 }
Exemplo n.º 8
0
 public void InitializeRaces()
 {
     Races = new Dictionary <string, Race>();
     Races = ContentPaths.LoadFromJson <Dictionary <string, Race> >(ContentPaths.World.races);
 }
Exemplo n.º 9
0
        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"]
            };
        }
Exemplo n.º 10
0
 public ParticleManager(GraphicsDevice Device, ComponentManager Components)
 {
     Effects = new Dictionary <string, ParticleEffect>();
     Load(Device, Components, ContentPaths.LoadFromJson <Dictionary <string, List <EmitterData> > >(ContentPaths.Particles.particles));
 }
Exemplo n.º 11
0
 public static void InitializeStatics()
 {
     Biomes = ContentPaths.LoadFromJson <Dictionary <Overworld.Biome, BiomeData> >(ContentPaths.World.biomes);
 }
Exemplo n.º 12
0
        public static List <Animation> LoadCompositeAnimationSet(String Path, String CompositeName)
        {
            if (!Animations.ContainsKey(Path))
            {
                try
                {
                    var descriptor = ContentPaths.LoadFromJson <AnimationSetDescriptor>(Path);
                    Animations.Add(Path, GenerateAnimations(CompositeName, descriptor).Select(a =>
                    {
                        bool simplify = true;
                        string asset  = null;
                        foreach (var frame in a.CompositeFrames)
                        {
                            if (frame.Cells.Count != 1)
                            {
                                simplify = false;
                                break;
                            }

                            if (asset == null)
                            {
                                asset = frame.Cells[0].Sheet.AssetName;
                            }
                            else if (asset != frame.Cells[0].Sheet.AssetName)
                            {
                                simplify = false;
                                break;
                            }
                        }

                        if (simplify)
                        {
                            var sheet = a.CompositeFrames[0].Cells[0].Sheet;
                            return(new Animation()
                            {
                                SpriteSheet = sheet,
                                Name = a.Name,
                                Speeds = a.Speeds,
                                Loops = a.Loops,
                                FrameHZ = a.FrameHZ,
                                SpeedMultiplier = a.SpeedMultiplier,
                                //Todo: Support per-cell tint in standard animation?
                                Tint = a.CompositeFrames[0].Cells[0].Tint,
                                Flipped = a.Flipped,
                                Frames = a.CompositeFrames.Select(f => f.Cells[0].Tile).ToList(),
                            });
                        }

                        return(a as Animation);
                    }).ToList());
                }
                catch (Exception)
                {
                    var errorAnimations = new List <Animation>();

                    errorAnimations.Add(
                        new Animation()
                    {
                        SpriteSheet = new SpriteSheet(ContentPaths.Error, 32),
                        Frames      = new List <Point> {
                            Point.Zero
                        },
                        Name = "ERROR"
                    });


                    Animations.Add(Path, errorAnimations);
                }
            }

            return(Animations[Path]);
        }