Ejemplo n.º 1
0
        public void Hire(Applicant currentApplicant)
        {
            List <Room> rooms = GetRooms().Where(room => room.RoomData.Name == "BalloonPort").ToList();

            if (rooms.Count == 0)
            {
                return;
            }

            Economy.CurrentMoney -= currentApplicant.Level.Pay * 4;
            Dwarf newMinion =
                EntityFactory.GenerateDwarf(
                    rooms.First().GetBoundingBox().Center() + Vector3.UnitY * 15,
                    Components, GameState.Game.Content, GameState.Game.GraphicsDevice, World.ChunkManager,
                    World.Camera, this, World.PlanService, "Player", currentApplicant.Class, currentApplicant.Level.Index).GetChildrenOfType <Dwarf>().First();

            newMinion.Stats.CurrentClass = currentApplicant.Class;
            newMinion.Stats.LevelIndex   = currentApplicant.Level.Index - 1;
            newMinion.Stats.LevelUp();
            newMinion.Stats.FullName = currentApplicant.Name;
            newMinion.AI.AddMoney(currentApplicant.Level.Pay * 4);

            World.MakeAnnouncement("New hire!", String.Format("{0} was hired as a {1}.",
                                                              currentApplicant.Name, currentApplicant.Level.Name), newMinion.AI.ZoomToMe, ContentPaths.Audio.Oscar.gui_positive_generic);
        }
Ejemplo 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 =
                EntityFactory.GenerateDwarf(
                    rooms.First().GetBoundingBox().Center() + Vector3.UnitY * 15,
                    World.ComponentManager, GameState.Game.Content, GameState.Game.GraphicsDevice, World.ChunkManager,
                    World.Camera, this, World.PlanService, "Player", currentApplicant.Class, currentApplicant.Level.Index);

            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);
        }
Ejemplo n.º 3
0
        public void Hire(Applicant currentApplicant)
        {
            List <Room> rooms = GetRooms().Where(room => room.RoomData.Name == "BalloonPort").ToList();

            if (rooms.Count == 0)
            {
                return;
            }

            Economy.CurrentMoney -= currentApplicant.Level.Pay * 4;
            Dwarf newMinion =
                EntityFactory.GenerateDwarf(
                    rooms.First().GetBoundingBox().Center() + Vector3.UnitY * 15,
                    Components, GameState.Game.Content, GameState.Game.GraphicsDevice, PlayState.ChunkManager,
                    PlayState.Camera, this, PlayState.PlanService, "Player", currentApplicant.Class, currentApplicant.Level.Index).GetChildrenOfType <Dwarf>().First();

            newMinion.Stats.CurrentClass = currentApplicant.Class;
            newMinion.Stats.LevelIndex   = currentApplicant.Level.Index - 1;
            newMinion.Stats.LevelUp();
            newMinion.Stats.FullName = currentApplicant.Name;
            newMinion.AI.AddMoney(currentApplicant.Level.Pay * 4);

            PlayState.AnnouncementManager.Announce("New Hire!", currentApplicant.Name + " was hired as a " + currentApplicant.Level.Name, newMinion.AI.ZoomToMe);
        }