private static GameComponent __factory6(ComponentManager Manager, Vector3 Position, Blackboard Data) { return(new Table("Metal Table", Manager, Position, Data.GetData <List <ResourceAmount> >("Resources", null), new Point(4, 7), new Point(5, 7))); }
public static List <Body> GenerateRoomComponentsTemplate( RoomData roomData, List <VoxelHandle> voxels, ComponentManager componentManager, Microsoft.Xna.Framework.Content.ContentManager content, GraphicsDevice graphics) { List <Body> components = new List <Body>(); RoomTile[,] currentTiles = RoomTemplate.CreateFromRoom( voxels, componentManager.World.ChunkManager); float[,] rotations = new float[currentTiles.GetLength(0), currentTiles.GetLength(1)]; foreach (RoomTemplate myTemp in roomData.Templates) { RoomTemplate template = new RoomTemplate(myTemp) { Rotation = 0 }; for (int r = -2; r < currentTiles.GetLength(0) + 1; r++) { for (int c = -2; c < currentTiles.GetLength(1) + 1; c++) { for (int rotation = 0; rotation < 5; rotation++) { template.PlaceTemplate(ref currentTiles, ref rotations, r, c); template.RotateClockwise(1); } } } } var box = VoxelHelpers.GetVoxelBoundingBox(voxels); int thingsMade = 0; for (int r = 0; r < currentTiles.GetLength(0); r++) { for (int c = 0; c < currentTiles.GetLength(1); c++) { RoomTile tile = currentTiles[r, c]; Body createdComponent = null; Vector3 noise = VertexNoise.GetNoiseVectorFromRepeatingTexture(box.Min + new Vector3(r + 0.5f - 1, 1.5f, c + 0.5f - 1)); switch (tile) { case RoomTile.Barrel: createdComponent = EntityFactory.CreateEntity <Body>("Barrel", box.Min + new Vector3(r + 0.5f - 1, 1.5f, c + 0.5f - 1) + noise); thingsMade++; break; case RoomTile.Wheat: createdComponent = EntityFactory.CreateEntity <Body>("Wheat", box.Min + new Vector3(r + 0.5f - 1, 1.5f, c + 0.5f - 1) + noise); thingsMade++; break; case RoomTile.Mushroom: createdComponent = EntityFactory.CreateEntity <Body>("Mushroom", box.Min + new Vector3(r + 0.5f - 1, 1.5f, c + 0.5f - 1) + noise); thingsMade++; break; case RoomTile.Table: createdComponent = EntityFactory.CreateEntity <Body>("Table", box.Min + new Vector3(r + 0.5f - 1, 1.5f, c + 0.5f - 1) + noise); thingsMade++; break; case RoomTile.Stove: createdComponent = EntityFactory.CreateEntity <Body>("Stove", box.Min + new Vector3(r + 0.5f - 1, 1.5f, c + 0.5f - 1) + noise); thingsMade++; break; case RoomTile.KitchenTable: createdComponent = EntityFactory.CreateEntity <Body>("Kitchen Table", box.Min + new Vector3(r + 0.5f - 1, 1.5f, c + 0.5f - 1) + noise); thingsMade++; break; case RoomTile.Lamp: createdComponent = EntityFactory.CreateEntity <Body>("Lamp", box.Min + new Vector3(r + 0.5f - 1, 1.5f, c + 0.5f - 1) + noise); thingsMade++; break; case RoomTile.Flag: createdComponent = EntityFactory.CreateEntity <Body>("Flag", box.Min + new Vector3(r + 0.5f - 1, 1.5f, c + 0.5f - 1) + noise); thingsMade++; break; case RoomTile.Chair: createdComponent = EntityFactory.CreateEntity <Body>("Chair", box.Min + new Vector3(r + 0.5f - 1, 1.5f, c + 0.5f - 1) + noise); thingsMade++; break; case RoomTile.Books: createdComponent = EntityFactory.CreateEntity <Body>(MathFunctions.RandEvent(0.5f) ? "Books" : "Potions", box.Min + new Vector3(r + 0.5f - 1, 1.5f, c + 0.5f - 1) + noise); thingsMade++; break; case RoomTile.Anvil: createdComponent = EntityFactory.CreateEntity <Body>("Anvil", box.Min + new Vector3(r + 0.5f - 1, 1.5f, c + 0.5f - 1) + noise); thingsMade++; break; case RoomTile.Forge: createdComponent = EntityFactory.CreateEntity <Body>("Forge", box.Min + new Vector3(r + 0.5f - 1, 1.5f, c + 0.5f - 1) + noise); thingsMade++; break; case RoomTile.Target: createdComponent = EntityFactory.CreateEntity <Body>("Target", box.Min + new Vector3(r + 0.5f - 1, 1.5f, c + 0.5f - 1) + noise); thingsMade++; break; case RoomTile.Strawman: createdComponent = EntityFactory.CreateEntity <Body>("Strawman", box.Min + new Vector3(r + 0.5f - 1, 1.5f, c + 0.5f - 1) + noise); thingsMade++; break; case RoomTile.BookShelf: createdComponent = EntityFactory.CreateEntity <Body>("Bookshelf", box.Min + new Vector3(r - 1 + 0.5f, 1.5f, c - 1 + 0.5f) + noise); thingsMade++; break; case RoomTile.Pillow: for (int dx = -1; dx < 2; dx++) { for (int dy = -1; dy < 2; dy++) { if (Math.Abs(dx) + Math.Abs(dy) != 1 || r + dx < 0 || r + dx >= currentTiles.GetLength(0) || c + dy < 0 || c + dy >= currentTiles.GetLength(1)) { continue; } if (currentTiles[r + dx, c + dy] != RoomTile.Bed) { continue; } createdComponent = EntityFactory.CreateEntity <Body>("Bed", box.Min + new Vector3(r - 1 + 0.5f, 1.5f, c - 1 + 0.5f) + noise); break; } } thingsMade++; break; default: break; } if (createdComponent == null) { continue; } createdComponent.Tags.Add("Moveable"); createdComponent.LocalTransform = Matrix.CreateRotationY(-(rotations[r, c] + (float)Math.PI * 0.5f)) * createdComponent.LocalTransform; components.Add(createdComponent); } } return(components); }
private static GameComponent __factory00(ComponentManager Manager, Vector3 Position, Blackboard Data) { return(new HealingTower(Manager, Position, Data)); }
public GameComponent(string name, ComponentManager manager) : this(manager) { Name = name; }
public override void CreateCosmeticChildren(ComponentManager manager) { CreateDwarfSprite(Stats.CurrentClass, manager); Physics.AddChild(Shadow.Create(0.75f, manager)); Physics.AddChild(new VoxelRevealer(manager, Physics, 5)).SetFlag(Flag.ShouldSerialize, false); Physics.AddChild(new MinimapIcon(Manager, new NamedImageFrame(ContentPaths.GUI.map_icons, 16, 0, 0))).SetFlag(Flag.ShouldSerialize, false); NoiseMaker = new NoiseMaker(); NoiseMaker.Noises["Hurt"] = new List <string> { ContentPaths.Audio.Oscar.sfx_ic_dwarf_hurt_1, ContentPaths.Audio.Oscar.sfx_ic_dwarf_hurt_2, }; NoiseMaker.Noises["Ok"] = new List <string>() { ContentPaths.Audio.Oscar.sfx_ic_dwarf_ok_1, ContentPaths.Audio.Oscar.sfx_ic_dwarf_ok_2, ContentPaths.Audio.Oscar.sfx_ic_dwarf_ok_3 }; NoiseMaker.Noises["Die"] = new List <string>() { ContentPaths.Audio.Oscar.sfx_ic_dwarf_death }; NoiseMaker.Noises["Pleased"] = new List <string>() { ContentPaths.Audio.Oscar.sfx_ic_dwarf_pleased }; NoiseMaker.Noises["Tantrum"] = new List <string>() { ContentPaths.Audio.Oscar.sfx_ic_dwarf_tantrum_1, ContentPaths.Audio.Oscar.sfx_ic_dwarf_tantrum_2, ContentPaths.Audio.Oscar.sfx_ic_dwarf_tantrum_3, }; NoiseMaker.Noises["Jump"] = new List <string>() { ContentPaths.Audio.Oscar.sfx_ic_dwarf_jump }; NoiseMaker.Noises["Climb"] = new List <string>() { ContentPaths.Audio.Oscar.sfx_ic_dwarf_climb_1, ContentPaths.Audio.Oscar.sfx_ic_dwarf_climb_2, ContentPaths.Audio.Oscar.sfx_ic_dwarf_climb_3 }; Physics.AddChild(new ParticleTrigger("blood_particle", Manager, "Death Gibs", Matrix.Identity, Vector3.One, Vector3.Zero) { TriggerOnDeath = true, TriggerAmount = 1, BoxTriggerTimes = 10, SoundToPlay = ContentPaths.Entities.Dwarf.Audio.dwarfhurt1, }).SetFlag(Flag.ShouldSerialize, false); if (Equipment.HasValue(out var equipment) && GetRoot().GetComponent <DwarfSprites.LayeredCharacterSprite>().HasValue(out var sprite)) { equipment.AddLayersToSprite(sprite); } base.CreateCosmeticChildren(manager); }
private void Initialize(ComponentManager manager) { Tags.Add("Chair"); CollisionType = CollisionType.Static; }
public override void CreateCosmeticChildren(ComponentManager manager) { CreateSprite(ContentPaths.Entities.Animals.fowl[Species], manager); Physics.AddChild(Shadow.Create(0.5f, manager)); base.CreateCosmeticChildren(manager); }
public BatAI(ComponentManager Manager, string name, EnemySensor sensor) : base(Manager, name, sensor) { }
private static GameComponent __factory00(ComponentManager Manager, Vector3 Position, Blackboard Data) { return new SummoningCircle(Manager, Position, Data); }
public Goblin(CreatureStats stats, string allies, PlanService planService, Faction faction, ComponentManager manager, string name, Vector3 position) : base(manager, stats, allies, planService, faction, name) { Physics = new Physics(manager, "goblin", Matrix.CreateTranslation(position), new Vector3(0.5f, 0.5f, 0.5f), new Vector3(0.0f, -0.25f, 0.0f), 1.0f, 1.0f, 0.999f, 0.999f, new Vector3(0, -10, 0)); Physics.AddChild(this); Initialize(); }
private void LoadThreaded() { // Ensure we're using the invariant culture. Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture; Thread.CurrentThread.CurrentUICulture = CultureInfo.InvariantCulture; LoadStatus = LoadingStatus.Loading; SetLoadingMessage("Initializing ..."); while (GraphicsDevice == null) { Thread.Sleep(100); } Thread.Sleep(1000); #if CREATE_CRASH_LOGS try #endif #if !DEBUG try { #endif bool fileExists = !string.IsNullOrEmpty(ExistingFile); SetLoadingMessage("Creating Sky..."); Sky = new SkyRenderer( AssetManager.GetContentTexture(ContentPaths.Sky.moon), AssetManager.GetContentTexture(ContentPaths.Sky.sun), Content.Load <TextureCube>(AssetManager.ResolveContentPath(ContentPaths.Sky.day_sky)), Content.Load <TextureCube>(AssetManager.ResolveContentPath(ContentPaths.Sky.night_sky)), AssetManager.GetContentTexture(ContentPaths.Gradients.skygradient), Content.Load <Model>(AssetManager.ResolveContentPath(ContentPaths.Models.sphereLowPoly)), Content.Load <Effect>(ContentPaths.Shaders.SkySphere), Content.Load <Effect>(ContentPaths.Shaders.Background)); #region Reading game file if (fileExists) { SetLoadingMessage("Loading " + ExistingFile); gameFile = SaveGame.CreateFromDirectory(ExistingFile); if (gameFile == null) { throw new InvalidOperationException("Game File does not exist."); } // Todo: REMOVE THIS WHEN THE NEW SAVE SYSTEM IS COMPLETE. if (gameFile.Metadata.Version != Program.Version && !Program.CompatibleVersions.Contains(gameFile.Metadata.Version)) { throw new InvalidOperationException(String.Format("Game file is from version {0}. Compatible versions are {1}.", gameFile.Metadata.Version, TextGenerator.GetListString(Program.CompatibleVersions))); } Sky.TimeOfDay = gameFile.Metadata.TimeOfDay; Time = gameFile.Metadata.Time; WorldOrigin = gameFile.Metadata.WorldOrigin; WorldScale = gameFile.Metadata.WorldScale; WorldSize = gameFile.Metadata.NumChunks; GameID = gameFile.Metadata.GameID; if (gameFile.Metadata.OverworldFile != null && gameFile.Metadata.OverworldFile != "flat") { SetLoadingMessage("Loading world " + gameFile.Metadata.OverworldFile); Overworld.Name = gameFile.Metadata.OverworldFile; DirectoryInfo worldDirectory = Directory.CreateDirectory(DwarfGame.GetWorldDirectory() + Path.DirectorySeparatorChar + Overworld.Name); var overWorldFile = new NewOverworldFile(worldDirectory.FullName); Overworld.Map = overWorldFile.Data.Data; Overworld.Name = overWorldFile.Data.Name; } else { SetLoadingMessage("Generating flat world.."); Overworld.CreateUniformLand(GraphicsDevice); } } #endregion #region Initialize static data { Vector3 origin = new Vector3(0, 0, 0); Vector3 extents = new Vector3(1500, 1500, 1500); OctTree = new OctTreeNode(origin - extents, origin + extents); PrimitiveLibrary.Initialize(GraphicsDevice, Content); InstanceRenderer = new InstanceRenderer(GraphicsDevice, Content); Color[] white = new Color[1]; white[0] = Color.White; pixel = new Texture2D(GraphicsDevice, 1, 1); pixel.SetData(white); Tilesheet = AssetManager.GetContentTexture(ContentPaths.Terrain.terrain_tiles); AspectRatio = GraphicsDevice.Viewport.AspectRatio; DefaultShader = new Shader(Content.Load <Effect>(ContentPaths.Shaders.TexturedShaders), true); DefaultShader.ScreenWidth = GraphicsDevice.Viewport.Width; DefaultShader.ScreenHeight = GraphicsDevice.Viewport.Height; CraftLibrary.InitializeDefaultLibrary(); PotionLibrary.Initialize(); VoxelLibrary.InitializeDefaultLibrary(GraphicsDevice); GrassLibrary.InitializeDefaultLibrary(); DecalLibrary.InitializeDefaultLibrary(); bloom = new BloomComponent(Game) { Settings = BloomSettings.PresetSettings[5] }; bloom.Initialize(); fxaa = new FXAA(); fxaa.Initialize(); SoundManager.Content = Content; if (PlanService != null) { PlanService.Restart(); } JobLibrary.Initialize(); MonsterSpawner = new MonsterSpawner(this); EntityFactory.Initialize(this); } #endregion SetLoadingMessage("Creating Planner ..."); PlanService = new PlanService(); SetLoadingMessage("Creating Shadows..."); Shadows = new ShadowRenderer(GraphicsDevice, 1024, 1024); SetLoadingMessage("Creating Liquids ..."); #region liquids WaterRenderer = new WaterRenderer(GraphicsDevice); #endregion SetLoadingMessage("Generating Initial Terrain Chunks ..."); if (!fileExists) { GameID = MathFunctions.Random.Next(0, 1024); } ChunkGenerator = new ChunkGenerator(VoxelLibrary, Seed, 0.02f) { SeaLevel = SeaLevel }; #region Load Components if (fileExists) { ChunkManager = new ChunkManager(Content, this, ChunkGenerator, WorldSize.X, WorldSize.Y, WorldSize.Z); Splasher = new Splasher(ChunkManager); ChunkRenderer = new ChunkRenderer(ChunkManager.ChunkData); SetLoadingMessage("Loading Terrain..."); gameFile.ReadChunks(ExistingFile); ChunkManager.ChunkData.LoadFromFile(ChunkManager, gameFile, SetLoadingMessage); SetLoadingMessage("Loading Entities..."); gameFile.LoadPlayData(ExistingFile, this); Camera = gameFile.PlayData.Camera; DesignationDrawer = gameFile.PlayData.Designations; Vector3 origin = new Vector3(WorldOrigin.X, 0, WorldOrigin.Y); Vector3 extents = new Vector3(1500, 1500, 1500); if (gameFile.PlayData.Resources != null) { foreach (var resource in gameFile.PlayData.Resources) { if (!ResourceLibrary.Resources.ContainsKey(resource.Key)) { ResourceLibrary.Add(resource.Value); } } } ComponentManager = new ComponentManager(gameFile.PlayData.Components, this); foreach (var component in gameFile.PlayData.Components.SaveableComponents) { if (!ComponentManager.HasComponent(component.GlobalID) && ComponentManager.HasComponent(component.Parent.GlobalID)) { // Logically impossible. throw new InvalidOperationException("Component exists in save data but not in manager."); } } ConversationMemory = gameFile.PlayData.ConversationMemory; Factions = gameFile.PlayData.Factions; ComponentManager.World = this; Sky.TimeOfDay = gameFile.Metadata.TimeOfDay; Time = gameFile.Metadata.Time; WorldOrigin = gameFile.Metadata.WorldOrigin; WorldScale = gameFile.Metadata.WorldScale; // Restore native factions from deserialized data. Natives = new List <Faction>(); foreach (Faction faction in Factions.Factions.Values) { if (faction.Race.IsNative && faction.Race.IsIntelligent && !faction.IsRaceFaction) { Natives.Add(faction); } } Diplomacy = gameFile.PlayData.Diplomacy; GoalManager = new Goals.GoalManager(); GoalManager.Initialize(new List <Goals.Goal>());// gameFile.PlayData.Goals); TutorialManager = new Tutorial.TutorialManager(); TutorialManager.SetFromSaveData(gameFile.PlayData.TutorialSaveData); } else { Time = new WorldTime(); Camera = new OrbitCamera(this, new Vector3(VoxelConstants.ChunkSizeX, VoxelConstants.ChunkSizeY - 1.0f, VoxelConstants.ChunkSizeZ), new Vector3(VoxelConstants.ChunkSizeY, VoxelConstants.ChunkSizeY - 1.0f, VoxelConstants.ChunkSizeZ) + Vector3.Up * 10.0f + Vector3.Backward * 10, MathHelper.PiOver4, AspectRatio, 0.1f, GameSettings.Default.VertexCullDistance); ChunkManager = new ChunkManager(Content, this, ChunkGenerator, WorldSize.X, WorldSize.Y, WorldSize.Z); Splasher = new Splasher(ChunkManager); ChunkRenderer = new ChunkRenderer(ChunkManager.ChunkData); Camera.Position = new Vector3(0, 10, 0) + new Vector3(WorldSize.X * VoxelConstants.ChunkSizeX, 0, WorldSize.Z * VoxelConstants.ChunkSizeZ) * 0.5f; Camera.Target = new Vector3(0, 10, 1) + new Vector3(WorldSize.X * VoxelConstants.ChunkSizeX, 0, WorldSize.Z * VoxelConstants.ChunkSizeZ) * 0.5f; // If there's no file, we have to initialize the first chunk coordinate if (gameFile == null) { ChunkManager.GenerateInitialChunks(SpawnRect, new GlobalChunkCoordinate(0, 0, 0), SetLoadingMessage); } ComponentManager = new ComponentManager(this); ComponentManager.SetRootComponent(new Body(ComponentManager, "root", Matrix.Identity, Vector3.Zero, Vector3.Zero)); if (Natives == null) // Todo: Always true?? { FactionLibrary library = new FactionLibrary(); library.Initialize(this, CompanyMakerState.CompanyInformation); Natives = new List <Faction>(); for (int i = 0; i < 10; i++) { Natives.Add(library.GenerateFaction(this, i, 10)); } } #region Prepare Factions foreach (Faction faction in Natives) { faction.World = this; if (faction.RoomBuilder == null) { faction.RoomBuilder = new RoomBuilder(faction, this); } } Factions = new FactionLibrary(); if (Natives != null && Natives.Count > 0) { Factions.AddFactions(this, Natives); } Factions.Initialize(this, CompanyMakerState.CompanyInformation); Point playerOrigin = new Point((int)(WorldOrigin.X), (int)(WorldOrigin.Y)); Factions.Factions["Player"].Center = playerOrigin; Factions.Factions["The Motherland"].Center = new Point(playerOrigin.X + 50, playerOrigin.Y + 50); #endregion Diplomacy = new Diplomacy(this); Diplomacy.Initialize(Time.CurrentDate); // Initialize goal manager here. GoalManager = new Goals.GoalManager(); GoalManager.Initialize(new List <Goals.Goal>()); TutorialManager = new Tutorial.TutorialManager(); TutorialManager.TutorialEnabled = !GameSettings.Default.TutorialDisabledGlobally; Tutorial("new game start"); foreach (var item in CraftLibrary.EnumerateCraftables()) { if (!String.IsNullOrEmpty(item.Tutorial)) { TutorialManager.AddTutorial(item.Name, item.Tutorial, item.Icon); } } } Camera.World = this; //Drawer3D.Camera = Camera; #endregion SetLoadingMessage("Creating Particles ..."); ParticleManager = new ParticleManager(GraphicsDevice, ComponentManager); SetLoadingMessage("Creating GameMaster ..."); Master = new GameMaster(Factions.Factions["Player"], Game, ComponentManager, ChunkManager, Camera, GraphicsDevice); if (gameFile != null) { if (gameFile.PlayData.Tasks != null) { Master.NewArrivals = gameFile.PlayData.NewArrivals ?? new List <GameMaster.ApplicantArrival>(); Master.TaskManager = gameFile.PlayData.Tasks; Master.TaskManager.Faction = Master.Faction; } if (gameFile.PlayData.InitialEmbark != null) { InitialEmbark = gameFile.PlayData.InitialEmbark; } ChunkManager.World.Master.SetMaxViewingLevel(gameFile.Metadata.Slice > 0 ? gameFile.Metadata.Slice : ChunkManager.World.Master.MaxViewingLevel); } if (Master.Faction.Economy.Company.Information == null) { Master.Faction.Economy.Company.Information = new CompanyInformation(); } CreateInitialEmbarkment(); foreach (var chunk in ChunkManager.ChunkData.ChunkMap) { chunk.CalculateInitialSunlight(); } if (RevealSurface) { VoxelHelpers.InitialReveal(ChunkManager, ChunkManager.ChunkData, new VoxelHandle( ChunkManager.ChunkData.GetChunkEnumerator().FirstOrDefault(), new LocalVoxelCoordinate(0, VoxelConstants.ChunkSizeY - 1, 0))); } foreach (var chunk in ChunkManager.ChunkData.ChunkMap) { ChunkManager.InvalidateChunk(chunk); } ChunkManager.StartThreads(); SetLoadingMessage("Presimulating ..."); ShowingWorld = false; OnLoadedEvent(); Thread.Sleep(1000); ShowingWorld = true; SetLoadingMessage("Complete."); // GameFile is no longer needed. gameFile = null; LoadStatus = LoadingStatus.Success; #if !DEBUG } catch (Exception exception) { Game.CaptureException(exception); LoadingException = exception; LoadStatus = LoadingStatus.Failure; } #endif }
public override void CreateCosmeticChildren(ComponentManager manager) { CreateSprite(Stats.CurrentClass, manager); Physics.AddChild(Shadow.Create(0.75f, manager)); base.CreateCosmeticChildren(manager); }
public CharacterSprite(ComponentManager manager, string name, Matrix localTransform) : base(manager, name, localTransform) { currentMode = "Idle"; }
public static void GenerateRoomComponentsTemplate(Room room, ComponentManager componentManager, Microsoft.Xna.Framework.Content.ContentManager content, GraphicsDevice graphics) { RoomTile[,] currentTiles = RoomTemplate.CreateFromRoom(room, room.Chunks); float[,] rotations = new float[currentTiles.GetLength(0), currentTiles.GetLength(1)]; foreach (RoomTemplate template in room.RoomData.Templates) { for (int r = -2; r < currentTiles.GetLength(0) + 1; r++) { for (int c = -2; c < currentTiles.GetLength(1) + 1; c++) { for (int rotation = 0; rotation < 5; rotation++) { if (MathFunctions.RandEvent(template.Probability)) { template.PlaceTemplate(ref currentTiles, ref rotations, r, c); template.RotateClockwise(1); } } } } } BoundingBox box = room.GetBoundingBox(); int thingsMade = 0; for (int r = 0; r < currentTiles.GetLength(0); r++) { for (int c = 0; c < currentTiles.GetLength(1); c++) { RoomTile tile = currentTiles[r, c]; Body createdComponent = null; Vector3 noise = VertexNoise.GetNoiseVectorFromRepeatingTexture(box.Min + new Vector3(r + 0.5f - 1, 1.5f, c + 0.5f - 1)); switch (tile) { case RoomTile.Barrel: createdComponent = EntityFactory.CreateEntity <Body>("Barrel", box.Min + new Vector3(r + 0.5f - 1, 1.5f, c + 0.5f - 1) + noise); thingsMade++; break; case RoomTile.Wheat: createdComponent = EntityFactory.CreateEntity <Body>("Wheat", box.Min + new Vector3(r + 0.5f - 1, 1.5f, c + 0.5f - 1) + noise); thingsMade++; break; case RoomTile.Mushroom: createdComponent = EntityFactory.CreateEntity <Body>("Mushroom", box.Min + new Vector3(r + 0.5f - 1, 1.5f, c + 0.5f - 1) + noise); thingsMade++; break; case RoomTile.Table: createdComponent = EntityFactory.CreateEntity <Body>("Table", box.Min + new Vector3(r + 0.5f - 1, 1.5f, c + 0.5f - 1) + noise); thingsMade++; break; case RoomTile.Stove: createdComponent = EntityFactory.CreateEntity <Body>("Stove", box.Min + new Vector3(r + 0.5f - 1, 1.5f, c + 0.5f - 1) + noise); thingsMade++; break; case RoomTile.KitchenTable: createdComponent = EntityFactory.CreateEntity <Body>("KitchenTable", box.Min + new Vector3(r + 0.5f - 1, 1.5f, c + 0.5f - 1) + noise); thingsMade++; break; case RoomTile.Lamp: createdComponent = EntityFactory.CreateEntity <Body>("Lamp", box.Min + new Vector3(r + 0.5f - 1, 1.5f, c + 0.5f - 1) + noise); thingsMade++; break; case RoomTile.Flag: createdComponent = EntityFactory.CreateEntity <Body>("Flag", box.Min + new Vector3(r + 0.5f - 1, 1.5f, c + 0.5f - 1) + noise); thingsMade++; break; case RoomTile.Chair: createdComponent = EntityFactory.CreateEntity <Body>("Chair", box.Min + new Vector3(r + 0.5f - 1, 1.5f, c + 0.5f - 1) + noise); thingsMade++; break; case RoomTile.BookTable: createdComponent = EntityFactory.CreateEntity <Body>(MathFunctions.RandEvent(0.5f) ? "BookTable" : "PotionTable", box.Min + new Vector3(r + 0.5f - 1, 1.5f, c + 0.5f - 1) + noise); thingsMade++; break; case RoomTile.Anvil: createdComponent = EntityFactory.CreateEntity <Body>("Anvil", box.Min + new Vector3(r + 0.5f - 1, 1.5f, c + 0.5f - 1) + noise); thingsMade++; break; case RoomTile.Forge: createdComponent = EntityFactory.CreateEntity <Body>("Forge", box.Min + new Vector3(r + 0.5f - 1, 1.5f, c + 0.5f - 1) + noise); thingsMade++; break; case RoomTile.Target: createdComponent = EntityFactory.CreateEntity <Body>("Target", box.Min + new Vector3(r + 0.5f - 1, 1.5f, c + 0.5f - 1) + noise); thingsMade++; break; case RoomTile.Strawman: createdComponent = EntityFactory.CreateEntity <Body>("Strawman", box.Min + new Vector3(r + 0.5f - 1, 1.5f, c + 0.5f - 1) + noise); thingsMade++; break; case RoomTile.BookShelf: createdComponent = EntityFactory.CreateEntity <Body>("Bookshelf", box.Min + new Vector3(r - 1 + 0.5f, 1.5f, c - 1 + 0.5f) + noise); thingsMade++; break; case RoomTile.Pillow: for (int dx = -1; dx < 2; dx++) { for (int dy = -1; dy < 2; dy++) { if (Math.Abs(dx) + Math.Abs(dy) != 1 || r + dx < 0 || r + dx >= currentTiles.GetLength(0) || c + dy < 0 || c + dy >= currentTiles.GetLength(1)) { continue; } if (currentTiles[r + dx, c + dy] != RoomTile.Bed) { continue; } createdComponent = EntityFactory.CreateEntity <Body>("Bed", box.Min + new Vector3(r - 1 + 0.5f, 1.5f, c - 1 + 0.5f) + noise); break; } } thingsMade++; break; default: break; } if (createdComponent != null) { createdComponent.LocalTransform = Matrix.CreateRotationY(-(rotations[r, c] + (float)Math.PI * 0.5f)) * createdComponent.LocalTransform; Vector3 endPos = createdComponent.LocalTransform.Translation; Matrix offsetTransform = createdComponent.LocalTransform; offsetTransform.Translation += new Vector3(0, -1, 0); createdComponent.LocalTransform = offsetTransform; createdComponent.AnimationQueue.Add(new EaseMotion(0.8f, offsetTransform, endPos)); room.AddBody(createdComponent); PlayState.ParticleManager.Trigger("puff", endPos + new Vector3(0.5f, 0.5f, 0.5f), Color.White, 10); } } } }
private static GameComponent __factory1(ComponentManager Manager, Vector3 Position, Blackboard Data) { return(new Chair(Manager, Position, Data.GetData <List <ResourceAmount> >("Resources", null), "Wooden Chair", DefaultTopSprite, DefaultLegsSprite)); }
private static GameComponent __factory(ComponentManager Manager, Vector3 Position, Blackboard Data) { return(new Fairy(Manager, Position)); }
private static GameComponent __factory3(ComponentManager Manager, Vector3 Position, Blackboard Data) { return(new Chair(Manager, Position, Data.GetData <List <ResourceAmount> >("Resources", null), "Metal Chair", new Point(6, 7), new Point(7, 7))); }
public GremlinAI(ComponentManager Manager, String Name, EnemySensor Sensor) : base(Manager, Name, Sensor) { }
public LightEmitter(ComponentManager Manager, string name, Matrix localTransform, Vector3 boundingBoxExtents, Vector3 boundingBoxPos, float intensity, float range) : base(Manager, name, localTransform, boundingBoxExtents, boundingBoxPos) { Light = new DynamicLight(intensity, range); }
public PacingCreatureAI(ComponentManager Manager, string name, EnemySensor sensors, PlanService planService) : base(Manager, name, sensors, planService) { }
private static GameComponent __factory2(ComponentManager Manager, Vector3 Position, Blackboard Data) { return(new Chicken(Position, Manager, "Penguin", "Penguin")); }
private static GameComponent __factory(ComponentManager Manager, Vector3 Position, Blackboard Data) { return(new BearTrap(Manager, Position, Data.GetData <Resource>("Resources", null))); }
public void PostSerialization(ComponentManager Manager) { Children = SerializableChildren.Select(id => Manager.FindComponent(id)).ToList(); Children.RemoveAll(c => c == this || c == null); SerializableChildren = null; }
private static GameComponent __factory(ComponentManager Manager, Vector3 Position, Blackboard Data) { return(new IronDoor(Manager, Position, Manager.World.PlayerFaction, Data.GetData <Resource>("Resource", null), "Iron Door")); }
public DwarfThoughts(ComponentManager Manager, string name) : base(name, Manager) { }
public IronDoor(ComponentManager manager, Vector3 position, Faction team, Resource Resource, string craftType) : base(manager, position, team, new SpriteSheet(ContentPaths.Entities.Furniture.interior_furniture, 32, 32), new Point(1, 8), Resource, craftType, 75.0f) { Name = "Iron Door"; }
private static GameComponent __factory(ComponentManager Manager, Vector3 Position, Blackboard Data) { return(new TurretTrap(Manager, Position, Manager.World.PlayerFaction, Data.GetData <List <ResourceAmount> >("Resources", null))); }
private static GameComponent __factory(ComponentManager Manager, Vector3 Position, Blackboard Data) { return(new Balloon(Manager, Position, Position + new Vector3(0, 1000, 0), Manager.World.PlayerFaction)); }
public OrientedAnimation(ComponentManager manager, string name, GameComponent parent, Matrix localTransform) : base(manager, name, parent, localTransform, null, false) { }
private static GameComponent __factory4(ComponentManager Manager, Vector3 Position, Blackboard Data) { return(new Table("Wooden Table", Manager, Position, Data.GetData <List <ResourceAmount> >("Resources", null), DefaultTopFrame, DefaultLegsFrame)); }