public Bush(ComponentManager componentManager, Vector3 position, string asset, float bushSize) : base(componentManager, "Berry Bush", position, MathFunctions.Rand(-0.1f, 0.1f), new Vector3(bushSize, bushSize, bushSize), asset, bushSize) { AddChild(new Health(componentManager, "HP", 30 * bushSize, 0.0f, 30 * bushSize)); AddChild(new Flammable(componentManager, "Flames")); var particles = AddChild(new ParticleTrigger("Leaves", Manager, "LeafEmitter", Matrix.Identity, LocalBoundingBoxOffset, GetBoundingBox().Extents()) { SoundToPlay = ContentPaths.Audio.Oscar.sfx_env_bush_harvest_1 }) as ParticleTrigger; Tags.Add("Vegetation"); Tags.Add("Bush"); Tags.Add("EmitsFood"); Inventory inventory = AddChild(new Inventory(componentManager, "Inventory", BoundingBox.Extents(), LocalBoundingBoxOffset)) as Inventory; inventory.AddResource(new ResourceAmount() { NumResources = 3, ResourceType = ResourceType.Berry }); CollisionType = CollisionType.Static; PropogateTransforms(); }
public Cactus(ComponentManager Manager, Vector3 position, float bushSize) : base(Manager, "Cactus", position, MathFunctions.Rand(-0.1f, 0.1f), new Vector3(bushSize, bushSize, bushSize), "Entities\\Plants\\cactus", bushSize) { AddChild(new Health(Manager, "HP", 30 * bushSize, 0.0f, 30 * bushSize)); AddChild(new Flammable(Manager, "Flames")); Inventory inventory = AddChild(new Inventory(Manager, "Inventory", BoundingBox.Extents(), LocalBoundingBoxOffset) { Resources = new List <Inventory.InventoryItem>(), }) as Inventory; for (var i = 0; i < 2; ++i) { inventory.AddResource(new Resource("Cactus")); } var particles = AddChild(new ParticleTrigger("Leaves", Manager, "LeafEmitter", Matrix.Identity, LocalBoundingBoxOffset, GetBoundingBox().Extents()) { SoundToPlay = ContentPaths.Audio.Oscar.sfx_env_bush_harvest_1 }) as ParticleTrigger; Tags.Add("Vegetation"); Tags.Add("Cactus"); CollisionType = CollisionType.Static; PropogateTransforms(); }
public Pumpkin(ComponentManager Manager, Vector3 position, string asset, float bushSize) : base(Manager, "Pumpkin", Matrix.Identity, new Vector3(bushSize, bushSize, bushSize), asset, bushSize) { LocalBoundingBoxOffset = Vector3.Zero; SeedlingAsset = "pumpkinvinesprout"; Matrix matrix = Matrix.Identity; matrix.Translation = position; LocalTransform = matrix; AddChild(new Health(Manager, "HP", 30 * bushSize, 0.0f, 30 * bushSize)); AddChild(new Flammable(Manager, "Flames")); Inventory inventory = AddChild(new Inventory(Manager, "Inventory", BoundingBox.Extents(), LocalBoundingBoxOffset) { Resources = new List <Inventory.InventoryItem>(), }) as Inventory; inventory.AddResource(new ResourceAmount() { NumResources = 2, ResourceType = ResourceLibrary.ResourceType.Pumkin }); var particles = AddChild(new ParticleTrigger("Leaves", Manager, "LeafEmitter", Matrix.Identity, LocalBoundingBoxOffset, GetBoundingBox().Extents()) { SoundToPlay = ContentPaths.Audio.Oscar.sfx_env_bush_harvest_1 }) as ParticleTrigger; Tags.Add("Vegetation"); Tags.Add("Pumpkin"); CollisionType = CollisionManager.CollisionType.Static; PropogateTransforms(); }
public override void Die() { Inventory.AddResource(new Resource("Corpse") { DisplayName = AI.Stats.FullName + "'s Corpse" }); base.Die(); }
public override void Die() { if (World == null) { return; // WUT } if (Stats == null) { return; // SERIOUSLY WTF?? } World.RemoveFromSpeciesTracking(Stats.Species); NoiseMaker.MakeNoise("Die", Physics.Position, true); if (AI.Stats.Money > 0) { EntityFactory.CreateEntity <CoinPile>("Coins Resource", AI.Position, Blackboard.Create("Money", AI.Stats.Money)); } if (Stats.Species.HasMeat) { String type = Stats.CurrentClass.Name + " " + "Meat"; if (!Library.DoesResourceTypeExist(type)) { var r = Library.CreateResourceType(Library.GetResourceType(Stats.Species.BaseMeatResource)); r.Name = type; r.ShortName = type; Library.AddResourceType(r); } Inventory.AddResource(new ResourceAmount(type, 1)); } if (Stats.Species.HasBones) { String type = Stats.CurrentClass.Name + " Bone"; if (!Library.DoesResourceTypeExist(type)) { var r = Library.CreateResourceType(Library.GetResourceType("Bone")); r.Name = type; r.ShortName = type; Library.AddResourceType(r); } Inventory.AddResource(new ResourceAmount(type, 1)); } base.Die(); }
/// <summary> /// If the creature has meat or bones, creates resources /// which get released when the creature dies. /// </summary> public virtual void CreateMeatAndBones() { if (HasMeat) { ResourceLibrary.ResourceType type = Name + " " + ResourceLibrary.ResourceType.Meat; if (!ResourceLibrary.Resources.ContainsKey(type)) { ResourceLibrary.Add(new Resource(ResourceLibrary.Resources[ResourceLibrary.ResourceType.Meat]) { Type = type, ShortName = type }); } Inventory.AddResource(new ResourceAmount(type, 1)); } if (HasBones) { ResourceLibrary.ResourceType type = Name + " " + ResourceLibrary.ResourceType.Bones; if (!ResourceLibrary.Resources.ContainsKey(type)) { ResourceLibrary.Add(new Resource(ResourceLibrary.Resources[ResourceLibrary.ResourceType.Bones]) { Type = type, ShortName = type }); } Inventory.AddResource(new ResourceAmount(type, 1)); } if (HasCorpse) { ResourceLibrary.ResourceType type = AI.Stats.FullName + "'s " + "Corpse"; if (!ResourceLibrary.Resources.ContainsKey(type)) { ResourceLibrary.Add(new Resource(ResourceLibrary.Resources["Corpse"]) { Type = type, ShortName = type }); } Inventory.AddResource(new ResourceAmount(type, 1)); } }
public Slime(string sprites, String SlimeType, Vector3 position, ComponentManager manager, string name) : base ( manager, new CreatureStats("Slime", "Slime", 0), manager.World.Factions.Factions["Carnivore"], name ) { Physics = new Physics ( manager, "Slime", 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; CreateCosmeticChildren(Manager); Physics.AddChild(new EnemySensor(Manager, "EnemySensor", Matrix.Identity, new Vector3(5, 5, 5), Vector3.Zero)); Physics.AddChild(new PacingCreatureAI(Manager, "Slime AI", Sensor)); Physics.AddChild(new Inventory(Manager, "Inventory", Physics.BoundingBox.Extents(), Physics.LocalBoundingBoxOffset)); for (var i = 0; i < MathFunctions.RandInt(1, 3); ++i) { Inventory.AddResource(new Resource(SlimeType)); } Physics.AddChild(new Flammable(Manager, "Flames")); Physics.Tags.Add("Animal"); Stats.FullName = TextGenerator.GenerateRandom("$firstname") + " the slime"; AI.Movement.CanWalk = true; AI.Movement.CanClimbWalls = false; AI.Movement.CanSwim = false; AI.Movement.CanClimb = false; AI.Movement.SetSpeed(MoveType.Jump, 1.5f); }
public override void Die() { String type = AI.Stats.FullName + "'s " + "Corpse"; if (!Library.DoesResourceTypeExist(type)) { var r = Library.CreateResourceType(Library.GetResourceType("Corpse")); r.Name = type; r.ShortName = type; Library.AddResourceType(r); } Inventory.AddResource(new ResourceAmount(type, 1)); base.Die(); }
public override void Die() { if (World == null) { return; // WUT } if (Stats == null) { return; // SERIOUSLY WTF?? } if (!FirstUpdate) { World.RemoveFromSpeciesTracking(Stats.Species); } NoiseMaker.MakeNoise("Die", Physics.Position, true); if (AI.Stats.Money > 0) { Manager.RootComponent.AddChild(new CoinPile(Manager, AI.Position) // I don't like how it's implictly added to manager. { Money = AI.Stats.Money }); } if (Stats.Species.HasMeat) { var meatResource = new Resource(Stats.Species.BaseMeatResource); meatResource.DisplayName = Stats.CurrentClass.Name + " Meat"; Inventory.AddResource(meatResource); } if (Stats.Species.HasBones) { var generatedResource = new Resource("Bone"); generatedResource.DisplayName = Stats.CurrentClass.Name + " Bone"; Inventory.AddResource(generatedResource); } base.Die(); }
public MudGolem(CreatureStats stats, Faction faction, ComponentManager manager, string name, Vector3 position) : base(manager, stats, faction, name) { Physics = new Physics(Manager, name, Matrix.CreateTranslation(position), new Vector3(0.5f, 0.5f, 0.5f), new Vector3(0.0f, -0.25f, 0.0f), 1.0f, 1.0f, 0.999f, 0.999f, new Vector3(0, -10, 0)); Physics.AddChild(this); Physics.Orientation = Physics.OrientMode.RotateY; CreateCosmeticChildren(Manager); Physics.AddChild(new EnemySensor(Manager, "EnemySensor", Matrix.Identity, new Vector3(5, 5, 5), Vector3.Zero)); Physics.AddChild(new GolemAI(Manager, Sensor) { Movement = { IsSessile = true, CanFly = false, CanSwim = false, CanWalk = false, CanClimb = false, CanClimbWalls = false } }); Physics.AddChild(new Inventory(Manager, "Inventory", Physics.BoundingBox.Extents(), Physics.LocalBoundingBoxOffset)); var gems = Library.EnumerateResourceTypesWithTag("Gem"); for (int i = 0; i < 16; i++) { int num = MathFunctions.RandInt(1, 32 - i); for (int j = 0; j < num; ++j) { Inventory.AddResource(new Resource(Datastructures.SelectRandom(gems))); } i += num - 1; } Physics.Tags.Add("MudGolem"); Physics.Mass = 100; Stats.FullName = TextGenerator.GenerateRandom("$goblinname"); Stats.BaseSize = 4; Resistances[DamageType.Fire] = 5; Resistances[DamageType.Acid] = 5; Resistances[DamageType.Cold] = 5; }
public void Initialize(string blood, int iconX, int iconY) { 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, iconX, iconY))); 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"; }