public void HireImmediately(Applicant currentApplicant) { var rooms = EnumerateZones().Where(room => room.Type.Name == "Balloon Port").ToList(); Vector3 spawnLoc = Renderer.Camera.Position; if (rooms.Count > 0) { spawnLoc = rooms.First().GetBoundingBox().Center() + Vector3.UnitY * 15; } var dwarfPhysics = DwarfFactory.GenerateDwarf( spawnLoc, ComponentManager, currentApplicant.ClassName, currentApplicant.LevelIndex, currentApplicant.Gender, currentApplicant.RandomSeed); ComponentManager.RootComponent.AddChild(dwarfPhysics); var newMinion = dwarfPhysics.EnumerateAll().OfType <Dwarf>().FirstOrDefault(); Debug.Assert(newMinion != null); newMinion.Stats.AllowedTasks = currentApplicant.Class.Actions; newMinion.Stats.LevelIndex = currentApplicant.LevelIndex - 1; newMinion.Stats.LevelUp(newMinion); newMinion.Stats.FullName = currentApplicant.Name; newMinion.AI.AddMoney(currentApplicant.Level.Pay * 4m); newMinion.AI.Biography = currentApplicant.Biography; MakeAnnouncement( new Gui.Widgets.QueuedAnnouncement { Text = String.Format("{0} was hired as a {1}.", currentApplicant.Name, currentApplicant.Level.Name), ClickAction = (gui, sender) => newMinion.AI.ZoomToMe() }); SoundManager.PlaySound(ContentPaths.Audio.Oscar.sfx_gui_positive_generic, 0.15f); }
public NonPlayerDwarf(ComponentManager manager, CreatureStats stats, Faction faction, string name, Vector3 position) : base(manager, stats, faction, name) { Physics = new Physics(manager, "Dwarf", 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); Stats.Gender = Mating.RandomGender(); Stats.VoicePitch = DwarfFactory.GetRandomVoicePitch(Stats.Gender); Physics.Orientation = Physics.OrientMode.RotateY; CreateCosmeticChildren(Manager); Physics.AddChild(new EnemySensor(Manager, "EnemySensor", Matrix.Identity, new Vector3(10, 5, 10), Vector3.Zero)); Physics.AddChild(new CreatureAI(Manager, "Non Player Dwarf AI", Sensor)); Physics.AddChild(new Inventory(Manager, "Inventory", Physics.BoundingBox.Extents(), Physics.LocalBoundingBoxOffset)); Physics.Tags.Add("Dwarf"); Physics.AddChild(new Flammable(Manager, "Flames")); Stats.FullName = TextGenerator.GenerateRandom("$firstname", " ", "$lastname"); Stats.FindAdjustment("base stats").Size = 5; AI.Movement.CanClimbWalls = true; // Why isn't this a flag like the below? AI.Movement.SetCost(MoveType.ClimbWalls, 50.0f); AI.Movement.SetSpeed(MoveType.ClimbWalls, 0.15f); AI.Biography = Applicant.GenerateBiography(AI.Stats.FullName, Stats.Gender); Stats.Money = (decimal)MathFunctions.Rand(0, 150); }
public void Hire(Applicant currentApplicant) { List <Room> rooms = GetRooms().Where(room => room.RoomData.Name == "BalloonPort").ToList(); if (rooms.Count == 0) { return; } AddMoney(-currentApplicant.Level.Pay * 4m); var dwarfPhysics = DwarfFactory.GenerateDwarf( rooms.First().GetBoundingBox().Center() + Vector3.UnitY * 15, World.ComponentManager, "Player", currentApplicant.Class, currentApplicant.Level.Index, currentApplicant.Gender, currentApplicant.RandomSeed); World.ComponentManager.RootComponent.AddChild(dwarfPhysics); var newMinion = dwarfPhysics.EnumerateAll().OfType <Dwarf>().FirstOrDefault(); System.Diagnostics.Debug.Assert(newMinion != null); newMinion.Stats.CurrentClass = currentApplicant.Class; newMinion.Stats.AllowedTasks = currentApplicant.Class.Actions; newMinion.Stats.LevelIndex = currentApplicant.Level.Index - 1; newMinion.Stats.LevelUp(); newMinion.Stats.FullName = currentApplicant.Name; newMinion.AI.AddMoney(currentApplicant.Level.Pay * 4m); newMinion.AI.Biography = currentApplicant.Biography; World.MakeAnnouncement( new Gui.Widgets.QueuedAnnouncement { Text = String.Format("{0} was hired as a {1}.", currentApplicant.Name, currentApplicant.Level.Name), ClickAction = (gui, sender) => newMinion.AI.ZoomToMe() }); SoundManager.PlaySound(ContentPaths.Audio.Oscar.sfx_gui_positive_generic, 0.15f); }