示例#1
0
 public EntityItem(string name, string itemName, StaticSprite sprite)
 {
     this.name     = name;
     this.itemName = itemName;
     itemSprite    = sprite;
     drawArray     = new Drawable[] { sprite };
 }
示例#2
0
 public Item(string name, StaticSprite itemSprite, string placeResult, int maxStack)
 {
     this.name        = name;
     this.itemSprite  = itemSprite;
     this.placeResult = placeResult;
     this.maxStack    = maxStack;
 }
示例#3
0
        private Item CreateGreenhouse()
        {
            IntRect      bounds;
            StaticSprite itemIcon = new StaticSprite(textureAtlases.GetTexture("greenhouseItem", out bounds), bounds, Drawable.DrawLayer.Item);

            return(new Item("Greenhouse", itemIcon, "Greenhouse", 100));
        }
示例#4
0
        private Item CreateCopperOre()
        {
            IntRect      bounds;
            StaticSprite itemIcon = new StaticSprite(textureAtlases.GetTexture("CopperOreItem", out bounds), bounds, Drawable.DrawLayer.Item);

            return(new Item("Copper Ore", itemIcon, null, 100));
        }
示例#5
0
        private Item CreateFurnace()
        {
            IntRect      bounds;
            StaticSprite itemIcon = new StaticSprite(textureAtlases.GetTexture("FurnaceItem", out bounds), bounds, Drawable.DrawLayer.Item);

            return(new Item("Furnace", itemIcon, "Furnace", 50));
        }
示例#6
0
        private Entity CreateGreenhouse()
        {
            IntRect   bounds;
            Animation working = new Animation(textureAtlases.GetTexture("greenhouseworking", out bounds), bounds.Width, bounds.Height, 1, bounds, new Vector2f(0, -48));

            working.drawLayer = Drawable.DrawLayer.EntitySorted;
            StaticSprite idle = new StaticSprite(textureAtlases.GetTexture("greenhouse", out bounds), bounds, new Vector2f(0, -48));

            idle.drawLayer = Drawable.DrawLayer.EntitySorted;
            Animation shadow = new Animation(textureAtlases.GetTexture("greenhouseshadow", out bounds), bounds.Width, bounds.Height, 1, bounds, new Vector2f(96, -16));

            shadow.drawLayer = Drawable.DrawLayer.Shadow;
            Machine greenhouse = new Machine("Greenhouse", working, idle, shadow);

            greenhouse.miningProps        = new Entity.MiningProps("Greenhouse", 1, 60, 0, "");
            greenhouse.collisionMask      = Base.CollisionLayer.EntityPhysical | Base.CollisionLayer.TerrainSolid;
            greenhouse.mapColor           = new Color(96, 64, 0);
            greenhouse.minable            = true;
            greenhouse.emissionPerSecond  = 1.0f;
            greenhouse.collisionBox       = new BoundingBox(-85, -80, 85, 48);
            greenhouse.drawingBox         = new BoundingBox(192, 192);
            greenhouse.selectionBox       = new BoundingBox(-96, -112, 96, 48);
            greenhouse.tileAligned        = true;
            greenhouse.tileWidth          = 6;
            greenhouse.tileHeight         = 4;
            greenhouse.lightSourceFlicker = new LightSourceFlicker(400.0f, textureAtlases.GetTexture("lightsource", out bounds), bounds);
            return(greenhouse);
        }
示例#7
0
 public Furnace(string name, StaticSprite furnaceShadow, StaticSprite furnace)
 {
     this.name          = name;
     this.furnace       = furnace;
     this.furnaceShadow = furnaceShadow;
     drawArray          = new Drawable[] { furnaceShadow, furnace };
 }
示例#8
0
        //Define items prototypes here:
        private Item CreatePineSapling()
        {
            IntRect      bounds;
            StaticSprite itemIcon = new StaticSprite(textureAtlases.GetTexture("woodItem", out bounds), bounds, Drawable.DrawLayer.Item);

            return(new Item("Pine Sapling", itemIcon, "Pine Tree 1", 100));
        }
示例#9
0
        public new StaticSprite Clone()
        {
            StaticSprite cloned = new StaticSprite(this.texture, this.textureFrame, new Vector2f(this.drawOffset.X, this.drawOffset.Y));

            cloned.drawLayer = this.drawLayer;
            cloned.scale     = new Vector2f(this.scale.X, this.scale.Y);
            cloned.color     = new Color(this.color);
            return(cloned);
        }
示例#10
0
        public Recipe GrowWoodRecipe()
        {
            IntRect      bounds;
            StaticSprite recipeIcon = new StaticSprite(textureAtlases.GetTexture("woodItem", out bounds), bounds, Drawable.DrawLayer.None);
            Recipe       recipe     = new Recipe("Grow Wood", new int[0], new string[0], new int[] { 1 }, new string[] { "Wood" }, 180, recipeIcon);

            recipe.canBeMadeIn = new string[] { "Greenhouse" };
            return(recipe);
        }
示例#11
0
 public Recipe(string name, int counts, string itemRequired, int countResult, string itemResult, int recipeTime, StaticSprite recipeSprite)
 {
     this.name          = name;
     this.counts        = new int[] { counts };
     this.itemsRequired = new string[] { itemRequired };
     this.countsResult  = new int[] { countResult };
     this.itemsResults  = new string[] { itemResult };
     this.recipeTime    = recipeTime;
     this.recipeSprite  = recipeSprite;
 }
示例#12
0
 public Tree(string name, StaticSprite trunk, Animation leaves, Animation shadow)
 {
     this.name           = name;
     this.trunk          = trunk;
     this.leaves         = leaves;
     this.shadow         = shadow;
     leaves.currentFrame = 3;
     shadow.currentFrame = 3;
     drawArray           = new Drawable[] { trunk, leaves, shadow };
 }
示例#13
0
 public Recipe(string name, int[] counts, string[] itemsRequired, int[] countsResult, string[] itemsResults, int recipeTime, StaticSprite recipeSprite)
 {
     this.name          = name;
     this.counts        = counts;
     this.itemsRequired = itemsRequired;
     this.countsResult  = countsResult;
     this.itemsResults  = itemsResults;
     this.recipeTime    = recipeTime;
     this.recipeSprite  = recipeSprite;
 }
示例#14
0
 public Machine(string name, Animation working, StaticSprite idle, Animation shadow)
 {
     this.name    = name;
     this.working = working;
     this.shadow  = shadow;
     this.idle    = idle;
     if (idle != null)
     {
         drawArray = new Drawable[] { idle, shadow };
     }
     else
     {
         drawArray = new Drawable[] { working, shadow };
     }
     machineState = MachineState.Idle;
     input        = new List <ItemStack>();
     result       = new List <ItemStack>();
 }
示例#15
0
        public Entity CreateCoal()
        {
            IntRect      bounds;
            StaticSprite coalOreSprite = new StaticSprite(this.textureAtlases.GetTexture("CoalOre", out bounds), bounds, Drawable.DrawLayer.Resource);

            coalOreSprite.drawLayer = Drawable.DrawLayer.Resource;
            coalOreSprite.scale     = new Vector2f(0.5f, 0.5f);
            Resource coalOre = new Resource("Coal", coalOreSprite);

            coalOre.tileAligned   = true;
            coalOre.tileHeight    = 1;
            coalOre.tileWidth     = 1;
            coalOre.collisionBox  = new BoundingBox(32, 32);
            coalOre.collisionMask = Base.CollisionLayer.Resource;
            coalOre.selectionBox  = new BoundingBox(32, 32);
            coalOre.drawingBox    = new BoundingBox(32, 32);
            coalOre.minable       = true;
            coalOre.miningProps   = new Entity.MiningProps("Coal Ore", 1, 30, 0, "");
            return(coalOre);
        }
示例#16
0
        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);
            }
        }
示例#17
0
        public Entity CreateFurnace()
        {
            IntRect      bounds;
            StaticSprite furnace       = new StaticSprite(textureAtlases.GetTexture("furnace", out bounds), bounds, new Vector2f(0, -32));
            StaticSprite furnaceshadow = new StaticSprite(textureAtlases.GetTexture("furnaceshadow", out bounds), bounds, new Vector2f(36, 0));

            furnaceshadow.scale     = new Vector2f(0.5f, 0.5f);
            furnace.drawLayer       = Drawable.DrawLayer.EntitySorted;
            furnaceshadow.drawLayer = Drawable.DrawLayer.Shadow;
            Furnace furnaces = new Furnace("Furnace", furnaceshadow, furnace);

            furnaces.miningProps       = new Entity.MiningProps("Furnace", 1, 60, 0, "");
            furnaces.collisionMask     = Base.CollisionLayer.EntityPhysical | Base.CollisionLayer.TerrainSolid;
            furnaces.minable           = true;
            furnaces.emissionPerSecond = 1.0f;
            furnaces.collisionBox      = new BoundingBox(64, 32);
            furnaces.drawingBox        = new BoundingBox(192, 192);
            furnaces.selectionBox      = new BoundingBox(64, 64);
            furnaces.tileAligned       = true;
            furnaces.tileWidth         = 2;
            furnaces.tileHeight        = 1;
            return(furnaces);
        }
示例#18
0
        private Entity CreatePineTree1()
        {
            IntRect      bounds;
            StaticSprite trunk = new StaticSprite(textureAtlases.GetTexture("tree", out bounds), new IntRect(bounds.Left, bounds.Top, bounds.Width / 4, bounds.Height), new Vector2f(0, -64));

            trunk.drawLayer = Drawable.DrawLayer.EntitySorted;
            Animation leaves = new Animation(textureAtlases.GetTexture("tree", out bounds), 128, bounds.Height, 1, bounds, new Vector2f(0, -64));

            leaves.drawLayer = Drawable.DrawLayer.EntitySorted;
            Animation shadow = new Animation(textureAtlases.GetTexture("treeshadow", out bounds), 192, bounds.Height, 1, bounds, new Vector2f(32, 0));

            shadow.drawLayer = Drawable.DrawLayer.Shadow;
            Tree pineTree1 = new Tree("Pine Tree 1", trunk, leaves, shadow);

            pineTree1.collisionMask = Base.CollisionLayer.EntityPhysical | Base.CollisionLayer.TerrainSolid;
            pineTree1.mapColor      = new Color(32, 160, 0);
            pineTree1.miningProps   = new EntityPhysical.MiningProps("Wood", 1, 90, 0, "");
            pineTree1.miningSounds  = new string[] { "Chop1", "Chop2", "Chop3" };
            pineTree1.minable       = true;
            pineTree1.collisionBox  = new BoundingBox(16, 16);
            pineTree1.drawingBox    = new BoundingBox(128, 192);
            pineTree1.selectionBox  = new BoundingBox(32, 32);
            return(pineTree1);
        }
示例#19
0
 public Resource(string name, StaticSprite resource)
 {
     this.name           = name;
     this.resourceSprite = resource;
     drawArray           = new Drawable[] { resource };
 }