public override void CreateCosmeticChildren(ComponentManager manager) { CreateSprite(SpriteAsset, manager, 0.35f); Physics.AddChild(Shadow.Create(0.3f, manager)); base.CreateCosmeticChildren(manager); }
public override void CreateCosmeticChildren(ComponentManager manager) { CreateDwarfSprite(Stats.CurrentClass, manager); Physics.AddChild(Shadow.Create(0.75f, manager)); Physics.AddChild(new VoxelRevealer(manager, Physics, 5)).SetFlag(Flag.ShouldSerialize, false); Physics.AddChild(new MinimapIcon(Manager, new NamedImageFrame(ContentPaths.GUI.map_icons, 16, 0, 0))).SetFlag(Flag.ShouldSerialize, false); NoiseMaker = new NoiseMaker(); 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 }; 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, }).SetFlag(Flag.ShouldSerialize, false); if (Equipment.HasValue(out var equipment) && GetRoot().GetComponent <DwarfSprites.LayeredCharacterSprite>().HasValue(out var sprite)) { equipment.AddLayersToSprite(sprite); } base.CreateCosmeticChildren(manager); }
/// <summary> /// Initialize function creates all the required components for the bird. /// </summary> /// <param name="sprites">The sprite sheet to use for the bird</param> public void Initialize(string sprites) { SpriteAsset = sprites; // When true, causes the bird to face the direction its moving in Physics.Orientation = Physics.OrientMode.RotateY; CreateSprite(sprites, Manager, 0.6f); // Used to sense hostile creatures Physics.AddChild(new EnemySensor(Manager, "EnemySensor", Matrix.Identity, new Vector3(20, 5, 20), Vector3.Zero)); // Controls the behavior of the creature Physics.AddChild(new PacingCreatureAI(Manager, "Chimp AI", Sensors, PlanService)); // The bird can peck at its enemies (0.1 damage) Attacks = new List <Attack> { new Attack("Hit", 5.0f, 0.5f, 2.0f, SoundSource.Create(ContentPaths.Audio.Oscar.sfx_oc_rabbit_attack), ContentPaths.Effects.hit) { DiseaseToSpread = "Rabies", TriggerMode = Attack.AttackTrigger.Animation, TriggerFrame = 2 } }; // The bird can hold one item at a time in its inventory Physics.AddChild(new Inventory(Manager, "Inventory", Physics.BoundingBox.Extents(), Physics.LocalBoundingBoxOffset)); Physics.AddChild(Shadow.Create(0.5f, Manager)); // The bird will emit a shower of blood when it dies Physics.AddChild(new ParticleTrigger("blood_particle", Manager, "Death Gibs", Matrix.Identity, Vector3.One, Vector3.Zero) { TriggerOnDeath = true, TriggerAmount = 1 }); // The bird is flammable, and can die when exposed to fire. Physics.AddChild(new Flammable(Manager, "Flames")); // Tag the physics component with some information // that can be used later Physics.Tags.Add("Chimp"); Physics.Tags.Add("Animal"); Physics.Tags.Add("DomesticAnimal"); Stats.FullName = TextGenerator.GenerateRandom("$firstname") + " the Chimp"; Stats.CurrentClass = new EmployeeClass() { Name = "Chimp", Levels = new List <EmployeeClass.Level>() { new EmployeeClass.Level() { Index = 0, Name = "Chimp" } } }; NoiseMaker.Noises["Hurt"] = new List <string>() { ContentPaths.Audio.Oscar.sfx_oc_rabbit_hurt_1, ContentPaths.Audio.Oscar.sfx_oc_rabbit_hurt_2 }; NoiseMaker.Noises["Chirp"] = new List <string>() { ContentPaths.Audio.Oscar.sfx_oc_rabbit_neutral_1, ContentPaths.Audio.Oscar.sfx_oc_rabbit_neutral_2 }; Species = "Chimp"; CanReproduce = true; BabyType = Name; var deathParticleTrigger = Parent.EnumerateAll().OfType <ParticleTrigger>().FirstOrDefault(); if (deathParticleTrigger != null) { deathParticleTrigger.SoundToPlay = NoiseMaker.Noises["Hurt"][0]; } AI.Movement.SetCan(MoveType.ClimbWalls, true); }
public override void CreateCosmeticChildren(ComponentManager manager) { CreateSprite(ContentPaths.Entities.Animals.fowl[Species], manager); Physics.AddChild(Shadow.Create(0.5f, manager)); base.CreateCosmeticChildren(manager); }
/// <summary> /// Initialize function creates all the required components for the bird. /// </summary> /// <param name="sprites">The sprite sheet to use for the bird</param> /// <param name="species"></param> public void Initialize(string sprites, string species) { // When true, causes the bird to face the direction its moving in Physics.Orientation = Physics.OrientMode.RotateY; CreateSprite(ContentPaths.Entities.Animals.fowl[Species], Manager); // Used to sense hostile creatures Physics.AddChild(new EnemySensor(Manager, "EnemySensor", Matrix.Identity, new Vector3(20, 5, 20), Vector3.Zero)); // Controls the behavior of the creature Physics.AddChild(new PacingCreatureAI(Manager, "AI", Sensors)); // The bird can peck at its enemies (0.1 damage) Attacks = new List <Attack> { new Attack("Peck", 0.01f, 2.0f, 0.5f, SoundSource.Create(ContentPaths.Audio.Oscar.sfx_oc_chicken_attack), ContentPaths.Effects.pierce) { Mode = Attack.AttackMode.Melee, TriggerFrame = 2, TriggerMode = Attack.AttackTrigger.Animation } }; // The bird can hold one item at a time in its inventory Physics.AddChild(new Inventory(Manager, "Inventory", Physics.BoundingBox.Extents(), Physics.LocalBoundingBoxOffset)); Physics.AddChild(Shadow.Create(0.5f, Manager)); // The bird will emit a shower of blood when it dies Physics.AddChild(new ParticleTrigger("blood_particle", Manager, "Death Gibs", Matrix.Identity, Vector3.One, Vector3.Zero) { TriggerOnDeath = true, TriggerAmount = 1 }); Physics.AddChild(new ParticleTrigger("feather", Manager, "Death Gibs", Matrix.Identity, Vector3.One, Vector3.Zero) { TriggerOnDeath = true, TriggerAmount = 10 }); // The bird is flammable, and can die when exposed to fire. Physics.AddChild(new Flammable(Manager, "Flames")); // Tag the physics component with some information // that can be used later Physics.Tags.Add(species); Physics.Tags.Add("Animal"); Physics.Tags.Add("DomesticAnimal"); Stats.FullName = TextGenerator.GenerateRandom("$firstname") + " the " + species; Stats.CurrentClass = new EmployeeClass() { Name = species, Levels = new List <EmployeeClass.Level>() { new EmployeeClass.Level() { Index = 0, Name = species } } }; NoiseMaker.Noises["Hurt"] = new List <string>() { ContentPaths.Audio.Oscar.sfx_oc_chicken_hurt_1, ContentPaths.Audio.Oscar.sfx_oc_chicken_hurt_2 }; NoiseMaker.Noises["Chirp"] = new List <string>() { ContentPaths.Audio.Oscar.sfx_oc_chicken_neutral_1, ContentPaths.Audio.Oscar.sfx_oc_chicken_neutral_2 }; NoiseMaker.Noises["Lay Egg"] = new List <string>() { ContentPaths.Audio.Oscar.sfx_oc_chicken_lay_egg }; Species = species; var deathParticleTrigger = Parent.EnumerateAll().OfType <ParticleTrigger>().FirstOrDefault(); if (deathParticleTrigger != null) { deathParticleTrigger.SoundToPlay = NoiseMaker.Noises["Hurt"][0]; } }
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) { 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(string blood) { HasMeat = false; HasBones = false; Physics.Orientation = Physics.OrientMode.RotateY; CreateSprite(Stats.CurrentClass, Manager, 0.5f); Physics.AddChild(new EnemySensor(Manager, "EnemySensor", Matrix.Identity, new Vector3(20, 5, 20), Vector3.Zero)); Physics.AddChild(new MudGolemAI(Manager, 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]) }; Physics.AddChild(new Inventory(Manager, "Inventory", Physics.BoundingBox.Extents(), Physics.LocalBoundingBoxOffset)); var gems = ResourceLibrary.GetResourcesByTag(Resource.ResourceTags.Gem); for (int i = 0; i < 16; i++) { int num = MathFunctions.RandInt(1, 32 - i); Inventory.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; Physics.AddChild(new ParticleTrigger(blood, Manager, "Death Gibs", 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, }; Physics.AddChild(new MinimapIcon(Manager, new NamedImageFrame(ContentPaths.GUI.map_icons, 16, 2, 1))); 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; Species = "Mud Golem"; }
public override void CreateCosmeticChildren(ComponentManager Manager) { CreateSprite(ContentPaths.Entities.Animals.Snake.snake_animation, Manager, 0.35f); #region Create Tail Pieces Tail = new List <TailSegment>(); var tailAnimations = Library.LoadCompositeAnimationSet(ContentPaths.Entities.Animals.Snake.tail_animation, "Snake"); for (int i = 0; i < 10; ++i) { var tailPiece = new CharacterSprite(Manager, "Sprite", Matrix.CreateTranslation(0, 0.25f, 0)); tailPiece.SetAnimations(tailAnimations); tailPiece.SetFlag(Flag.ShouldSerialize, false); tailPiece.Name = "Snake Tail"; Tail.Add( new TailSegment() { Sprite = Manager.RootComponent.AddChild(tailPiece) as GameComponent, Target = Physics.LocalTransform.Translation }); tailPiece.AddChild(new Shadow(Manager)); var inventory = tailPiece.AddChild(new Inventory(Manager, "Inventory", Physics.BoundingBox.Extents(), Physics.LocalBoundingBoxOffset)) as Inventory; inventory.SetFlag(Flag.ShouldSerialize, false); inventory.AddResource(new Resource("Meat") { DisplayName = Stats.CurrentClass.Name + " Meat" }); inventory.AddResource(new Resource("Bone") { DisplayName = Stats.CurrentClass.Name + " Bone" }); } #endregion Physics.AddChild(Shadow.Create(0.75f, Manager)); Physics.AddChild(new MinimapIcon(Manager, new NamedImageFrame(ContentPaths.GUI.map_icons, 16, 2, 4))).SetFlag(Flag.ShouldSerialize, false); NoiseMaker = new NoiseMaker(); NoiseMaker.Noises["Hurt"] = new List <string>() { ContentPaths.Audio.Oscar.sfx_oc_giant_snake_hurt_1 }; NoiseMaker.Noises["Chirp"] = new List <string>() { ContentPaths.Audio.Oscar.sfx_oc_giant_snake_neutral_1, ContentPaths.Audio.Oscar.sfx_oc_giant_snake_neutral_2 }; Physics.AddChild(new ParticleTrigger("blood_particle", Manager, "Death Gibs", Matrix.Identity, Vector3.One, Vector3.Zero) { TriggerOnDeath = true, TriggerAmount = 1, BoxTriggerTimes = 10, SoundToPlay = ContentPaths.Audio.Oscar.sfx_oc_giant_snake_hurt_1, }).SetFlag(Flag.ShouldSerialize, false); base.CreateCosmeticChildren(Manager); }
/// <summary> /// Initialize function creates all the required components for the bird. /// </summary> /// <param name="sprites">The sprite sheet to use for the bird</param> public void Initialize(string sprites) { SpriteAsset = sprites; HasBones = false; // When true, causes the bird to face the direction its moving in Physics.Orientation = Physics.OrientMode.RotateY; CreateSprite(sprites, Manager); // Used to grab other components Hands = Physics.AddChild(new Grabber("hands", Manager, Matrix.Identity, new Vector3(0.2f, 0.2f, 0.2f), Vector3.Zero)) as Grabber; // Used to sense hostile creatures Sensors = Physics.AddChild(new EnemySensor(Manager, "EnemySensor", Matrix.Identity, new Vector3(20, 5, 20), Vector3.Zero)) as EnemySensor; // Controls the behavior of the creature AI = Physics.AddChild(new PacingCreatureAI(Manager, "Spider AI", Sensors, PlanService)) as CreatureAI; // The bird can peck at its enemies (0.1 damage) Attacks = new List <Attack> { new Attack("Sting", 0.01f, 1.0f, 3.0f, SoundSource.Create(ContentPaths.Audio.Oscar.sfx_oc_giant_spider_attack_1, ContentPaths.Audio.Oscar.sfx_oc_giant_spider_attack_2), ContentPaths.Effects.bite), new Attack("Web", 0.0f, 1.0f, 5.0f, SoundSource.Create(ContentPaths.Audio.Oscar.sfx_oc_giant_spider_attack_1, ContentPaths.Audio.Oscar.sfx_oc_giant_spider_attack_2), ContentPaths.Effects.claws) { Mode = Attack.AttackMode.Ranged, LaunchSpeed = 10, ProjectileType = "Web" } }; // The bird can hold one item at a time in its inventory Inventory = Physics.AddChild(new Inventory(Manager, "Inventory", Physics.BoundingBox.Extents(), Physics.BoundingBoxPos)) as Inventory; Physics.AddChild(Shadow.Create(0.25f, Manager)); // The bird will emit a shower of blood when it dies Physics.AddChild(new ParticleTrigger("blood_particle", Manager, "Death Gibs", Matrix.Identity, Vector3.One, Vector3.Zero) { TriggerOnDeath = true, TriggerAmount = 1 }); // The bird is flammable, and can die when exposed to fire. Physics.AddChild(new Flammable(Manager, "Flames")); // Tag the physics component with some information // that can be used later Physics.Tags.Add("Spider"); Physics.Tags.Add("Animal"); Stats.FullName = TextGenerator.GenerateRandom("$firstname") + " the Spider"; Stats.CurrentClass = new EmployeeClass() { Name = "Spider", Levels = new List <EmployeeClass.Level>() { new EmployeeClass.Level() { Index = 0, Name = "Spider" } } }; NoiseMaker.Noises["Hurt"] = new List <string>() { ContentPaths.Audio.Oscar.sfx_oc_giant_spider_hurt_1 }; NoiseMaker.Noises["Chirp"] = new List <string>() { ContentPaths.Audio.Oscar.sfx_oc_giant_spider_neutral_1, ContentPaths.Audio.Oscar.sfx_oc_giant_spider_neutral_2 }; AI.Movement.CanClimbWalls = true; AI.Movement.CanSwim = false; Species = "Spider"; CanReproduce = true; BabyType = "Spider"; }
private void CreateGraphics() { Physics.AddChild(new Shadow(Manager)); var animFile = Bonesnake ? ContentPaths.Entities.Animals.Snake.bonesnake_animation : ContentPaths.Entities.Animals.Snake.snake_animation; var tailFile = Bonesnake ? ContentPaths.Entities.Animals.Snake.bonetail_animation : ContentPaths.Entities.Animals.Snake.tail_animation; var sprite = CreateSprite(animFile, Manager, 0.35f); Tail = new List <TailSegment>(); for (int i = 0; i < 10; ++i) { var tailPiece = CreateSprite(tailFile, Manager, 0.25f, false); Tail.Add( new TailSegment() { Sprite = Manager.RootComponent.AddChild(tailPiece) as Body, Target = Physics.LocalTransform.Translation }); tailPiece.AddChild(new Shadow(Manager)); var inventory = tailPiece.AddChild(new Inventory(Manager, "Inventory", Physics.BoundingBox.Extents(), Physics.LocalBoundingBoxOffset)) as Inventory; inventory.SetFlag(Flag.ShouldSerialize, false); if (HasMeat) { ResourceType type = Species + " " + ResourceType.Meat; if (!ResourceLibrary.Resources.ContainsKey(type)) { ResourceLibrary.Add(new Resource(ResourceLibrary.Resources[ResourceType.Meat]) { Name = type, ShortName = type }); } inventory.AddResource(new ResourceAmount(type, 1)); } if (HasBones) { ResourceType type = Name + " " + ResourceType.Bones; if (!ResourceLibrary.Resources.ContainsKey(type)) { ResourceLibrary.Add(new Resource(ResourceLibrary.Resources[ResourceType.Bones]) { Name = type, ShortName = type }); } inventory.AddResource(new ResourceAmount(type, 1)); } } }
public Bird(string sprites, Vector3 position, ComponentManager manager, string name) : base ( manager, new CreatureStats { Dexterity = 6, Constitution = 1, Strength = 1, Wisdom = 1, Charisma = 1, Intelligence = 1, Size = 0.25f, CanSleep = false, LaysEggs = true, IsMigratory = true }, "Herbivore", manager.World.PlanService, manager.World.Factions.Factions["Herbivore"], name ) { Physics = new Physics ( manager, "A Bird", Matrix.CreateTranslation(position), new Vector3(0.25f, 0.25f, 0.25f), new Vector3(0.0f, 0.0f, 0.0f), 1.0f, 1.0f, 0.999f, 0.999f, new Vector3(0, -10, 0) ); Physics.Orientation = Physics.OrientMode.RotateY; Physics.AddChild(this); SpriteAsset = sprites; BaseMeatResource = "Bird Meat"; CreateSprite(ContentPaths.Entities.Animals.Birds.GetBirdAnimations(SpriteAsset), Manager); // Used to sense hostile creatures Physics.AddChild(new EnemySensor(Manager, "EnemySensor", Matrix.Identity, new Vector3(20, 5, 20), Vector3.Zero)); // Controls the behavior of the creature Physics.AddChild(new BirdAI(Manager, "Bird AI", Sensors, PlanService)); // The bird can peck at its enemies (0.1 damage) Attacks = new List <Attack> { new Attack("Peck", 0.1f, 2.0f, 1.0f, SoundSource.Create(ContentPaths.Audio.Oscar.sfx_oc_bird_attack), ContentPaths.Effects.pierce) { Mode = Attack.AttackMode.Dogfight } }; // The bird can hold one item at a time in its inventory Physics.AddChild(new Inventory(Manager, "Inventory", Physics.BoundingBox.Extents(), Physics.LocalBoundingBoxOffset)); Physics.AddChild(Shadow.Create(0.25f, Manager)); // The bird will emit a shower of blood when it dies Physics.AddChild(new ParticleTrigger("blood_particle", Manager, "Death Gibs", Matrix.Identity, Vector3.One, Vector3.Zero) { TriggerOnDeath = true, TriggerAmount = 1, SoundToPlay = ContentPaths.Audio.Oscar.sfx_oc_bird_hurt }); // The bird is flammable, and can die when exposed to fire. Physics.AddChild(new Flammable(Manager, "Flames")); // Tag the physics component with some information // that can be used later Physics.Tags.Add("Bird"); Physics.Tags.Add("Animal"); Physics.Tags.Add("DomesticAnimal"); NoiseMaker.Noises.Add("chirp", new List <string>() { ContentPaths.Audio.Oscar.sfx_oc_bird_neutral_1, ContentPaths.Audio.Oscar.sfx_oc_bird_neutral_2 }); NoiseMaker.Noises["Hurt"] = new List <string>() { ContentPaths.Audio.Oscar.sfx_oc_bird_hurt }; NoiseMaker.Noises["Lay Egg"] = new List <string>() { ContentPaths.Audio.Oscar.sfx_oc_bird_lay_egg }; Stats.FullName = TextGenerator.GenerateRandom("$firstname") + " the bird"; Stats.CurrentClass = new EmployeeClass() { Name = "Bird", Levels = new List <EmployeeClass.Level>() { new EmployeeClass.Level() { Index = 0, Name = "Bird" } } }; AI.Movement.CanFly = true; AI.Movement.CanWalk = false; AI.Movement.CanClimb = false; Species = "Bird"; }
public void Initialize() { Physics.Orientation = Physics.OrientMode.Fixed; Species = "Snake"; CreateGraphics(); // Add sensor Physics.AddChild(new EnemySensor(Manager, "EnemySensor", Matrix.Identity, new Vector3(20, 5, 20), Vector3.Zero)); // Add AI Physics.AddChild(new PacingCreatureAI(Manager, "snake AI", Sensors, PlanService)); Attacks = new List <Attack>() { new Attack("Bite", 50.0f, 1.0f, 3.0f, SoundSource.Create(ContentPaths.Audio.Oscar.sfx_oc_giant_snake_attack_1), ContentPaths.Effects.bite) { TriggerMode = Attack.AttackTrigger.Animation, TriggerFrame = 2, } }; Physics.AddChild(new Inventory(Manager, "Inventory", Physics.BoundingBox.Extents(), Physics.LocalBoundingBoxOffset)); Physics.Tags.Add("Snake"); Physics.Tags.Add("Animal"); AI.Movement.SetCan(MoveType.ClimbWalls, true); AI.Stats.FullName = "Giant Snake"; AI.Stats.CurrentClass = new EmployeeClass() { Name = "Giant Snake", Levels = new List <EmployeeClass.Level>() { new EmployeeClass.Level() { BaseStats = new CreatureStats.StatNums() { Charisma = AI.Stats.Charisma, Constitution = AI.Stats.Constitution, Dexterity = AI.Stats.Dexterity, Intelligence = AI.Stats.Intelligence, Size = AI.Stats.Size, Strength = AI.Stats.Strength, Wisdom = AI.Stats.Wisdom }, Name = "Giant Snake", Index = 0 }, } }; AI.Stats.LevelIndex = 0; Physics.AddChild(new ParticleTrigger("blood_particle", Manager, "Death Gibs", Matrix.Identity, Vector3.One, Vector3.Zero) { TriggerOnDeath = true, TriggerAmount = 1, BoxTriggerTimes = 10, SoundToPlay = ContentPaths.Audio.Oscar.sfx_oc_giant_snake_hurt_1, }); NoiseMaker.Noises["Hurt"] = new List <string>() { ContentPaths.Audio.Oscar.sfx_oc_giant_snake_hurt_1 }; NoiseMaker.Noises["Chirp"] = new List <string>() { ContentPaths.Audio.Oscar.sfx_oc_giant_snake_neutral_1, ContentPaths.Audio.Oscar.sfx_oc_giant_snake_neutral_2 }; Physics.AddChild(new Flammable(Manager, "Flames")); }
/// <summary> /// Initialize function creates all the required components for the bat. /// </summary> public void Initialize() { // When true, causes the bird to face the direction its moving in Physics.Orientation = Physics.OrientMode.RotateY; CreateSprite(ContentPaths.Entities.Animals.Bat.bat_animations, Manager); // Used to grab other components Hands = Physics.AddChild(new Grabber("hands", Manager, Matrix.Identity, new Vector3(0.1f, 0.1f, 0.1f), Vector3.Zero)) as Grabber; // Used to sense hostile creatures Sensors = Physics.AddChild(new EnemySensor(Manager, "EnemySensor", Matrix.Identity, new Vector3(20, 5, 20), Vector3.Zero)) as EnemySensor; // Controls the behavior of the creature AI = Physics.AddChild(new BatAI(Manager, "Bat AI", Sensors, PlanService)) as BatAI; AI.Movement.CanFly = true; AI.Movement.CanSwim = false; AI.Movement.CanClimb = false; AI.Movement.CanWalk = false; // The bird can peck at its enemies (0.1 damage) Attacks = new List <Attack> { new Attack("Bite", 0.01f, 2.0f, 1.0f, ContentPaths.Audio.Oscar.sfx_oc_bat_attack_1, ContentPaths.Effects.bite) { TriggerMode = Attack.AttackTrigger.Animation, TriggerFrame = 1, Mode = Attack.AttackMode.Dogfight, DiseaseToSpread = "Rabies" } }; // The bird can hold one item at a time in its inventory Inventory = Physics.AddChild(new Inventory(Manager, "Inventory", Physics.BoundingBox.Extents(), Physics.LocalBoundingBoxOffset)) as Inventory; Physics.AddChild(Shadow.Create(0.25f, Manager)); // The bird will emit a shower of blood when it dies Physics.AddChild(new ParticleTrigger("blood_particle", Manager, "Death Gibs", Matrix.Identity, Vector3.One, Vector3.Zero) { TriggerOnDeath = true, TriggerAmount = 1 }); // The bird is flammable, and can die when exposed to fire. Physics.AddChild(new Flammable(Manager, "Flames")); // Tag the physics component with some information // that can be used later Physics.Tags.Add("Bat"); Physics.Tags.Add("Animal"); Stats.FullName = TextGenerator.GenerateRandom("$firstname") + " the bat"; Stats.CurrentClass = new EmployeeClass() { Name = "Bat", Levels = new List <EmployeeClass.Level>() { new EmployeeClass.Level() { Index = 0, Name = "Bat" } }, }; NoiseMaker.Noises["Hurt"] = new List <string>() { ContentPaths.Audio.Oscar.sfx_oc_bat_hurt_1 }; NoiseMaker.Noises["Chirp"] = new List <string>() { ContentPaths.Audio.Oscar.sfx_oc_bat_neutral_1, ContentPaths.Audio.Oscar.sfx_oc_bat_neutral_2 }; Species = "Bat"; CanReproduce = true; BabyType = "Bat"; }
public override void CreateCosmeticChildren(ComponentManager manager) { CreateSprite(ContentPaths.Entities.Animals.Bat.bat_animations, manager); Physics.AddChild(Shadow.Create(0.25f, manager)); base.CreateCosmeticChildren(manager); }
/// <summary> /// Initialize function creates all the required components for the bird. /// </summary> /// <param name="sprites">The sprite sheet to use for the bird</param> public void Initialize(string sprites) { HasBones = false; // When true, causes the bird to face the direction its moving in Physics.Orientation = Physics.OrientMode.RotateY; SpriteAsset = sprites; CreateSprite(sprites, Manager, 0.35f); Physics.AddChild(Shadow.Create(0.3f, Manager)); // Used to sense hostile creatures Physics.AddChild(new EnemySensor(Manager, "EnemySensor", Matrix.Identity, new Vector3(20, 5, 20), Vector3.Zero)); // Controls the behavior of the creature Physics.AddChild(new PacingCreatureAI(Manager, "Scorpion AI", Sensors)); // The bird can peck at its enemies (0.1 damage) Attacks = new List <Attack> { new Attack("Sting", 4.0f, 2.0f, 1.5f, SoundSource.Create(ContentPaths.Audio.Oscar.sfx_oc_scorpion_attack_1, ContentPaths.Audio.Oscar.sfx_oc_scorpion_attack_2), ContentPaths.Effects.pierce) { TriggerFrame = 2, TriggerMode = Attack.AttackTrigger.Animation } }; // The bird can hold one item at a time in its inventory Physics.AddChild(new Inventory(Manager, "Inventory", Physics.BoundingBox.Extents(), Physics.LocalBoundingBoxOffset)); // The bird will emit a shower of blood when it dies Physics.AddChild(new ParticleTrigger("blood_particle", Manager, "Death Gibs", Matrix.Identity, Vector3.One, Vector3.Zero) { TriggerOnDeath = true, TriggerAmount = 1 }); // The bird is flammable, and can die when exposed to fire. Physics.AddChild(new Flammable(Manager, "Flames")); // Tag the physics component with some information // that can be used later Physics.Tags.Add("Scorpion"); Physics.Tags.Add("Animal"); Stats.FullName = TextGenerator.GenerateRandom("$firstname") + " the Scorpion"; Stats.CurrentClass = new EmployeeClass() { Name = "Scorpion", Levels = new List <EmployeeClass.Level>() { new EmployeeClass.Level() { Index = 0, Name = "Scorpion" } } }; NoiseMaker.Noises["Hurt"] = new List <string>() { ContentPaths.Audio.Oscar.sfx_oc_scorpion_hurt_1 }; NoiseMaker.Noises["Chirp"] = new List <string>() { ContentPaths.Audio.Oscar.sfx_oc_scorpion_neutral_1, ContentPaths.Audio.Oscar.sfx_oc_scorpion_neutral_2 }; AI.Movement.CanClimbWalls = true; AI.Movement.CanSwim = false; AI.Movement.SetSpeed(MoveType.Jump, 1.5f); AI.Movement.SetSpeed(MoveType.Climb, 1.5f); AI.Movement.SetCost(MoveType.Climb, 0.1f); Species = "Scorpion"; CanReproduce = true; BabyType = "Scorpion"; }
public Scorpion(Vector3 position, ComponentManager manager, string name) : base ( manager, new CreatureStats("Scorpion", "Scorpion", 0) { CanEat = true }, manager.World.Factions.Factions["Carnivore"], name ) { Physics = new Physics ( manager, // It is called "bird" "Scorpion", // It's attached to the root component of the component manager // It is located at a position passed in as an argument Matrix.CreateTranslation(position), // It has a size of 0.25 blocks new Vector3(0.375f, 0.375f, 0.375f), // Its bounding box is located in its center new Vector3(0.0f, 0.0f, 0.0f), //It has a mass of 1, a moment of intertia of 1, and very small friction/restitution 1.0f, 1.0f, 0.999f, 0.999f, // It has a gravity of 10 blocks per second downward new Vector3(0, -10, 0) ); Physics.AddChild(this); // When true, causes the bird to face the direction its moving in Physics.Orientation = Physics.OrientMode.RotateY; CreateCosmeticChildren(Manager); // Used to sense hostile creatures Physics.AddChild(new EnemySensor(Manager, "EnemySensor", Matrix.Identity, new Vector3(5, 5, 5), Vector3.Zero)); // Controls the behavior of the creature Physics.AddChild(new PacingCreatureAI(Manager, "Scorpion AI", Sensor)); // The bird can hold one item at a time in its inventory Physics.AddChild(new Inventory(Manager, "Inventory", Physics.BoundingBox.Extents(), Physics.LocalBoundingBoxOffset)); // The bird is flammable, and can die when exposed to fire. Physics.AddChild(new Flammable(Manager, "Flames")); // Tag the physics component with some information // that can be used later Physics.Tags.Add("Scorpion"); Physics.Tags.Add("Animal"); Stats.FullName = TextGenerator.GenerateRandom("$firstname") + " the Scorpion"; AI.Movement.CanClimbWalls = true; AI.Movement.CanSwim = false; AI.Movement.SetSpeed(MoveType.Jump, 1.5f); AI.Movement.SetSpeed(MoveType.Climb, 1.5f); AI.Movement.SetCost(MoveType.Climb, 0.1f); }
public override void CreateCosmeticChildren(ComponentManager manager) { CreateSprite(Stats.CurrentClass, manager); Physics.AddChild(Shadow.Create(0.75f, manager)); base.CreateCosmeticChildren(manager); }
/// <summary> /// Initialize function creates all the required components for the bird. /// </summary> /// <param name="sprites">The sprite sheet to use for the bird</param> public void Initialize(string sprites) { // When true, causes the bird to face the direction its moving in Physics.Orientation = Physics.OrientMode.RotateY; SpriteAsset = sprites; CreateSprite(SpriteAsset, Manager, 0.35f); // Used to sense hostile creatures Physics.AddChild(new EnemySensor(Manager, "EnemySensor", Matrix.Identity, new Vector3(20, 5, 20), Vector3.Zero)); // Controls the behavior of the creature Physics.AddChild(new PacingCreatureAI(Manager, "Rabbit AI", Sensors)); // The bird can peck at its enemies (0.1 damage) Attacks = new List <Attack> { new Attack("Bite", 0.01f, 2.0f, 1.0f, SoundSource.Create(ContentPaths.Audio.Oscar.sfx_oc_frog_attack), ContentPaths.Effects.bite) }; // The bird can hold one item at a time in its inventory Physics.AddChild(new Inventory(Manager, "Inventory", Physics.BoundingBox.Extents(), Physics.LocalBoundingBoxOffset)); Physics.AddChild(Shadow.Create(0.25f, Manager)); // The bird will emit a shower of blood when it dies Physics.AddChild(new ParticleTrigger("blood_particle", Manager, "Death Gibs", Matrix.Identity, Vector3.One, Vector3.Zero) { TriggerOnDeath = true, TriggerAmount = 1, SoundToPlay = ContentPaths.Audio.Oscar.sfx_oc_frog_hurt_1 }); // The bird is flammable, and can die when exposed to fire. Physics.AddChild(new Flammable(Manager, "Flames")); // Tag the physics component with some information // that can be used later Physics.Tags.Add("Frog"); Physics.Tags.Add("Animal"); Physics.Tags.Add("DomesticAnimal"); Stats.FullName = TextGenerator.GenerateRandom("$firstname") + " the frog"; Stats.CurrentClass = new EmployeeClass() { Name = "Frog", Levels = new List <EmployeeClass.Level>() { new EmployeeClass.Level() { Index = 0, Name = "Frog" } } }; NoiseMaker.Noises["Idle"] = new List <string>() { ContentPaths.Audio.Oscar.sfx_oc_frog_neutral_1, ContentPaths.Audio.Oscar.sfx_oc_frog_neutral_2 }; NoiseMaker.Noises["Chrip"] = new List <string>() { ContentPaths.Audio.Oscar.sfx_oc_frog_neutral_1, ContentPaths.Audio.Oscar.sfx_oc_frog_neutral_2 }; NoiseMaker.Noises["Hurt"] = new List <string>() { ContentPaths.Audio.Oscar.sfx_oc_frog_hurt_1, ContentPaths.Audio.Oscar.sfx_oc_frog_hurt_2 }; Species = "Frog"; CanReproduce = true; BabyType = "Frog"; }
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)); 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 override void CreateCosmeticChildren(ComponentManager manager) { Physics.AddChild(Shadow.Create(0.75f, manager)); base.CreateCosmeticChildren(manager); }