public static Body CreateBalloon(Vector3 target, Vector3 position, ComponentManager componentManager, ContentManager content, GraphicsDevice graphics, ShipmentOrder order, Faction master) { Body balloon = new Body("Balloon", componentManager.RootComponent, Matrix.CreateTranslation(position), new Vector3(0.5f, 1, 0.5f), new Vector3(0, -2, 0)); SpriteSheet tex = new SpriteSheet(ContentPaths.Entities.Balloon.Sprites.balloon); List <Point> points = new List <Point> { new Point(0, 0) }; Animation balloonAnimation = new Animation(graphics, new SpriteSheet(ContentPaths.Entities.Balloon.Sprites.balloon), "balloon", points, false, Color.White, 0.001f, false); Sprite sprite = new Sprite(componentManager, "sprite", balloon, Matrix.Identity, tex, false) { OrientationType = Sprite.OrientMode.Spherical }; sprite.AddAnimation(balloonAnimation); Matrix shadowTransform = Matrix.CreateRotationX((float)Math.PI * 0.5f); Shadow shadow = new Shadow(componentManager, "shadow", balloon, shadowTransform, new SpriteSheet(ContentPaths.Effects.shadowcircle)); BalloonAI balloonAI = new BalloonAI(balloon, target, order, master); MinimapIcon minimapIcon = new MinimapIcon(balloon, new ImageFrame(TextureManager.GetTexture(ContentPaths.GUI.map_icons), 16, 2, 0)); return(balloon); }
public static void RemoveMinimapIcon(MinimapIcon icon) { lock (minimapIcons) { if (minimapIcons.Contains(icon)) { minimapIcons.Remove(icon); } } }
public static void AddMinimapIcon(MinimapIcon newIcon) { lock (minimapIcons) { if (minimapIcons.Contains(newIcon)) { return; } minimapIcons.Add(newIcon); } }
private static void RemoveMinimapIcon(GameComponent icon) { System.Diagnostics.Debug.Assert(icon is MinimapIcon); MinimapIcon mapIcon = icon as MinimapIcon; lock (minimapIcons) { if (minimapIcons.Contains(mapIcon)) { minimapIcons.Remove(mapIcon); } } }
private static void AddMinimapIcon(GameComponent newIcon) { System.Diagnostics.Debug.Assert(newIcon is MinimapIcon); MinimapIcon mapIcon = newIcon as MinimapIcon; lock (minimapIcons) { if (minimapIcons.Contains(mapIcon)) { return; } minimapIcons.Add(mapIcon); } }
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); AI.Movement.SetCan(MoveType.Dig, true); Species = "Fairy"; }
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 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.Movement.CanClimbWalls = true; AI.Movement.SetCost(MoveType.ClimbWalls, 50.0f); AI.Movement.SetSpeed(MoveType.ClimbWalls, 0.15f); AI.TriggersMourning = true; }
public void Initialize() { Physics.Orientation = Physics.OrientMode.RotateY; Sprite = new CharacterSprite(Graphics, Manager, "Goblin Sprite", Physics, Matrix.CreateTranslation(new Vector3(0, 0.1f, 0))); foreach (Animation animation in Stats.CurrentClass.Animations) { Sprite.AddAnimation(animation.Clone()); } HasMeat = false; HasBones = 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, "Goblin AI", Sensors, PlanService); Attacks = new List <Attack>() { new Attack(Stats.CurrentClass.Attacks[0]) }; Inventory = new Inventory("Inventory", Physics) { Resources = new ResourceContainer { MaxResources = 16 } }; Matrix shadowTransform = Matrix.CreateRotationX((float)Math.PI * 0.5f); shadowTransform.Translation = new Vector3(0.0f, -0.5f, 0.0f); SpriteSheet shadowTexture = new SpriteSheet(ContentPaths.Effects.shadowcircle); Shadow = new Shadow(Manager, "Shadow", Physics, shadowTransform, shadowTexture); 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("Goblin"); DeathParticleTrigger = new ParticleTrigger("blood_particle", Manager, "Death Gibs", Physics, Matrix.Identity, Vector3.One, Vector3.Zero) { TriggerOnDeath = true, TriggerAmount = 3, SoundToPlay = ContentPaths.Entities.Goblin.Audio.goblinhurt1 }; Flames = new Flammable(Manager, "Flames", Physics, this); NoiseMaker.Noises["Hurt"] = new List <string> { ContentPaths.Entities.Goblin.Audio.goblinhurt1, ContentPaths.Entities.Goblin.Audio.goblinhurt2, ContentPaths.Entities.Goblin.Audio.goblinhurt3, ContentPaths.Entities.Goblin.Audio.goblinhurt4, }; MinimapIcon minimapIcon = new MinimapIcon(Physics, new ImageFrame(TextureManager.GetTexture(ContentPaths.GUI.map_icons), 16, 3, 0)); NoiseMaker.Noises["Chew"] = new List <string> { ContentPaths.Audio.chew }; NoiseMaker.Noises["Jump"] = new List <string> { ContentPaths.Audio.jump }; Stats.FullName = TextGenerator.GenerateRandom("$goblinname"); //Stats.LastName = TextGenerator.GenerateRandom("$goblinfamily"); Stats.Size = 4; }
public void Initialize() { Physics.Orientation = Physics.OrientMode.RotateY; Sprite = new CharacterSprite(Graphics, Manager, "Elf Sprite", Physics, Matrix.CreateTranslation(new Vector3(0, 0.35f, 0))); foreach (Animation animation in Stats.CurrentClass.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, new Vector3(20, 5, 20), Vector3.Zero); AI = new CreatureAI(this, "Elf AI", Sensors, PlanService); Attacks = new List<Attack>() { new Attack(Stats.CurrentClass.Attacks[0]) }; Inventory = new Inventory("Inventory", Physics) { Resources = new ResourceContainer { MaxResources = 16 } }; Matrix shadowTransform = Matrix.CreateRotationX((float)Math.PI * 0.5f); shadowTransform.Translation = new Vector3(0.0f, -0.5f, 0.0f); SpriteSheet shadowTexture = new SpriteSheet(ContentPaths.Effects.shadowcircle); Shadow = new Shadow(Manager, "Shadow", Physics, shadowTransform, shadowTexture); 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("Goblin"); DeathParticleTrigger = new ParticleTrigger("blood_particle", Manager, "Death Gibs", Physics, Matrix.Identity, Vector3.One, Vector3.Zero) { TriggerOnDeath = true, TriggerAmount = 5, SoundToPlay = ContentPaths.Entities.Goblin.Audio.goblinhurt1 }; Flames = new Flammable(Manager, "Flames", Physics, this); NoiseMaker.Noises["Hurt"] = new List<string> { ContentPaths.Entities.Goblin.Audio.goblinhurt1, ContentPaths.Entities.Goblin.Audio.goblinhurt2, ContentPaths.Entities.Goblin.Audio.goblinhurt3, ContentPaths.Entities.Goblin.Audio.goblinhurt4, }; MinimapIcon minimapIcon = new MinimapIcon(Physics, new ImageFrame(TextureManager.GetTexture(ContentPaths.GUI.map_icons), 16, 3, 0)); NoiseMaker.Noises["Chew"] = new List<string> { ContentPaths.Audio.chew }; NoiseMaker.Noises["Jump"] = new List<string> { ContentPaths.Audio.jump }; Stats.FullName = TextGenerator.GenerateRandom("$elfname"); //Stats.LastName = TextGenerator.GenerateRandom("$elffamily"); Stats.Size = 4; }
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); if (AI.Stats.IsTaskAllowed(Task.TaskCategory.Dig)) { AI.Movement.SetCan(MoveType.Dig, true); } 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")); }
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; }
public void Initialize() { Physics.Orientation = Physics.OrientMode.RotateY; CreateSprite(Stats.CurrentClass, Manager); Physics.AddChild(new EnemySensor(Manager, "EnemySensor", Matrix.Identity, new Vector3(20, 5, 20), Vector3.Zero)); Physics.AddChild(new PacingCreatureAI(Manager, "Demon AI", Sensors, PlanService) { Movement = { CanFly = true, CanSwim = false, CanDig = true } }); 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("Demon"); Physics.AddChild(new ParticleTrigger("blood_particle", Manager, "Death Gibs", Matrix.Identity, Vector3.One, Vector3.Zero) { TriggerOnDeath = true, TriggerAmount = 5, SoundToPlay = ContentPaths.Audio.Oscar.sfx_ic_demon_death }); NoiseMaker.Noises["Hurt"] = new List <string> { ContentPaths.Audio.Oscar.sfx_ic_demon_hurt_1, ContentPaths.Audio.Oscar.sfx_ic_demon_hurt_2, }; MinimapIcon minimapIcon = Physics.AddChild(new MinimapIcon(Manager, new NamedImageFrame(ContentPaths.GUI.map_icons, 16, 3, 1))) as MinimapIcon; NoiseMaker.Noises["Chew"] = new List <string> { ContentPaths.Audio.chew }; NoiseMaker.Noises["Jump"] = new List <string> { ContentPaths.Audio.Oscar.sfx_ic_demon_angered, }; NoiseMaker.Noises["Flap"] = new List <string> { ContentPaths.Audio.Oscar.sfx_ic_demon_flap_wings_1, ContentPaths.Audio.Oscar.sfx_ic_demon_flap_wings_2, ContentPaths.Audio.Oscar.sfx_ic_demon_flap_wings_3, }; NoiseMaker.Noises["Chirp"] = new List <string> { ContentPaths.Audio.Oscar.sfx_ic_demon_mumble_1, ContentPaths.Audio.Oscar.sfx_ic_demon_mumble_2, ContentPaths.Audio.Oscar.sfx_ic_demon_mumble_3, ContentPaths.Audio.Oscar.sfx_ic_demon_mumble_4, ContentPaths.Audio.Oscar.sfx_ic_demon_mumble_5, ContentPaths.Audio.Oscar.sfx_ic_demon_mumble_6, ContentPaths.Audio.Oscar.sfx_ic_demon_pleased, }; Stats.FullName = TextGenerator.GenerateRandom("$goblinname"); //Stats.LastName = TextGenerator.GenerateRandom("$elffamily"); Stats.Size = 4; Species = "Demon"; }
public void Initialize() { HasMeat = false; HasBones = false; Physics.Orientation = Physics.OrientMode.RotateY; Sprite = new CharacterSprite(Graphics, Manager, "MudGolem Sprite", Physics, Matrix.CreateTranslation(new Vector3(0, 0.35f, 0))); foreach (Animation animation in Stats.CurrentClass.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, new Vector3(20, 5, 20), Vector3.Zero); AI = new MudGolemAI(this, Sensors, Manager.World.PlanService) { Movement = { IsSessile = true, CanFly = false, CanSwim = false, CanWalk = false, CanClimb = false, CanClimbWalls = false } }; Attacks = new List <Attack>() { new Attack(Stats.CurrentClass.Attacks[0]) }; Inventory = new Inventory("Inventory", Physics) { Resources = new ResourceContainer { MaxResources = 16 } }; var gems = ResourceLibrary.GetResourcesByTag(Resource.ResourceTags.Gem); for (int i = 0; i < 16; i++) { int num = MathFunctions.RandInt(1, 32 - i); Inventory.Resources.AddResource(new ResourceAmount(Datastructures.SelectRandom(gems), num)); i += num - 1; } Matrix shadowTransform = Matrix.CreateRotationX((float)Math.PI * 0.5f); shadowTransform.Translation = new Vector3(0.0f, -0.5f, 0.0f); Physics.Tags.Add("MudGolem"); Physics.Mass = 100; DeathParticleTrigger = new ParticleTrigger("dirt_particle", Manager, "Death Gibs", Physics, Matrix.Identity, Vector3.One, Vector3.Zero) { TriggerOnDeath = true, TriggerAmount = 5, SoundToPlay = ContentPaths.Audio.gravel }; NoiseMaker.Noises["Hurt"] = new List <string> { ContentPaths.Audio.demon0, ContentPaths.Audio.gravel, }; MinimapIcon minimapIcon = new MinimapIcon(Physics, new NamedImageFrame(ContentPaths.GUI.map_icons, 16, 3, 0)); NoiseMaker.Noises["Chew"] = new List <string> { ContentPaths.Audio.chew }; Stats.FullName = TextGenerator.GenerateRandom("$goblinname"); //Stats.LastName = TextGenerator.GenerateRandom("$elffamily"); Stats.Size = 4; Resistances[DamageType.Fire] = 5; Resistances[DamageType.Acid] = 5; Resistances[DamageType.Cold] = 5; }
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; }
public Creature(Vector3 pos, CreatureDef def, string creatureClass, int creatureLevel, string faction) : this(new CreatureStats(EmployeeClass.Classes[creatureClass], creatureLevel), faction, PlayState.PlanService, PlayState.ComponentManager.Factions.Factions[faction], new Physics(def.Name, PlayState.ComponentManager.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), PlayState.ChunkManager, GameState.Game.GraphicsDevice, GameState.Game.Content, def.Name) { 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 }; 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.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}; MinimapIcon minimapIcon = new MinimapIcon(Physics, def.MinimapIcon); Stats.FullName = TextGenerator.GenerateRandom(PlayState.ComponentManager.Factions.Races[def.Race].NameTemplates); Stats.CanSleep = def.CanSleep; Stats.CanEat = def.CanEat; AI.TriggersMourning = def.TriggersMourning; }
public Creature(Vector3 pos, CreatureDef def, string creatureClass, int creatureLevel, string faction) : this(new CreatureStats(EmployeeClass.Classes[creatureClass], creatureLevel), faction, PlayState.PlanService, PlayState.ComponentManager.Factions.Factions[faction], new Physics(def.Name, PlayState.ComponentManager.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), PlayState.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 }; 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.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 }; MinimapIcon minimapIcon = new MinimapIcon(Physics, def.MinimapIcon); Stats.FullName = TextGenerator.GenerateRandom(PlayState.ComponentManager.Factions.Races[def.Race].NameTemplates); Stats.CanSleep = def.CanSleep; Stats.CanEat = def.CanEat; AI.TriggersMourning = def.TriggersMourning; }
public void Initialize(EmployeeClass dwarfClass) { Gender = Mating.RandomGender(); Physics.Orientation = Physics.OrientMode.RotateY; CreateSprite(dwarfClass, Manager); Hands = Physics.AddChild(new Grabber("hands", Manager, Matrix.Identity, new Vector3(0.1f, 0.1f, 0.1f), Vector3.Zero)) as Grabber; Sensors = Physics.AddChild(new EnemySensor(Manager, "EnemySensor", Matrix.Identity, new Vector3(20, 5, 20), Vector3.Zero)) as EnemySensor; AI = Physics.AddChild(new CreatureAI(Manager, "Dwarf AI", Sensors, PlanService)) as CreatureAI; Attacks = new List <Attack>() { new Attack(Stats.CurrentClass.Attacks[0]) }; Inventory = Physics.AddChild(new Inventory(Manager, "Inventory", Physics.BoundingBox.Extents(), Physics.BoundingBoxPos)) as Inventory; 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; AI.Movement.CanClimbWalls = true; AI.Movement.SetCost(MoveType.ClimbWalls, 50.0f); AI.Movement.SetSpeed(MoveType.ClimbWalls, 0.15f); AI.TriggersMourning = true; AI.Biography = Applicant.GenerateBiography(AI.Stats.FullName, Gender); Species = "Dwarf"; }
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; }