public override Entity Clone() { EntityItem clone = new EntityItem(this.name, this.itemName, itemSprite.Clone()); clone.selectionBox = this.selectionBox; clone.drawingBox = this.drawingBox; clone.collisionBox = this.collisionBox; clone.collisionMask = Base.CollisionLayer.Item; clone.miningProps = this.miningProps; clone.minable = this.minable; return(clone); }
private void LoadItemEntityPrototypes(ItemCollection itemCollection) { //Iterate over itemcollection and create an itementity prototype for each in the collection Dictionary <string, Item> items = itemCollection.GetItemCollection(); foreach (string key in items.Keys) { StaticSprite itemSprite = items[key].itemSprite.Clone(); itemSprite.scale = new Vector2f(0.5f, 0.5f); itemSprite.drawLayer = Drawable.DrawLayer.Item; Entity itemEntity = new EntityItem(key + "Item", key, itemSprite); itemEntity.selectionBox = new BoundingBox(16, 16); itemEntity.drawingBox = new BoundingBox(16, 16); itemEntity.collisionBox = new BoundingBox(16, 16); itemEntity.collisionMask = Base.CollisionLayer.Item | Base.CollisionLayer.EntityPhysical | Base.CollisionLayer.TerrainSolid; itemEntity.miningProps = new Entity.MiningProps(key, 1, 10, 0, ""); itemEntity.minable = true; entityPrototypes.Add(key + "Item", itemEntity); } }