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);
        }
Esempio n. 2
0
        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);
        }