示例#1
0
 public CreatureStats(EmployeeClass creatureClass, int level)
 {
     CanSleep = false;
     CanEat = false;
     FullName = "";
     CurrentClass = creatureClass;
     LevelIndex = level;
     XP = creatureClass.Levels[level].XP;
     Dexterity = Math.Max(Dexterity, CurrentLevel.BaseStats.Dexterity);
     Constitution = Math.Max(Constitution, CurrentLevel.BaseStats.Constitution);
     Strength = Math.Max(Strength, CurrentLevel.BaseStats.Strength);
     Wisdom = Math.Max(Wisdom, CurrentLevel.BaseStats.Wisdom);
     Charisma = Math.Max(Charisma, CurrentLevel.BaseStats.Charisma);
     Intelligence = Math.Max(Intelligence, CurrentLevel.BaseStats.Intelligence);
     StatBuffs = new StatNums()
     {
         Charisma = 0,
         Constitution = 0,
         Dexterity = 0,
         Intelligence = 0,
         Size = 0,
         Strength = 0,
         Wisdom = 0
     };
 }
示例#2
0
文件: Dwarf.cs 项目: scorvi/dwarfcorp
 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);
 }
示例#3
0
        public void GenerateRandom(EmployeeClass employeeClass, int level)
        {
            Class = employeeClass;
            Level = Class.Levels[level];

            Name = TextGenerator.GenerateRandom("$firstname", " ", "$lastname");
            List<string> justifications = new List<string>()
            {
                "I have many relevant qualities!",
                "My expereince is extensive!",
                "I really need this job!",
                "I need to get away from it all!",
                "I will be your loyal servant!",
                "I've always wanted to work at " + PlayState.PlayerCompany.Name + "!",
                "I am a very hard worker!",
                "I am an adventurous soul!"
            };
               CoverLetter =
                TextGenerator.GenerateRandom("Dear " + PlayState.PlayerCompany.Name + ",\n",
                "${Please,Do}"," consider ", "${my,this}"," application for the position of " + Level.Name +
                                             ". " + justifications[PlayState.Random.Next(justifications.Count)] +"\n", "${Thanks,Sincerely,Yours}", ",\n    " ,Name);

            if (level > 0)
            {
                FormerProfession = Class.Levels[level - 1].Name;
            }
            else
            {
                FormerProfession = TextGenerator.GenerateRandom("$profession");
            }

            List<string[]> templates = new List<string[]>
            {
                new[]
                {
                    "place",
                    " of the ",
                    "$color",
                    " ",
                    "$noun"
                },
                new[]
                {
                    "$place",
                    " of the ",
                    "$adjective",
                    " ",
                    "$noun"
                },
                new[]
                {
                    "$place",
                    " of the ",
                    "$material",
                    " ",
                    "$noun"
                },
                new[]
                {
                    "$place",
                    " of ",
                    "$noun"
                },
                new[]
                {
                    "$color",
                    " ",
                    "$material",
                    " ",
                    "$place"
                },
                new[]
                {
                    "$adjective",
                    " ",
                    "$place"
                },
                new []
                {
                    "$adjective",
                    "ville"
                },
                new []
                {
                    "$adjective",
                    "burg"
                },
                new []
                {
                    "$lastname",
                    "ton"
                }

            };
             HomeTown = TextGenerator.GenerateRandom(templates[PlayState.Random.Next(templates.Count)]);
        }
示例#4
0
文件: Dwarf.cs 项目: scorvi/dwarfcorp
        public void Initialize(EmployeeClass dwarfClass)
        {
            Physics.Orientation = Physics.OrientMode.RotateY;
            Sprite = new CharacterSprite(Graphics, Manager, "Dwarf Sprite", Physics, Matrix.CreateTranslation(new Vector3(0, 0.15f, 0)));
            foreach (Animation animation in dwarfClass.Animations)
            {
                Sprite.AddAnimation(animation.Clone());
            }
            Sprite.SpriteSheet = Sprite.Animations.First().Value.SpriteSheet;
            Sprite.CurrentAnimation = Sprite.Animations.First().Value;
            Sprite.CurrentAnimation.NextFrame();
            Hands = new Grabber("hands", Physics, Matrix.Identity, new Vector3(0.1f, 0.1f, 0.1f), Vector3.Zero);

            Sensors = new EnemySensor(Manager, "EnemySensor", Physics, Matrix.Identity, new Vector3(20, 5, 20), Vector3.Zero);

            AI = new CreatureAI(this, "Dwarf AI", Sensors, PlanService);

            Attacks = new List<Attack>() { new Attack(Stats.CurrentClass.Attacks[0]) };

            Inventory = new Inventory("Inventory", Physics)
            {
                Resources = new ResourceContainer
                {
                    MaxResources = 128
                }
            };

            Matrix shadowTransform = Matrix.CreateRotationX((float) Math.PI * 0.5f);
            shadowTransform.Translation = new Vector3(0.0f, -0.5f, 0.0f);

            Shadow = new Shadow(Manager, "Shadow", Physics, shadowTransform,
                new SpriteSheet(ContentPaths.Effects.shadowcircle))
            {
                GlobalScale = 1.25f
            };
            List<Point> shP = new List<Point>
            {
                new Point(0, 0)
            };
            Animation shadowAnimation = new Animation(Graphics, new SpriteSheet(ContentPaths.Effects.shadowcircle), "sh", 32, 32, shP, false, Color.Black, 1, 0.7f, 0.7f, false);
            Shadow.AddAnimation(shadowAnimation);
            shadowAnimation.Play();
            Shadow.SetCurrentAnimation("sh");
            Physics.Tags.Add("Dwarf");

            DeathParticleTrigger = new ParticleTrigger("blood_particle", Manager, "Death Gibs", Physics, Matrix.Identity, Vector3.One, Vector3.Zero)
            {
                TriggerOnDeath = true,
                TriggerAmount = 1,
                BoxTriggerTimes = 10,
                SoundToPlay = ContentPaths.Entities.Dwarf.Audio.dwarfhurt1,
            };
            Flames = new Flammable(Manager, "Flames", Physics, this);

            NoiseMaker.Noises["Hurt"] = new List<string>
            {
                ContentPaths.Entities.Dwarf.Audio.dwarfhurt1,
                ContentPaths.Entities.Dwarf.Audio.dwarfhurt2,
                ContentPaths.Entities.Dwarf.Audio.dwarfhurt3,
                ContentPaths.Entities.Dwarf.Audio.dwarfhurt4,
            };

            NoiseMaker.Noises["Chew"] = new List<string>
            {
                ContentPaths.Audio.chew
            };

            NoiseMaker.Noises["Jump"] = new List<string>
            {
                ContentPaths.Audio.jump
            };

            MinimapIcon minimapIcon = new MinimapIcon(Physics, new ImageFrame(TextureManager.GetTexture(ContentPaths.GUI.map_icons), 16, 0, 0));

            Stats.FullName = TextGenerator.GenerateRandom("$firstname", " ", "$lastname");
            Stats.Size = 5;
            Stats.CanSleep = true;
            Stats.CanEat = true;
            AI.TriggersMourning = true;
        }
示例#5
0
        public void Initialize(EmployeeClass dwarfClass)
        {
            Stats.Gender        = Mating.RandomGender();
            Physics.Orientation = Physics.OrientMode.RotateY;
            CreateDwarfSprite(dwarfClass, Manager);

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

            Physics.AddChild(new CreatureAI(Manager, "Dwarf AI", Sensors, PlanService));

            Attacks = new List <Attack>()
            {
                new Attack(Stats.CurrentClass.Attacks[0])
            };

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


            Physics.Tags.Add("Dwarf");

            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,
            });

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

            Physics.AddChild(Shadow.Create(0.75f, Manager));

            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
            };

            MinimapIcon minimapIcon = Physics.AddChild(new MinimapIcon(Manager, new NamedImageFrame(ContentPaths.GUI.map_icons, 16, 0, 0))) as MinimapIcon;

            Stats.FullName            = TextGenerator.GenerateRandom("$firstname", " ", "$lastname");
            Stats.Size                = 5;
            Stats.CanSleep            = true;
            Stats.CanEat              = true;
            Stats.CanGetBored         = 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, 1.0f);
            AI.Movement.SetCost(MoveType.ExitVehicle, 1.0f);
            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);
            AI.TriggersMourning = true;
            AI.Biography        = Applicant.GenerateBiography(AI.Stats.FullName, Stats.Gender);
            Species             = "Dwarf";
            Status.Money        = (decimal)MathFunctions.Rand(0, 150);

            Physics.AddChild(new VoxelRevealer(Manager, Physics, 5)).SetFlag(Flag.ShouldSerialize, false);

            Physics.AddChild(new DwarfThoughts(Manager, "Thoughts"));
        }
示例#6
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);
        }
示例#7
0
        public void Initialize(EmployeeClass dwarfClass)
        {
            Physics.Orientation = Physics.OrientMode.RotateY;
            CreateSprite(Stats.CurrentClass, Manager);
            Sprite.LightsWithVoxels = false;

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

            Physics.AddChild(new CreatureAI(Manager, "Fairy AI", Sensors, PlanService));

            Attacks = new List <Attack>()
            {
                new Attack(Stats.CurrentClass.Attacks[0])
            };

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

            Physics.AddChild(Shadow.Create(0.75f, Manager));

            Physics.Tags.Add("Dwarf");

            Physics.AddChild(new ParticleTrigger("star_particle", Manager, "Death Gibs", Matrix.Identity, Vector3.One, Vector3.Zero)
            {
                TriggerOnDeath = true,
                TriggerAmount  = 5,
                SoundToPlay    = ContentPaths.Audio.wurp,
            });

            NoiseMaker.Noises["Hurt"] = new List <string>
            {
                ContentPaths.Audio.tinkle
            };


            NoiseMaker.Noises["Chew"] = new List <string>
            {
                ContentPaths.Audio.tinkle
            };

            NoiseMaker.Noises["Jump"] = new List <string>
            {
                ContentPaths.Audio.tinkle
            };

            MinimapIcon minimapIcon = Physics.AddChild(new MinimapIcon(Manager, new NamedImageFrame(ContentPaths.GUI.map_icons, 16, 0, 0))) as MinimapIcon;

            //new LightEmitter("Light Emitter", Sprite, Matrix.Identity, Vector3.One, Vector3.One, 255, 150);
            Stats.FullName = TextGenerator.GenerateRandom("$firstname");
            //Stats.LastName = "The Fairy";

            Stats.CanSleep            = false;
            Stats.CanEat              = false;
            AI.Movement.CanClimbWalls = true;
            AI.Movement.CanFly        = true;
            AI.Movement.SetCost(MoveType.Fly, 1.0f);
            AI.Movement.SetSpeed(MoveType.Fly, 1.0f);
            AI.Movement.SetCost(MoveType.ClimbWalls, 1.0f);
            AI.Movement.SetSpeed(MoveType.ClimbWalls, 1.0f);

            Species = "Fairy";
        }
示例#8
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(componentManager, stats, allies, planService, faction, "Dwarf", dwarfClass, position);

            toReturn.AI.AddThought(Thought.CreateStandardThought(Thought.ThoughtType.JustArrived, componentManager.World.Time.CurrentDate), false);
            return(toReturn.Physics);
        }
示例#9
0
        public void Initialize(EmployeeClass dwarfClass)
        {
            Physics.Orientation = Physics.OrientMode.RotateY;
            Sprite = new CharacterSprite(Graphics, Manager, "Fairy Sprite", Physics, Matrix.CreateTranslation(new Vector3(0, 0.5f, 0)));
            foreach (Animation animation in dwarfClass.Animations)
            {
                Sprite.AddAnimation(animation.Clone());
            }
            Sprite.LightsWithVoxels = false;

            Hands = new Grabber("hands", Physics, Matrix.Identity, new Vector3(0.1f, 0.1f, 0.1f), Vector3.Zero);

            Sensors = new EnemySensor(Manager, "EnemySensor", Physics, Matrix.Identity, new Vector3(20, 5, 20), Vector3.Zero);

            AI = new CreatureAI(this, "Fairy AI", Sensors, PlanService);

            Attacks = new List <Attack>()
            {
                new Attack(Stats.CurrentClass.Attacks[0])
            };


            Inventory = new Inventory("Inventory", Physics)
            {
                Resources = new ResourceContainer
                {
                    MaxResources = 128
                }
            };

            Matrix shadowTransform = Matrix.CreateRotationX((float)Math.PI * 0.5f);

            shadowTransform.Translation = new Vector3(0.0f, -0.5f, 0.0f);

            Shadow = new Shadow(Manager, "Shadow", Physics, shadowTransform, new SpriteSheet(ContentPaths.Effects.shadowcircle));
            List <Point> shP = new List <Point>
            {
                new Point(0, 0)
            };
            Animation shadowAnimation = new Animation(Graphics, new SpriteSheet(ContentPaths.Effects.shadowcircle), "sh", 32, 32, shP, false, Color.Black, 1, 0.7f, 0.7f, false);

            Shadow.AddAnimation(shadowAnimation);
            shadowAnimation.Play();
            Shadow.SetCurrentAnimation("sh");
            Physics.Tags.Add("Dwarf");



            DeathParticleTrigger = new ParticleTrigger("star_particle", Manager, "Death Gibs", Physics, Matrix.Identity, Vector3.One, Vector3.Zero)
            {
                TriggerOnDeath = true,
                TriggerAmount  = 5,
                SoundToPlay    = ContentPaths.Audio.wurp,
            };

            NoiseMaker.Noises["Hurt"] = new List <string>
            {
                ContentPaths.Audio.tinkle
            };


            NoiseMaker.Noises["Chew"] = new List <string>
            {
                ContentPaths.Audio.tinkle
            };

            NoiseMaker.Noises["Jump"] = new List <string>
            {
                ContentPaths.Audio.tinkle
            };

            MinimapIcon minimapIcon = new MinimapIcon(Physics, new ImageFrame(TextureManager.GetTexture(ContentPaths.GUI.map_icons), 16, 0, 0));

            //new LightEmitter("Light Emitter", Sprite, Matrix.Identity, Vector3.One, Vector3.One, 255, 150);
            new Bobber(0.25f, 3.0f, MathFunctions.Rand(), Sprite);

            Stats.FullName = TextGenerator.GenerateRandom("$firstname");
            //Stats.LastName = "The Fairy";

            Stats.CanSleep = false;
            Stats.CanEat   = false;
        }
示例#10
0
        public void GenerateRandom(EmployeeClass employeeClass, int level)
        {
            Class = employeeClass;
            Level = Class.Levels[level];

            Name = TextGenerator.GenerateRandom("$firstname", " ", "$lastname");
            List <string> justifications = new List <string>()
            {
                "I have many relevant qualities!",
                "My expereince is extensive!",
                "I really need this job!",
                "I need to get away from it all!",
                "I will be your loyal servant!",
                "I've always wanted to work at " + PlayState.PlayerCompany.Name + "!",
                "I am a very hard worker!",
                "I am an adventurous soul!"
            };

            CoverLetter =
                TextGenerator.GenerateRandom("Dear " + PlayState.PlayerCompany.Name + ",\n",
                                             "${Please,Do}", " consider ", "${my,this}", " application for the position of " + Level.Name +
                                             ". " + justifications[PlayState.Random.Next(justifications.Count)] + "\n", "${Thanks,Sincerely,Yours}", ",\n    ", Name);

            if (level > 0)
            {
                FormerProfession = Class.Levels[level - 1].Name;
            }
            else
            {
                FormerProfession = TextGenerator.GenerateRandom("$profession");
            }

            List <string[]> templates = new List <string[]>
            {
                new[]
                {
                    "place",
                    " of the ",
                    "$color",
                    " ",
                    "$noun"
                },
                new[]
                {
                    "$place",
                    " of the ",
                    "$adjective",
                    " ",
                    "$noun"
                },
                new[]
                {
                    "$place",
                    " of the ",
                    "$material",
                    " ",
                    "$noun"
                },
                new[]
                {
                    "$place",
                    " of ",
                    "$noun"
                },
                new[]
                {
                    "$color",
                    " ",
                    "$material",
                    " ",
                    "$place"
                },
                new[]
                {
                    "$adjective",
                    " ",
                    "$place"
                },
                new []
                {
                    "$adjective",
                    "ville"
                },
                new []
                {
                    "$adjective",
                    "burg"
                },
                new []
                {
                    "$lastname",
                    "ton"
                }
            };

            HomeTown = TextGenerator.GenerateRandom(templates[PlayState.Random.Next(templates.Count)]);
        }
示例#11
0
        public Creature(ComponentManager manager, Vector3 pos, CreatureDef def, string creatureClass, int creatureLevel, string faction) :
            this(new CreatureStats(EmployeeClass.Classes[creatureClass], creatureLevel),
                 faction,
                 manager.World.PlanService,
                 manager.World.ComponentManager.Factions.Factions[faction],
                 new Physics(def.Name, manager.RootComponent, Matrix.CreateTranslation(pos), def.Size,
                             new Vector3(0, -def.Size.Y * 0.5f, 0), def.Mass, 1.0f, 0.999f, 0.999f, Vector3.UnitY * -10,
                             Physics.OrientMode.RotateY),
                 manager.World.ChunkManager,
                 GameState.Game.GraphicsDevice,
                 GameState.Game.Content,
                 def.Name)
        {
            HasMeat  = true;
            HasBones = true;
            EmployeeClass employeeClass = EmployeeClass.Classes[creatureClass];

            Physics.Orientation = Physics.OrientMode.RotateY;
            Sprite = new CharacterSprite(Graphics, Manager, "Sprite", Physics,
                                         Matrix.CreateTranslation(def.SpriteOffset));

            foreach (Animation animation in employeeClass.Animations)
            {
                Sprite.AddAnimation(animation.Clone());
            }

            Hands = new Grabber("hands", Physics, Matrix.Identity, new Vector3(0.1f, 0.1f, 0.1f), Vector3.Zero);

            Sensors = new EnemySensor(Manager, "EnemySensor", Physics, Matrix.Identity, def.SenseRange, Vector3.Zero);

            AI = new CreatureAI(this, "AI", Sensors, PlanService);

            Attacks = new List <Attack>();

            foreach (Attack attack in employeeClass.Attacks)
            {
                Attacks.Add(new Attack(attack));
            }


            Inventory = new Inventory("Inventory", Physics)
            {
                Resources = new ResourceContainer
                {
                    MaxResources = def.InventorySize
                }
            };

            if (def.HasShadow)
            {
                Matrix shadowTransform = Matrix.CreateRotationX((float)Math.PI * 0.5f);
                shadowTransform.Translation = new Vector3(0.0f, -0.5f, 0.0f);

                Shadow = new Shadow(Manager, "Shadow", Physics, shadowTransform,
                                    new SpriteSheet(ContentPaths.Effects.shadowcircle))
                {
                    GlobalScale = def.ShadowScale
                };
                var shP = new List <Point>
                {
                    new Point(0, 0)
                };
                var shadowAnimation = new Animation(Graphics, new SpriteSheet(ContentPaths.Effects.shadowcircle),
                                                    "sh", 32, 32, shP, false, Color.Black, 1, 0.7f, 0.7f, false);
                Shadow.AddAnimation(shadowAnimation);
                shadowAnimation.Play();
                Shadow.SetCurrentAnimation("sh");
            }
            Physics.Tags.AddRange(def.Tags);

            DeathParticleTrigger = new ParticleTrigger(def.BloodParticle, Manager, "Death Gibs", Physics,
                                                       Matrix.Identity, Vector3.One, Vector3.Zero)
            {
                TriggerOnDeath  = true,
                TriggerAmount   = 1,
                BoxTriggerTimes = 10,
                SoundToPlay     = ContentPaths.Entities.Dwarf.Audio.dwarfhurt1,
            };

            if (def.IsFlammable)
            {
                Flames = new Flammable(Manager, "Flames", Physics, this);
            }

            NoiseMaker.Noises["Hurt"] = def.HurtSounds;
            NoiseMaker.Noises["Chew"] = new List <string> {
                def.ChewSound
            };
            NoiseMaker.Noises["Jump"] = new List <string> {
                def.JumpSound
            };

            var minimapIcon = new MinimapIcon(Physics, def.MinimapIcon);

            Stats.FullName =
                TextGenerator.GenerateRandom(Manager.World.ComponentManager.Factions.Races[def.Race].NameTemplates);
            Stats.CanSleep      = def.CanSleep;
            Stats.CanEat        = def.CanEat;
            AI.TriggersMourning = def.TriggersMourning;
        }
示例#12
0
 private void OnDeserialized(StreamingContext context)
 {
     EmployeeClass.AddClasses(Classes);
 }
示例#13
0
        public void Initialize(EmployeeClass dwarfClass)
        {
            Physics.Orientation = Physics.OrientMode.RotateY;
            Sprite = new CharacterSprite(Graphics, Manager, "Dwarf Sprite", Physics, Matrix.CreateTranslation(new Vector3(0, 0.15f, 0)));
            foreach (Animation animation in dwarfClass.Animations)
            {
                Sprite.AddAnimation(animation.Clone());
            }
            Sprite.SpriteSheet      = Sprite.Animations.First().Value.SpriteSheet;
            Sprite.CurrentAnimation = Sprite.Animations.First().Value;
            Sprite.CurrentAnimation.NextFrame();
            Hands = new Grabber("hands", Physics, Matrix.Identity, new Vector3(0.1f, 0.1f, 0.1f), Vector3.Zero);

            Sensors = new EnemySensor(Manager, "EnemySensor", Physics, Matrix.Identity, new Vector3(20, 5, 20), Vector3.Zero);

            AI = new CreatureAI(this, "Dwarf AI", Sensors, PlanService);

            Attacks = new List <Attack>()
            {
                new Attack(Stats.CurrentClass.Attacks[0])
            };

            Inventory = new Inventory("Inventory", Physics)
            {
                Resources = new ResourceContainer
                {
                    MaxResources = 128
                }
            };

            Matrix shadowTransform = Matrix.CreateRotationX((float)Math.PI * 0.5f);

            shadowTransform.Translation = new Vector3(0.0f, -0.5f, 0.0f);

            Shadow = new Shadow(Manager, "Shadow", Physics, shadowTransform,
                                new SpriteSheet(ContentPaths.Effects.shadowcircle))
            {
                GlobalScale = 1.25f
            };
            List <Point> shP = new List <Point>
            {
                new Point(0, 0)
            };
            Animation shadowAnimation = new Animation(Graphics, new SpriteSheet(ContentPaths.Effects.shadowcircle), "sh", 32, 32, shP, false, Color.Black, 1, 0.7f, 0.7f, false);

            Shadow.AddAnimation(shadowAnimation);
            shadowAnimation.Play();
            Shadow.SetCurrentAnimation("sh");
            Physics.Tags.Add("Dwarf");

            DeathParticleTrigger = new ParticleTrigger("blood_particle", Manager, "Death Gibs", Physics, Matrix.Identity, Vector3.One, Vector3.Zero)
            {
                TriggerOnDeath  = true,
                TriggerAmount   = 1,
                BoxTriggerTimes = 10,
                SoundToPlay     = ContentPaths.Entities.Dwarf.Audio.dwarfhurt1,
            };
            Flames = new Flammable(Manager, "Flames", Physics, this);

            NoiseMaker.Noises["Hurt"] = new List <string>
            {
                ContentPaths.Entities.Dwarf.Audio.dwarfhurt1,
                ContentPaths.Entities.Dwarf.Audio.dwarfhurt2,
                ContentPaths.Entities.Dwarf.Audio.dwarfhurt3,
                ContentPaths.Entities.Dwarf.Audio.dwarfhurt4,
            };

            NoiseMaker.Noises["Ok"] = new List <string>()
            {
                ContentPaths.Audio.ok0,
                ContentPaths.Audio.ok1,
                ContentPaths.Audio.ok2
            };


            NoiseMaker.Noises["Chew"] = new List <string>
            {
                ContentPaths.Audio.chew
            };

            NoiseMaker.Noises["Jump"] = new List <string>
            {
                ContentPaths.Audio.jump
            };

            MinimapIcon minimapIcon = new MinimapIcon(Physics, new NamedImageFrame(ContentPaths.GUI.map_icons, 16, 0, 0));

            Stats.FullName            = TextGenerator.GenerateRandom("$firstname", " ", "$lastname");
            Stats.Size                = 5;
            Stats.CanSleep            = true;
            Stats.CanEat              = true;
            AI.Movement.CanClimbWalls = true;
            AI.Movement.SetCost(MoveType.ClimbWalls, 50.0f);
            AI.Movement.SetSpeed(MoveType.ClimbWalls, 0.15f);
            AI.TriggersMourning = true;
        }
示例#14
0
 public Dwarf(ComponentManager manager, 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("Dwarf", 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;
     HasBones = false;
     Initialize(workerClass);
 }
示例#15
0
文件: Fairy.cs 项目: scorvi/dwarfcorp
        public void Initialize(EmployeeClass dwarfClass)
        {
            Physics.Orientation = Physics.OrientMode.RotateY;
            Sprite = new CharacterSprite(Graphics, Manager, "Fairy Sprite", Physics, Matrix.CreateTranslation(new Vector3(0, 0.5f, 0)));
            foreach (Animation animation in dwarfClass.Animations)
            {
                Sprite.AddAnimation(animation.Clone());
            }
            Sprite.LightsWithVoxels = false;

            Hands = new Grabber("hands", Physics, Matrix.Identity, new Vector3(0.1f, 0.1f, 0.1f), Vector3.Zero);

            Sensors = new EnemySensor(Manager, "EnemySensor", Physics, Matrix.Identity, new Vector3(20, 5, 20), Vector3.Zero);

            AI = new CreatureAI(this, "Fairy AI", Sensors, PlanService);

            Attacks = new List<Attack>() { new Attack(Stats.CurrentClass.Attacks[0]) };

            Inventory = new Inventory("Inventory", Physics)
            {
                Resources = new ResourceContainer
                {
                    MaxResources = 128
                }
            };

            Matrix shadowTransform = Matrix.CreateRotationX((float)Math.PI * 0.5f);
            shadowTransform.Translation = new Vector3(0.0f, -0.5f, 0.0f);

            Shadow = new Shadow(Manager, "Shadow", Physics, shadowTransform, new SpriteSheet(ContentPaths.Effects.shadowcircle));
            List<Point> shP = new List<Point>
            {
                new Point(0, 0)
            };
            Animation shadowAnimation = new Animation(Graphics, new SpriteSheet(ContentPaths.Effects.shadowcircle), "sh", 32, 32, shP, false, Color.Black, 1, 0.7f, 0.7f, false);
            Shadow.AddAnimation(shadowAnimation);
            shadowAnimation.Play();
            Shadow.SetCurrentAnimation("sh");
            Physics.Tags.Add("Dwarf");

            DeathParticleTrigger = new ParticleTrigger("star_particle", Manager, "Death Gibs", Physics, Matrix.Identity, Vector3.One, Vector3.Zero)
            {
                TriggerOnDeath = true,
                TriggerAmount = 5,
                SoundToPlay = ContentPaths.Audio.wurp,
            };

            NoiseMaker.Noises["Hurt"] = new List<string>
            {
                ContentPaths.Audio.tinkle
            };

            NoiseMaker.Noises["Chew"] = new List<string>
            {
                ContentPaths.Audio.tinkle
            };

            NoiseMaker.Noises["Jump"] = new List<string>
            {
                ContentPaths.Audio.tinkle
            };

            MinimapIcon minimapIcon = new MinimapIcon(Physics, new ImageFrame(TextureManager.GetTexture(ContentPaths.GUI.map_icons), 16, 0, 0));

            //new LightEmitter("Light Emitter", Sprite, Matrix.Identity, Vector3.One, Vector3.One, 255, 150);
            new Bobber(0.25f, 3.0f, MathFunctions.Rand(), Sprite);

            Stats.FullName = TextGenerator.GenerateRandom("$firstname");
            //Stats.LastName = "The Fairy";

            Stats.CanSleep = false;
            Stats.CanEat = false;
        }