public Flag(Vector3 position) : base("Flag", PlayState.ComponentManager.RootComponent, Matrix.CreateTranslation(position), new Vector3(1.0f, 1.0f, 1.0f), Vector3.Zero) { SpriteSheet spriteSheet = new SpriteSheet(ContentPaths.Entities.Furniture.interior_furniture); List<Point> frames = new List<Point> { new Point(0, 2), new Point(1, 2), new Point(2, 2) }; Animation lampAnimation = new Animation(GameState.Game.GraphicsDevice, new SpriteSheet(ContentPaths.Entities.Furniture.interior_furniture), "Flag", 32, 32, frames, true, Color.White, 5.0f + MathFunctions.Rand(), 1f, 1.0f, false); Sprite sprite = new Sprite(PlayState.ComponentManager, "sprite", this, Matrix.Identity, spriteSheet, false) { OrientationType = Sprite.OrientMode.YAxis }; sprite.AddAnimation(lampAnimation); Voxel voxelUnder = new Voxel(); if (PlayState.ChunkManager.ChunkData.GetFirstVoxelUnder(position, ref voxelUnder)) { VoxelListener listener = new VoxelListener(PlayState.ComponentManager, this, PlayState.ChunkManager, voxelUnder); } lampAnimation.Play(); Tags.Add("Flag"); CollisionType = CollisionManager.CollisionType.Static; }
public Cactus(Vector3 position, string asset, float bushSize) : base("Cactus", PlayState.ComponentManager.RootComponent, Matrix.Identity, new Vector3(bushSize, bushSize, bushSize), Vector3.Zero) { Seedlingsheet = new SpriteSheet(ContentPaths.Entities.Plants.vine, 32, 32); SeedlingFrame = new Point(0, 0); ComponentManager componentManager = PlayState.ComponentManager; Matrix matrix = Matrix.Identity; matrix.Translation = position + new Vector3(0.5f, -0.2f, 0.5f); LocalTransform = matrix; new Mesh(componentManager, "Model", this, Matrix.CreateScale(bushSize, bushSize, bushSize), asset, false); Health health = new Health(componentManager, "HP", this, 30 * bushSize, 0.0f, 30 * bushSize); new Flammable(componentManager, "Flames", this, health); Voxel voxelUnder = new Voxel(); if (PlayState.ChunkManager.ChunkData.GetFirstVoxelUnder(position, ref voxelUnder)) { VoxelListener listener = new VoxelListener(componentManager, this, PlayState.ChunkManager, voxelUnder); } Tags.Add("Vegetation"); Tags.Add("Cactus"); AddToCollisionManager = true; CollisionType = CollisionManager.CollisionType.Static; }
public Flag(ComponentManager componentManager, Vector3 position) : base(componentManager, "Flag", componentManager.RootComponent, Matrix.CreateTranslation(position), new Vector3(1.0f, 1.0f, 1.0f), Vector3.Zero) { SpriteSheet spriteSheet = new SpriteSheet(ContentPaths.Entities.Furniture.interior_furniture); List <Point> frames = new List <Point> { new Point(0, 2), new Point(1, 2), new Point(2, 2) }; Animation lampAnimation = new Animation(GameState.Game.GraphicsDevice, new SpriteSheet(ContentPaths.Entities.Furniture.interior_furniture), "Flag", 32, 32, frames, true, Color.White, 5.0f + MathFunctions.Rand(), 1f, 1.0f, false); Sprite sprite = new Sprite(componentManager, "sprite", this, Matrix.Identity, spriteSheet, false) { OrientationType = Sprite.OrientMode.YAxis }; sprite.AddAnimation(lampAnimation); Voxel voxelUnder = new Voxel(); if (Manager.World.ChunkManager.ChunkData.GetFirstVoxelUnder(position, ref voxelUnder)) { VoxelListener listener = new VoxelListener(componentManager, this, Manager.World.ChunkManager, voxelUnder); } lampAnimation.Play(); Tags.Add("Flag"); CollisionType = CollisionManager.CollisionType.Static; }
public Chair(Vector3 position) : base("Chair", PlayState.ComponentManager.RootComponent, Matrix.Identity, new Vector3(1.0f, 1.0f, 1.0f), Vector3.Zero) { ComponentManager componentManager = PlayState.ComponentManager; Matrix matrix = Matrix.CreateRotationY((float)Math.PI * 0.5f); matrix.Translation = position - new Vector3(0, 0.22f, 0); LocalTransform = matrix; SpriteSheet spriteSheet = new SpriteSheet(ContentPaths.Entities.Furniture.interior_furniture); Point topFrame = new Point(2, 6); Point sideFrame = new Point(3, 6); List <Point> frames = new List <Point> { topFrame }; List <Point> sideframes = new List <Point> { sideFrame }; Animation tableTop = new Animation(GameState.Game.GraphicsDevice, spriteSheet, "tableTop", 32, 32, frames, false, Color.White, 0.01f, 1.0f, 1.0f, false); Animation tableAnimation = new Animation(GameState.Game.GraphicsDevice, spriteSheet, "tableTop", 32, 32, sideframes, false, Color.White, 0.01f, 1.0f, 1.0f, false); Sprite tabletopSprite = new Sprite(componentManager, "sprite1", this, Matrix.CreateRotationX((float)Math.PI * 0.5f), spriteSheet, false) { OrientationType = Sprite.OrientMode.Fixed }; tabletopSprite.AddAnimation(tableTop); Sprite sprite = new Sprite(componentManager, "sprite", this, Matrix.CreateTranslation(0.0f, -0.05f, -0.0f) * Matrix.Identity, spriteSheet, false) { OrientationType = Sprite.OrientMode.Fixed }; sprite.AddAnimation(tableAnimation); Sprite sprite2 = new Sprite(componentManager, "sprite2", this, Matrix.CreateTranslation(0.0f, -0.05f, -0.0f) * Matrix.CreateRotationY((float)Math.PI * 0.5f), spriteSheet, false) { OrientationType = Sprite.OrientMode.Fixed }; sprite2.AddAnimation(tableAnimation); Voxel voxelUnder = new Voxel(); if (PlayState.ChunkManager.ChunkData.GetFirstVoxelUnder(position, ref voxelUnder)) { VoxelListener listener = new VoxelListener(componentManager, this, PlayState.ChunkManager, voxelUnder); } tableAnimation.Play(); Tags.Add("Chair"); CollisionType = CollisionManager.CollisionType.Static; }
public Seedling(Body adult, Vector3 position, SpriteSheet asset, Point frame) : base(position, asset, frame, PlayState.ComponentManager.RootComponent) { IsGrown = false; Adult = adult; Name = adult.Name + " seedling"; Health health = new Health(PlayState.ComponentManager, "HP", this, 1.0f, 0.0f, 1.0f); new Flammable(PlayState.ComponentManager, "Flames", this, health); Voxel voxelUnder = new Voxel(); if (PlayState.ChunkManager.ChunkData.GetFirstVoxelUnder(position, ref voxelUnder)) { VoxelListener listener = new VoxelListener(PlayState.ComponentManager, this, PlayState.ChunkManager, voxelUnder); } }
public Bed(Vector3 position) : base("Bed", PlayState.ComponentManager.RootComponent, Matrix.CreateTranslation(position), new Vector3(1.5f, 0.5f, 0.75f), new Vector3(-0.5f + 1.5f * 0.5f, -0.5f + 0.25f, -0.5f + 0.75f * 0.5f)) { Texture2D spriteSheet = TextureManager.GetTexture(ContentPaths.Entities.Furniture.bedtex); bedModel = new Box(PlayState.ComponentManager, "bedbox", this, Matrix.CreateTranslation(-0.5f, -0.5f, -0.5f) * Matrix.CreateRotationY((float)Math.PI * 0.5f), new Vector3(1.0f, 1.0f, 2.0f), new Vector3(0.5f, 0.5f, 1.0f), PrimitiveLibrary.BoxPrimitives["bed"], spriteSheet); Voxel voxelUnder = new Voxel(); if (PlayState.ChunkManager.ChunkData.GetFirstVoxelUnder(position, ref voxelUnder)) { VoxelListener listener = new VoxelListener(PlayState.ComponentManager, this, PlayState.ChunkManager, voxelUnder); } Tags.Add("Bed"); CollisionType = CollisionManager.CollisionType.Static; }
public Cactus(ComponentManager componentManager, Vector3 position, string asset, float bushSize) : base("Cactus", componentManager.RootComponent, Matrix.Identity, new Vector3(bushSize, bushSize, bushSize), Vector3.Zero) { Seedlingsheet = new SpriteSheet(ContentPaths.Entities.Plants.vine, 32, 32); SeedlingFrame = new Point(0, 0); Matrix matrix = Matrix.Identity; matrix.Translation = position + new Vector3(0.5f, -0.2f, 0.5f); LocalTransform = matrix; new Mesh("Model", this, Matrix.CreateScale(bushSize, bushSize, bushSize), asset, false); Health health = new Health(componentManager, "HP", this, 30 * bushSize, 0.0f, 30 * bushSize); new Flammable(componentManager, "Flames", this, health); Voxel voxelUnder = new Voxel(); if (componentManager.World.ChunkManager.ChunkData.GetFirstVoxelUnder(position, ref voxelUnder)) { VoxelListener listener = new VoxelListener(componentManager, this, componentManager.World.ChunkManager, voxelUnder); } Inventory inventory = new Inventory("Inventory", this) { Resources = new ResourceContainer { MaxResources = 2 } }; inventory.Resources.AddResource(new ResourceAmount() { NumResources = 2, ResourceType = ResourceLibrary.ResourceType.Cactus }); Tags.Add("Vegetation"); Tags.Add("Cactus"); AddToCollisionManager = true; CollisionType = CollisionManager.CollisionType.Static; }
// 20 x 8 x 32 public Bookshelf(Vector3 position) : base("Bookshelf", PlayState.ComponentManager.RootComponent, Matrix.CreateTranslation(position), new Vector3(32.0f / 32.0f, 8.0f / 32.0f, 20.0f / 32.0f), new Vector3(0.5f, 0.5f, 0.5f)) { Texture2D spriteSheet = TextureManager.GetTexture(ContentPaths.Entities.Furniture.bookshelf); bedModel = new Box(PlayState.ComponentManager, "model", this, Matrix.CreateTranslation(new Vector3(-20.0f / 64.0f, -32.0f / 64.0f, -8.0f / 64.0f)), new Vector3(32.0f / 32.0f, 8.0f / 32.0f, 20.0f / 32.0f), new Vector3(0.0f, 0.0f, 0.0f), PrimitiveLibrary.BoxPrimitives["bookshelf"], spriteSheet); Voxel voxelUnder = new Voxel(); if (PlayState.ChunkManager.ChunkData.GetFirstVoxelUnder(position, ref voxelUnder)) { VoxelListener listener = new VoxelListener(PlayState.ComponentManager, this, PlayState.ChunkManager, voxelUnder); } Tags.Add("Books"); CollisionType = CollisionManager.CollisionType.Static; }
public Bush(Vector3 position, string asset, float bushSize) : base("Bush", PlayState.ComponentManager.RootComponent, Matrix.Identity, new Vector3(bushSize, bushSize, bushSize), Vector3.Zero) { ComponentManager componentManager = PlayState.ComponentManager; Matrix matrix = Matrix.Identity; matrix.Translation = position + new Vector3(0.5f, -0.2f, 0.5f); LocalTransform = matrix; new Mesh(componentManager, "Model", this, Matrix.CreateScale(bushSize, bushSize, bushSize), asset, false); Health health = new Health(componentManager, "HP", this, 30 * bushSize, 0.0f, 30 * bushSize); new Flammable(componentManager, "Flames", this, health); Voxel voxelUnder = new Voxel(); if (PlayState.ChunkManager.ChunkData.GetFirstVoxelUnder(position, ref voxelUnder)) { VoxelListener listener = new VoxelListener(componentManager, this, PlayState.ChunkManager, voxelUnder); } Tags.Add("Vegetation"); Tags.Add("Bush"); Tags.Add("EmitsFood"); Inventory inventory = new Inventory("Inventory", this) { Resources = new ResourceContainer { MaxResources = (int)(bushSize * 5) } }; inventory.Resources.AddResource(new ResourceAmount() { NumResources = (int)(bushSize * 5), ResourceType = ResourceLibrary.Resources[ResourceLibrary.ResourceType.Berry] }); AddToCollisionManager = true; CollisionType = CollisionManager.CollisionType.Static; }
public BearTrap(Vector3 pos) : base( "BearTrap", PlayState.ComponentManager.RootComponent, Matrix.CreateTranslation(pos), new Vector3(1.0f, 1.0f, 1.0f), Vector3.Zero, true) { Allies = "Dwarf"; Sensor = new Sensor("Sensor", this, Matrix.Identity, new Vector3(0.5f, 0.5f, 0.5f), Vector3.Zero) { FireTimer = new Timer(0.5f, false) }; Sensor.OnSensed += Sensor_OnSensed; DeathTimer = new Timer(0.6f, true); DeathParticles = new ParticleTrigger("puff", PlayState.ComponentManager, "DeathParticles", this, Matrix.Identity, new Vector3(0.5f, 0.5f, 0.5f), Vector3.Zero) { SoundToPlay = "" }; DamageAmount = 200; Voxel voxUnder = new Voxel(); PlayState.ChunkManager.ChunkData.GetFirstVoxelUnder(pos, ref voxUnder); VoxListener = new VoxelListener(PlayState.ComponentManager, this, PlayState.ChunkManager, voxUnder); Sprite = new Sprite(PlayState.ComponentManager, "Sprite", this, Matrix.Identity, new SpriteSheet(ContentPaths.Entities.DwarfObjects.beartrap), false); Sprite.AddAnimation(new Animation(0, ContentPaths.Entities.DwarfObjects.beartrap, 32, 32, 0) { Name = IdleAnimation }); Sprite.AddAnimation(new Animation(1, ContentPaths.Entities.DwarfObjects.beartrap, 32, 32, 0, 1, 2, 3) { Name = TriggerAnimation, Speeds = new List <float>() { 6.6f }, Loops = true }); }
public Wheat(Vector3 position) : base("Wheat", PlayState.ComponentManager.RootComponent, Matrix.Identity, new Vector3(1.0f, 1.0f, 1.0f), Vector3.Zero) { Matrix matrix = Matrix.CreateRotationY(MathFunctions.Rand(-0.1f, 0.1f)); matrix.Translation = position + new Vector3(0.5f, -0.25f, 0.5f); LocalTransform = matrix; SpriteSheet spriteSheet = new SpriteSheet(ContentPaths.Entities.Plants.wheat); List <Point> frames = new List <Point> { new Point(0, 0) }; Animation tableAnimation = new Animation(GameState.Game.GraphicsDevice, new SpriteSheet(ContentPaths.Entities.Plants.wheat), "Wheat", 32, 32, frames, false, Color.White, 0.01f, 1.0f, 1.0f, false); Sprite sprite = new Sprite(PlayState.ComponentManager, "sprite", this, Matrix.Identity, spriteSheet, false) { OrientationType = Sprite.OrientMode.Fixed }; sprite.AddAnimation(tableAnimation); Sprite sprite2 = new Sprite(PlayState.ComponentManager, "sprite2", this, Matrix.CreateRotationY((float)Math.PI * 0.5f), spriteSheet, false) { OrientationType = Sprite.OrientMode.Fixed }; sprite2.AddAnimation(tableAnimation); Voxel voxelUnder = new Voxel(); bool success = PlayState.ChunkManager.ChunkData.GetFirstVoxelUnder(position, ref voxelUnder); if (success) { VoxelListener listener = new VoxelListener(PlayState.ComponentManager, this, PlayState.ChunkManager, voxelUnder); } Inventory inventory = new Inventory("Inventory", this) { Resources = new ResourceContainer() { MaxResources = 4, Resources = new Dictionary <ResourceLibrary.ResourceType, ResourceAmount>() { { ResourceLibrary.ResourceType.Grain, new ResourceAmount(ResourceLibrary.ResourceType.Grain, MathFunctions.RandInt(1, 5)) } } } }; Health health = new Health(PlayState.ComponentManager, "HP", this, 30, 0.0f, 30); new Flammable(PlayState.ComponentManager, "Flames", this, health); tableAnimation.Play(); Tags.Add("Wheat"); Tags.Add("Vegetation"); CollisionType = CollisionManager.CollisionType.Static; }
public BearTrap(Vector3 pos) : base("BearTrap", PlayState.ComponentManager.RootComponent, Matrix.CreateTranslation(pos), new Vector3(1.0f, 1.0f, 1.0f), Vector3.Zero, true) { Allies = PlayState.PlayerFaction; Sensor = new Sensor("Sensor", this, Matrix.Identity, new Vector3(0.5f, 0.5f, 0.5f), Vector3.Zero) { FireTimer = new Timer(0.5f, false) }; Sensor.OnSensed += Sensor_OnSensed; DeathTimer = new Timer(0.6f, true); DeathParticles = new ParticleTrigger("puff", PlayState.ComponentManager, "DeathParticles", this, Matrix.Identity, new Vector3(0.5f, 0.5f, 0.5f), Vector3.Zero) { SoundToPlay = "" }; DamageAmount = 200; Voxel voxUnder = new Voxel(); PlayState.ChunkManager.ChunkData.GetFirstVoxelUnder(pos, ref voxUnder); VoxListener = new VoxelListener(PlayState.ComponentManager, this, PlayState.ChunkManager, voxUnder); Sprite = new Sprite(PlayState.ComponentManager, "Sprite", this, Matrix.Identity, new SpriteSheet(ContentPaths.Entities.DwarfObjects.beartrap), false); Sprite.AddAnimation(new Animation(0, ContentPaths.Entities.DwarfObjects.beartrap, 32, 32, 0) {Name = IdleAnimation}); Sprite.AddAnimation(new Animation(1, ContentPaths.Entities.DwarfObjects.beartrap, 32, 32, 0, 1, 2, 3) {Name = TriggerAnimation, Speeds = new List<float>() {6.6f}, Loops = true}); }
public Table(ComponentManager manager, Vector3 position, SpriteSheet fixtureAsset, Point fixtureFrame) : base(manager, "Table", manager.RootComponent, Matrix.Identity, new Vector3(1.0f, 1.0f, 1.0f), Vector3.Zero) { Matrix matrix = Matrix.CreateRotationY((float)Math.PI * 0.5f); matrix.Translation = position; LocalTransform = matrix; SpriteSheet spriteSheet = new SpriteSheet(ContentPaths.Entities.Furniture.interior_furniture); Point topFrame = new Point(0, 6); Point sideFrame = new Point(1, 6); List <Point> frames = new List <Point> { topFrame }; List <Point> sideframes = new List <Point> { sideFrame }; Animation tableTop = new Animation(GameState.Game.GraphicsDevice, new SpriteSheet(ContentPaths.Entities.Furniture.interior_furniture), "tableTop", 32, 32, frames, false, Color.White, 0.01f, 1.0f, 1.0f, false); Animation tableAnimation = new Animation(GameState.Game.GraphicsDevice, new SpriteSheet(ContentPaths.Entities.Furniture.interior_furniture), "tableTop", 32, 32, sideframes, false, Color.White, 0.01f, 1.0f, 1.0f, false); Sprite tabletopSprite = new Sprite(manager, "sprite1", this, Matrix.CreateRotationX((float)Math.PI * 0.5f), spriteSheet, false) { OrientationType = Sprite.OrientMode.Fixed }; tabletopSprite.AddAnimation(tableTop); Sprite sprite = new Sprite(manager, "sprite", this, Matrix.CreateTranslation(0.0f, -0.05f, -0.0f) * Matrix.Identity, spriteSheet, false) { OrientationType = Sprite.OrientMode.Fixed }; sprite.AddAnimation(tableAnimation); Sprite sprite2 = new Sprite(manager, "sprite2", this, Matrix.CreateTranslation(0.0f, -0.05f, -0.0f) * Matrix.CreateRotationY((float)Math.PI * 0.5f), spriteSheet, false) { OrientationType = Sprite.OrientMode.Fixed }; sprite2.AddAnimation(tableAnimation); Voxel voxelUnder = new Voxel(); if (manager.World.ChunkManager.ChunkData.GetFirstVoxelUnder(position, ref voxelUnder)) { VoxelListener listener = new VoxelListener(manager, this, manager.World.ChunkManager, voxelUnder); } tableAnimation.Play(); Tags.Add("Table"); CollisionType = CollisionManager.CollisionType.Static; if (fixtureAsset != null) { new Fixture(new Vector3(0, 0.3f, 0), fixtureAsset, fixtureFrame, this); } }
public Chair(Vector3 position) : base("Chair", PlayState.ComponentManager.RootComponent, Matrix.Identity, new Vector3(1.0f, 1.0f, 1.0f), Vector3.Zero) { ComponentManager componentManager = PlayState.ComponentManager; Matrix matrix = Matrix.CreateRotationY((float)Math.PI * 0.5f); matrix.Translation = position - new Vector3(0, 0.22f, 0); LocalTransform = matrix; SpriteSheet spriteSheet = new SpriteSheet(ContentPaths.Entities.Furniture.interior_furniture); Point topFrame = new Point(2, 6); Point sideFrame = new Point(3, 6); List<Point> frames = new List<Point> { topFrame }; List<Point> sideframes = new List<Point> { sideFrame }; Animation tableTop = new Animation(GameState.Game.GraphicsDevice, spriteSheet, "tableTop", 32, 32, frames, false, Color.White, 0.01f, 1.0f, 1.0f, false); Animation tableAnimation = new Animation(GameState.Game.GraphicsDevice, spriteSheet, "tableTop", 32, 32, sideframes, false, Color.White, 0.01f, 1.0f, 1.0f, false); Sprite tabletopSprite = new Sprite(componentManager, "sprite1", this, Matrix.CreateRotationX((float)Math.PI * 0.5f), spriteSheet, false) { OrientationType = Sprite.OrientMode.Fixed }; tabletopSprite.AddAnimation(tableTop); Sprite sprite = new Sprite(componentManager, "sprite", this, Matrix.CreateTranslation(0.0f, -0.05f, -0.0f) * Matrix.Identity, spriteSheet, false) { OrientationType = Sprite.OrientMode.Fixed }; sprite.AddAnimation(tableAnimation); Sprite sprite2 = new Sprite(componentManager, "sprite2", this, Matrix.CreateTranslation(0.0f, -0.05f, -0.0f) * Matrix.CreateRotationY((float)Math.PI * 0.5f), spriteSheet, false) { OrientationType = Sprite.OrientMode.Fixed }; sprite2.AddAnimation(tableAnimation); Voxel voxelUnder = new Voxel(); if (PlayState.ChunkManager.ChunkData.GetFirstVoxelUnder(position, ref voxelUnder)) { VoxelListener listener = new VoxelListener(componentManager, this, PlayState.ChunkManager, voxelUnder); } tableAnimation.Play(); Tags.Add("Chair"); CollisionType = CollisionManager.CollisionType.Static; }
public Mushroom(ComponentManager componentManager, Vector3 position, string asset, ResourceLibrary.ResourceType resource, int numRelease, bool selfIlluminate) : base("Mushroom", componentManager.RootComponent, Matrix.Identity, new Vector3(1.0f, 1.0f, 1.0f), Vector3.Zero) { Seedlingsheet = new SpriteSheet(ContentPaths.Entities.Plants.deadbush, 32, 32); SeedlingFrame = new Point(0, 0); Matrix matrix = Matrix.CreateRotationY(MathFunctions.Rand(-0.1f, 0.1f)); matrix.Translation = position + new Vector3(0.5f, -0.25f, 0.5f); LocalTransform = matrix; SpriteSheet spriteSheet = new SpriteSheet(asset); List <Point> frames = new List <Point> { new Point(0, 0) }; Animation animation = new Animation(GameState.Game.GraphicsDevice, spriteSheet, "Mushroom", 32, 32, frames, false, Color.White, 0.01f, 1.0f, 1.0f, false); Sprite sprite = new Sprite(componentManager, "sprite", this, Matrix.Identity, spriteSheet, false) { OrientationType = Sprite.OrientMode.Fixed, LightsWithVoxels = !selfIlluminate }; sprite.AddAnimation(animation); Sprite sprite2 = new Sprite(componentManager, "sprite2", this, Matrix.CreateRotationY((float)Math.PI * 0.5f), spriteSheet, false) { OrientationType = Sprite.OrientMode.Fixed, LightsWithVoxels = !selfIlluminate }; sprite2.AddAnimation(animation); Voxel voxelUnder = new Voxel(); bool success = componentManager.World.ChunkManager.ChunkData.GetFirstVoxelUnder(position, ref voxelUnder); if (success) { VoxelListener listener = new VoxelListener(componentManager.World.ComponentManager, this, componentManager.World.ChunkManager, voxelUnder); } Inventory inventory = new Inventory("Inventory", this) { Resources = new ResourceContainer() { MaxResources = 2, Resources = new Dictionary <ResourceLibrary.ResourceType, ResourceAmount>() { { resource, new ResourceAmount(resource, numRelease) } } } }; Health health = new Health(componentManager.World.ComponentManager, "HP", this, 30, 0.0f, 30); new Flammable(componentManager.World.ComponentManager, "Flames", this, health); animation.Play(); Tags.Add("Mushroom"); Tags.Add("Vegetation"); CollisionType = CollisionManager.CollisionType.Static; }
public Wheat(Vector3 position) : base("Wheat", PlayState.ComponentManager.RootComponent, Matrix.Identity, new Vector3(1.0f, 1.0f, 1.0f), Vector3.Zero) { Matrix matrix = Matrix.CreateRotationY(MathFunctions.Rand(-0.1f, 0.1f)); matrix.Translation = position + new Vector3(0.5f, -0.25f, 0.5f); LocalTransform = matrix; SpriteSheet spriteSheet = new SpriteSheet(ContentPaths.Entities.Plants.wheat); List<Point> frames = new List<Point> { new Point(0, 0) }; Animation tableAnimation = new Animation(GameState.Game.GraphicsDevice, new SpriteSheet(ContentPaths.Entities.Plants.wheat), "Wheat", 32, 32, frames, false, Color.White, 0.01f, 1.0f, 1.0f, false); Sprite sprite = new Sprite(PlayState.ComponentManager, "sprite", this, Matrix.Identity, spriteSheet, false) { OrientationType = Sprite.OrientMode.Fixed }; sprite.AddAnimation(tableAnimation); Sprite sprite2 = new Sprite(PlayState.ComponentManager, "sprite2", this, Matrix.CreateRotationY((float)Math.PI * 0.5f), spriteSheet, false) { OrientationType = Sprite.OrientMode.Fixed }; sprite2.AddAnimation(tableAnimation); Voxel voxelUnder = new Voxel(); bool success = PlayState.ChunkManager.ChunkData.GetFirstVoxelUnder(position, ref voxelUnder); if (success) { VoxelListener listener = new VoxelListener(PlayState.ComponentManager, this, PlayState.ChunkManager, voxelUnder); } Inventory inventory = new Inventory("Inventory", this) { Resources = new ResourceContainer() { MaxResources = 1, Resources = new Dictionary<ResourceLibrary.ResourceType, ResourceAmount>() { { ResourceLibrary.ResourceType.Grain, new ResourceAmount(ResourceLibrary.ResourceType.Grain) } } } }; Health health = new Health(PlayState.ComponentManager, "HP", this, 30, 0.0f, 30); new Flammable(PlayState.ComponentManager, "Flames", this, health); tableAnimation.Play(); Tags.Add("Wheat"); Tags.Add("Vegetation"); CollisionType = CollisionManager.CollisionType.Static; }