Пример #1
0
        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);
        }
Пример #2
0
 public Elf(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, "Elf", Matrix.CreateTranslation(position), new Vector3(0.5f, 1.0f, 0.5f), new Vector3(0.0f, -0.0f, 0.0f), 1.0f, 1.0f, 0.999f, 0.999f, new Vector3(0, -10, 0));
     Physics.AddChild(this);
     Initialize();
 }
Пример #3
0
        public Gremlin(CreatureStats stats, Faction faction, ComponentManager manager, string name, Vector3 position) :
            base(manager, stats, faction, name)
        {
            IsCloaked = true;

            Physics = new Physics(manager, "Gremlin", Matrix.CreateTranslation(position), new Vector3(0.5f, 0.9f, 0.5f), new Vector3(0.0f, 0.0f, 0.0f), 1.0f, 1.0f, 0.999f, 0.999f, new Vector3(0, -10, 0));

            Physics.AddChild(this);

            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 GremlinAI(Manager, "Gremlin AI", Sensor));

            Physics.AddChild(new Inventory(Manager, "Inventory", Physics.BoundingBox.Extents(), Physics.LocalBoundingBoxOffset));

            Physics.Tags.Add("Gremlin");

            Physics.AddChild(new Flammable(Manager, "Flames"));

            Stats.FullName            = TextGenerator.GenerateRandom("$goblinname");
            Stats.BaseSize            = 4;
            AI.Movement.CanClimbWalls = true;
            AI.Movement.SetCost(MoveType.ClimbWalls, 50.0f);
            AI.Movement.SetSpeed(MoveType.ClimbWalls, 0.15f);
            AI.Movement.SetCan(MoveType.Dig, true);
            (AI as GremlinAI).DestroyPlayerObjectProbability = 0.5f;
            (AI as GremlinAI).PlantBomb = "Explosive";
        }
Пример #4
0
        public Demon(CreatureStats stats, Faction faction, ComponentManager manager, string name, Vector3 position) :
            base(manager, stats, faction, name)
        {
            Physics = new Physics(manager, "Demon", 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);

            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 PacingCreatureAI(Manager, "Demon AI", Sensor)
            {
                Movement = { CanFly = true, CanSwim = false, CanDig = true }
            });

            Physics.AddChild(new Inventory(Manager, "Inventory", Physics.BoundingBox.Extents(), Physics.LocalBoundingBoxOffset));

            Physics.Tags.Add("Demon");

            Stats.FullName = TextGenerator.ToTitleCase(TextGenerator.GenerateRandom("$names_demon"));
            Stats.BaseSize = 4;
        }
Пример #5
0
        public Troll(CreatureStats stats, Faction faction, ComponentManager manager, string name, Vector3 position) :
            base(manager, stats, faction, name)
        {
            Physics = new Physics(manager, "Troll", Matrix.CreateTranslation(position), new Vector3(0.5f, 0.9f, 0.5f), new Vector3(0.0f, 0.0f, 0.0f), 1.0f, 1.0f, 0.999f, 0.999f, new Vector3(0, -10, 0));

            Physics.AddChild(this);

            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, "Troll AI", Sensor));

            Physics.AddChild(new Inventory(Manager, "Inventory", Physics.BoundingBox.Extents(), Physics.LocalBoundingBoxOffset));

            Physics.Tags.Add("Troll");

            Physics.AddChild(new Flammable(Manager, "Flames"));

            Stats.FullName            = TextGenerator.GenerateRandom("$goblinname");
            AI.Movement.CanClimbWalls = true;
            AI.Movement.CanSwim       = true;
            AI.Movement.SetCost(MoveType.ClimbWalls, 50.0f);
            AI.Movement.SetSpeed(MoveType.ClimbWalls, 0.15f);
            AI.Movement.SetSpeed(MoveType.Swim, 0.15f);
            AI.Movement.SetCan(MoveType.Dig, true);
        }
Пример #6
0
 public Creature(
     ComponentManager Manager,
     CreatureStats stats,
     string allies,
     PlanService planService,
     Faction faction,
     string name) :
     base(Manager, name, stats.MaxHealth, 0.0f, stats.MaxHealth)
 {
     Gender = Mating.RandomGender();
     DrawLifeTimer.HasTriggered = true;
     HasMeat               = true;
     HasBones              = true;
     HasCorpse             = false;
     Buffs                 = new List <Buff>();
     IsOnGround            = true;
     Stats                 = stats;
     Faction               = faction;
     PlanService           = planService;
     Allies                = allies;
     Controller            = new PIDController(Stats.MaxAcceleration, Stats.StoppingForce * 2, 0.0f);
     JumpTimer             = new Timer(0.2f, true);
     Status                = new CreatureStatus();
     IsHeadClear           = true;
     NoiseMaker            = new NoiseMaker();
     OverrideCharacterMode = false;
 }
Пример #7
0
 public Creature(CreatureStats stats,
                 string allies,
                 PlanService planService,
                 Faction faction,
                 Physics parent,
                 ChunkManager chunks,
                 GraphicsDevice graphics,
                 ContentManager content,
                 string name) :
     base(parent.Manager, name, parent, stats.MaxHealth, 0.0f, stats.MaxHealth)
 {
     HasMeat               = true;
     HasBones              = true;
     Buffs                 = new List <Buff>();
     IsOnGround            = true;
     Physics               = parent;
     Stats                 = stats;
     Chunks                = chunks;
     Graphics              = graphics;
     Content               = content;
     Faction               = faction;
     PlanService           = planService;
     Allies                = allies;
     Controller            = new PIDController(Stats.MaxAcceleration, Stats.StoppingForce * 2, 0.0f);
     JumpTimer             = new Timer(0.2f, true);
     Status                = new CreatureStatus();
     IsHeadClear           = true;
     NoiseMaker            = new NoiseMaker();
     OverrideCharacterMode = false;
     SelectionCircle       = new SelectionCircle(Manager, Physics)
     {
         IsVisible = false
     };
 }
Пример #8
0
 public Skeleton(CreatureStats stats, string allies, PlanService planService, Faction faction, ComponentManager manager, string name, ChunkManager chunks, GraphicsDevice graphics, ContentManager content, Vector3 position) :
     base(stats, allies, planService, faction, new Physics("Skeleton", manager.RootComponent, 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)),
          chunks, graphics, content, name)
 {
     HasMeat = false;
     Initialize();
 }
Пример #9
0
        public Necromancer(CreatureStats stats, Faction faction, ComponentManager manager, string name, Vector3 position) :
            base(manager, stats, faction, name)
        {
            Physics = new Physics(manager, "Necromancer", 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);

            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 NecromancerAI(Manager, "Necromancer AI", Sensor));

            Physics.AddChild(new Inventory(Manager, "Inventory", Physics.BoundingBox.Extents(), Physics.LocalBoundingBoxOffset));

            Physics.Tags.Add("Necromancer");

            Physics.AddChild(new Flammable(Manager, "Flames"));

            Stats.FullName            = TextGenerator.GenerateRandom("$title") + " " + TextGenerator.ToTitleCase(TextGenerator.GenerateRandom("$names_undead"));
            Stats.BaseSize            = 4;
            Stats.CanEat              = false;
            AI.Movement.CanClimbWalls = true;
            AI.Movement.SetCost(MoveType.ClimbWalls, 50.0f);
            AI.Movement.SetSpeed(MoveType.ClimbWalls, 0.15f);
            AI.Movement.SetCan(MoveType.Dig, true);
        }
Пример #10
0
 public Dwarf(CreatureStats stats, string allies, PlanService planService, Faction faction, string name, ChunkManager chunks, GraphicsDevice graphics, ContentManager content, EmployeeClass workerClass, Vector3 position) :
     base(stats, allies, planService, faction,
          new Physics("A Dwarf", PlayState.ComponentManager.RootComponent, 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)),
          chunks, graphics, content, name)
 {
     Initialize(workerClass);
 }
Пример #11
0
 public Dwarf(CreatureStats stats, string allies, PlanService planService, Faction faction,  string name, ChunkManager chunks, GraphicsDevice graphics, ContentManager content, EmployeeClass workerClass, Vector3 position)
     : base(stats, allies, planService, faction, 
     new Physics( "A Dwarf", PlayState.ComponentManager.RootComponent, 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)),
        chunks, graphics, content, name)
 {
     Initialize(workerClass);
 }
Пример #12
0
        public MudGolem(CreatureStats stats, string blood, string allies, PlanService planService, Faction faction, ComponentManager manager, string name, Vector3 position, int iconX, int iconY) :
            base(manager, stats, allies, planService, faction, name)
        {
            Physics = new Physics(Manager, name, 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(blood, iconX, iconY);
        }
Пример #13
0
        public DwarfSprites.LayerStack GetLayers()
        {
            CreatureStats stats = new CreatureStats("Dwarf", ClassName, LevelIndex)
            {
                Gender     = this.Gender,
                RandomSeed = RandomSeed
            };

            return(DwarfSprites.DwarfBuilder.CreateDwarfLayerStack(stats));
        }
Пример #14
0
        public static Body GenerateMoleman(Vector3 position,
                                           ComponentManager componentManager,
                                           ContentManager content,
                                           GraphicsDevice graphics,
                                           ChunkManager chunkManager, Camera camera,
                                           Faction faction, PlanService planService, string allies)
        {
            CreatureStats stats = new CreatureStats(new MolemanMinerClass(), 0);

            return(new Moleman(stats, allies, planService, faction, componentManager, "Moleman", chunkManager, graphics, content, position).Physics);
        }
Пример #15
0
        public static GameComponent GenerateDwarf(Vector3 position,
                                                  ComponentManager componentManager,
                                                  ContentManager content,
                                                  GraphicsDevice graphics,
                                                  ChunkManager chunkManager, Camera camera,
                                                  Faction faction, PlanService planService, string allies, EmployeeClass dwarfClass, int level)
        {
            CreatureStats stats    = new CreatureStats(dwarfClass, level);
            Dwarf         toReturn = new Dwarf(stats, allies, planService, faction, "Dwarf", chunkManager, graphics, content, dwarfClass, position);

            toReturn.AI.AddThought(Thought.CreateStandardThought(Thought.ThoughtType.JustArrived, PlayState.Time.CurrentDate), false);
            return(toReturn.Physics);
        }
Пример #16
0
        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);

            Physics.AddChild(new SelectionCircle(Manager)
            {
                IsVisible = false
            });

            Initialize();
        }
Пример #17
0
        public Dwarf(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();
            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 DwarfAI(Manager, "Dwarf AI", Sensor));
            Physics.AddChild(new Inventory(Manager, "Inventory", Physics.BoundingBox.Extents(), Physics.LocalBoundingBoxOffset));
            Physics.AddChild(new Equipment(Manager));

            Physics.Tags.Add("Dwarf");

            Physics.AddChild(new Flammable(Manager, "Flames"));

            Stats.FullName = TextGenerator.GenerateRandom("$firstname", " ", "$lastname");
            Stats.FindAdjustment("base stats").Size = 5;
            Stats.CanEat = true;
            AI.Movement.CanClimbWalls = true; // Why isn't this a flag like the below?
            AI.Movement.SetCan(MoveType.Teleport, true);
            AI.Movement.SetCost(MoveType.Teleport, 1.0f);
            AI.Movement.SetSpeed(MoveType.Teleport, 10.0f);
            AI.Movement.SetCost(MoveType.ClimbWalls, 50.0f);
            AI.Movement.SetSpeed(MoveType.ClimbWalls, 0.15f);
            AI.Movement.SetCan(MoveType.EnterVehicle, true);
            AI.Movement.SetCan(MoveType.ExitVehicle, true);
            AI.Movement.SetCan(MoveType.RideVehicle, true);
            AI.Movement.SetCost(MoveType.EnterVehicle, 0.01f);
            AI.Movement.SetCost(MoveType.ExitVehicle, 0.01f);
            AI.Movement.SetCost(MoveType.RideVehicle, 0.01f);
            AI.Movement.SetSpeed(MoveType.RideVehicle, 3.0f);
            AI.Movement.SetSpeed(MoveType.EnterVehicle, 1.0f);
            AI.Movement.SetSpeed(MoveType.ExitVehicle, 1.0f);
            if (AI.Stats.IsTaskAllowed(TaskCategory.Dig))
            {
                AI.Movement.SetCan(MoveType.Dig, true);
            }
            AI.Biography = Applicant.GenerateBiography(AI.Stats.FullName, Stats.Gender);
            Stats.Money  = (decimal)MathFunctions.Rand(0, 150);

            Physics.AddChild(new DwarfThoughts(Manager, "Thoughts"));
        }
Пример #18
0
        public static GameComponent GenerateDwarf(
            Vector3 Position,
            ComponentManager Manager,
            string Allies,
            EmployeeClass DwarfClass,
            int Level, Gender gender, int seed)
        {
            Dwarf toReturn = new Dwarf(Manager, new CreatureStats(DwarfClass, Level)
            {
                Gender = gender, RandomSeed = seed, VoicePitch = CreatureStats.GetRandomVoicePitch(gender)
            }, Allies, Manager.World.PlanService, Manager.World.PlayerFaction, "Dwarf", DwarfClass, Position);

            toReturn.AddThought(Thought.CreateStandardThought(Thought.ThoughtType.JustArrived, Manager.World.Time.CurrentDate), false);
            return(toReturn.Physics);
        }
Пример #19
0
        public Dwarf(ComponentManager manager, CreatureStats stats, string allies, PlanService planService, Faction faction, string name, EmployeeClass workerClass, Vector3 position) :
            base(manager, stats, allies, planService, 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);

            Physics.AddChild(new SelectionCircle(Manager)
            {
                IsVisible = false
            });

            HasMeat   = false;
            HasBones  = false;
            HasCorpse = true;
            Initialize(workerClass);
        }
Пример #20
0
 public Creature(
     ComponentManager Manager,
     CreatureStats stats,
     Faction faction,
     string name) :
     base(Manager, name, stats.MaxHealth, 0.0f, stats.MaxHealth)
 {
     Stats        = stats;
     Stats.Gender = Mating.RandomGender();
     DrawLifeTimer.HasTriggered = true;
     IsOnGround            = true;
     Faction               = faction;
     Controller            = new PIDController(Stats.MaxAcceleration, Stats.StoppingForce * 2, 0.0f);
     IsHeadClear           = true;
     NoiseMaker            = new NoiseMaker();
     NoiseMaker.BasePitch  = stats.VoicePitch;
     OverrideCharacterMode = false;
     InitializeAttacks();
 }
Пример #21
0
        public MudGolem(CreatureStats stats, Faction faction, ComponentManager manager, string name, Vector3 position) :
            base(manager, stats, faction, name)
        {
            Physics = new Physics(Manager, name, 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);

            Physics.Orientation = Physics.OrientMode.RotateY;
            CreateCosmeticChildren(Manager);

            Physics.AddChild(new EnemySensor(Manager, "EnemySensor", Matrix.Identity, new Vector3(5, 5, 5), Vector3.Zero));

            Physics.AddChild(new GolemAI(Manager, Sensor)
            {
                Movement = { IsSessile = true, CanFly = false, CanSwim = false, CanWalk = false, CanClimb = false, CanClimbWalls = false }
            });

            Physics.AddChild(new Inventory(Manager, "Inventory", Physics.BoundingBox.Extents(), Physics.LocalBoundingBoxOffset));

            var gems = Library.EnumerateResourceTypesWithTag("Gem");

            for (int i = 0; i < 16; i++)
            {
                int num = MathFunctions.RandInt(1, 32 - i);
                for (int j = 0; j < num; ++j)
                {
                    Inventory.AddResource(new Resource(Datastructures.SelectRandom(gems)));
                }
                i += num - 1;
            }

            Physics.Tags.Add("MudGolem");
            Physics.Mass = 100;

            Stats.FullName = TextGenerator.GenerateRandom("$goblinname");
            Stats.BaseSize = 4;
            Resistances[DamageType.Fire] = 5;
            Resistances[DamageType.Acid] = 5;
            Resistances[DamageType.Cold] = 5;
        }
Пример #22
0
        public LayeredSprites.LayerStack GetLayers()
        {
            var random = new Random(RandomSeed);

            var hairPalette = LayeredSprites.LayerLibrary.EnumeratePalettes().Where(p => p.Layer.Contains("hair")).SelectRandom(random);
            var skinPalette = LayeredSprites.LayerLibrary.EnumeratePalettes().Where(p => p.Layer.Contains("face")).SelectRandom(random);

            LayeredSprites.LayerStack sprite = new LayeredSprites.LayerStack();
            CreatureStats             stats  = new CreatureStats(Class, Level.Index)
            {
                Gender = this.Gender
            };

            AddLayerOrDefault(sprite, random, "body", stats, skinPalette);
            AddLayerOrDefault(sprite, random, "face", stats, skinPalette);
            AddLayerOrDefault(sprite, random, "nose", stats, skinPalette);
            AddLayerOrDefault(sprite, random, "beard", stats, hairPalette);
            AddLayerOrDefault(sprite, random, "hair", stats, hairPalette);
            AddLayerOrDefault(sprite, random, "tool", stats);
            AddLayerOrDefault(sprite, random, "hat", stats, hairPalette);
            return(sprite);
        }
Пример #23
0
        private void AddLayerOrDefault(LayeredSprites.LayerStack stack, Random Random, String Layer, CreatureStats stats, LayeredSprites.Palette Palette = null)
        {
            var layers = LayeredSprites.LayerLibrary.EnumerateLayers(Layer).Where(l => !l.DefaultLayer && l.PassesFilter(stats));

            if (layers.Count() > 0)
            {
                stack.AddLayer(layers.SelectRandom(Random), Palette);
            }
            else
            {
                var defaultLayer = LayeredSprites.LayerLibrary.EnumerateLayers(Layer).Where(l => l.DefaultLayer).FirstOrDefault();
                if (defaultLayer != null)
                {
                    stack.AddLayer(defaultLayer, Palette);
                }
            }
        }
Пример #24
0
 public StatBuff(float time, CreatureStats.StatNums buffs)
     : base(time)
 {
     Buffs = buffs;
 }
Пример #25
0
        public static Body GenerateDemon(WorldManager worldManager, Vector3 position, Faction faction, string allies)
        {
            CreatureStats stats = new CreatureStats(new DemonClass(), 0);

            return(new Demon(stats, allies, worldManager.PlanService, faction, worldManager.ComponentManager, "Demon", position).Physics);
        }
Пример #26
0
        private void AddLayerOrDefault(LayeredSprites.LayerStack stack, Random Random, String Layer, CreatureStats stats, LayeredSprites.Palette Palette = null)
        {
            var layers = LayeredSprites.LayerLibrary.EnumerateLayers(Layer).Where(l => !l.DefaultLayer && l.PassesFilter(stats));

            if (layers.Count() > 0)
            {
                var newLayer = layers.SelectRandom(Random);
                stack.AddLayer(newLayer, Palette);
                // Do not allow hats and hair on the same head.
                if (newLayer.Asset != "Entities/Dwarf/Layers/blank" && Layer == "hat")
                {
                    stack.RemoveLayer("hair");
                }
            }
            else
            {
                var defaultLayer = LayeredSprites.LayerLibrary.EnumerateLayers(Layer).Where(l => l.DefaultLayer).FirstOrDefault();
                if (defaultLayer != null)
                {
                    stack.AddLayer(defaultLayer, Palette);
                }
            }
        }
Пример #27
0
 public Elf(CreatureStats stats, string allies, PlanService planService, Faction faction, ComponentManager manager, string name, ChunkManager chunks, GraphicsDevice graphics, ContentManager content, Vector3 position)
     : base(stats, allies, planService, faction, new Physics("elf", manager.RootComponent, 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)),
          chunks, graphics, content, name)
 {
     Initialize();
 }
Пример #28
0
 public Creature(CreatureStats stats,
     string allies,
     PlanService planService,
     Faction faction,
     Physics parent,
     ChunkManager chunks,
     GraphicsDevice graphics,
     ContentManager content,
     string name)
     : base(parent.Manager, name, parent, stats.MaxHealth, 0.0f, stats.MaxHealth)
 {
     Buffs = new List<Buff>();
     IsOnGround = true;
     Physics = parent;
     Stats = stats;
     Chunks = chunks;
     Graphics = graphics;
     Content = content;
     Faction = faction;
     PlanService = planService;
     Allies = allies;
     Controller = new PIDController(Stats.MaxAcceleration, Stats.StoppingForce * 2, 0.0f);
     JumpTimer = new Timer(0.2f, true);
     Status = new CreatureStatus();
     IsHeadClear = true;
     NoiseMaker = new NoiseMaker();
     OverrideCharacterMode = false;
     SelectionCircle = new SelectionCircle(Manager, Physics)
     {
         IsVisible = false
     };
 }
Пример #29
0
        public static Body GenerateDemon(Vector3 position, Faction faction, string allies)
        {
            CreatureStats stats = new CreatureStats(new DemonClass(), 0);

            return(new Demon(stats, allies, PlayState.PlanService, faction, PlayState.ComponentManager, "Demon", PlayState.ChunkManager, GameState.Game.GraphicsDevice, GameState.Game.Content, position).Physics);
        }
Пример #30
0
        public static Body GenerateElf(WorldManager worldManger, Vector3 position, Faction faction, string allies)
        {
            CreatureStats stats = new CreatureStats(new ElfClass(), 0);

            return(new Elf(stats, allies, worldManger.PlanService, faction, worldManger.ComponentManager, "Elf", worldManger.ChunkManager, GameState.Game.GraphicsDevice, GameState.Game.Content, position).Physics);
        }