Example #1
0
        public static InventoryItem CreateInventoryItem(string key, TeamType team, string region, Vector2 location, ContentManager content, GraphicsDevice graphics)
        {
            InventoryItem item          = null;
            int           amountStacked = 1;

            switch (key)
            {
            case ("tribalTokens"):
                item = new TribalTokens(team, region, location, content, graphics);
                break;

            case ("basePlank"):
                item = new BasePlank(team, region, location, content, graphics);
                break;

            case ("shortSword"):
                item = new ShortSword(team, region, location, content, graphics);
                break;

            case ("softWood"):
                item = new SoftWood(team, region, location, content, graphics);
                break;

            case ("islandGrass"):
                item = new IslandGrass(team, region, location, content, graphics);
                break;

            case ("coal"):
                item = new Coal(team, region, location, content, graphics);
                break;

            case ("ironOre"):
                item = new IronOre(team, region, location, content, graphics);
                break;

            case ("baseSword"):
                item = new BaseSword(team, region, location, content, graphics);
                break;

            case ("anvilItem"):
                item = new AnvilItem(team, region, location, content, graphics);
                item.placeableVersion = new CraftingAnvil(team, region, location, content, graphics);
                break;

            case ("baseChestItem"):
                item = new BaseChestItem(team, region, location, content, graphics);
                item.placeableVersion = new BaseChest(team, region, location, content, graphics);
                break;

            case ("nails"):
                item          = new Nails(team, region, location, content, graphics);
                amountStacked = 5;
                break;

            case ("cannonBallItem"):
                item          = new CannonBallItem(team, region, location, content, graphics);
                amountStacked = 3;
                break;

            case ("pistolShotItem"):
                item          = new PistolShotItem(team, region, location, content, graphics);
                amountStacked = 5;
                break;

            case ("ironBar"):
                item = new IronBar(team, region, location, content, graphics);
                break;

            case ("treasureMapItem"):
                item = new TreasureMapItem(null, team, region, location, content, graphics);
                break;

            case ("chiliFish"):
                item = new ChiliFish(team, region, location, content, graphics);
                break;

            case ("chiliPepper"):
                item = new ChiliPepper(team, region, location, content, graphics);
                break;

            case ("cookedFish"):
                item = new CookedFish(team, region, location, content, graphics);
                break;

            case ("cookedMeat"):
                item = new CookedMeat(team, region, location, content, graphics);
                break;

            case ("rawFish"):
                item = new RawFish(team, region, location, content, graphics);
                break;

            case ("rawMeat"):
                item = new RawMeat(team, region, location, content, graphics);
                break;

            case ("spoiledFish"):
                item = new SpoiledFish(team, region, location, content, graphics);
                break;

            case ("spoiledMeat"):
                item = new SpoiledMeat(team, region, location, content, graphics);
                break;

            case ("feather"):
                item = new Feather(team, region, location, content, graphics);
                break;

            case ("scales"):
                item = new Scales(team, region, location, content, graphics);
                break;

            case ("fishOil"):
                item = new FishOil(team, region, location, content, graphics);
                break;

            case ("goldCoins"):
                item = new GoldCoins(team, region, location, content, graphics);
                break;
            }
            item.itemKey       = key;
            item.amountStacked = amountStacked;
            return(item);
        }
Example #2
0
        // Creates the initial game state - this will probably be a huge method at the end of it.. TODO: find way to dynamically create items/npc/etc and place them in appropriate region
        public void CreateNewGame()
        {
            //TEMPORARY NEED TO CREATE SOME SORT OF GAME SETUP / REGION SETUP that is easily scalable
            List <Sprite> giannaLandTiles = BoundingBoxLocations.RegionMap["Gianna"].RegionLandTiles;
            List <Sprite> scLandTiles     = BoundingBoxLocations.RegionMap["SnooCat"].RegionLandTiles;
            List <Sprite> usoppLandTiles  = BoundingBoxLocations.RegionMap["Usopp"].RegionLandTiles;
            var           screenCenter    = new Vector2(_graphics.Viewport.Bounds.Width / 2, _graphics.Viewport.Bounds.Height / 2);

            ShortShip shortShip = new ShortShip(TeamType.Player, "GustoMap", new Vector2(-100, -600), _content, _graphics);

            shortShip.shipInterior.interiorId = Guid.NewGuid();
            BoundingBoxLocations.interiorMap.Add(shortShip.shipInterior.interiorId, shortShip.shipInterior);

            BaseShip baseShip = new BaseShip(TeamType.Player, "GustoMap", new Vector2(-300, -600), _content, _graphics);

            baseShip.shipInterior.interiorId = Guid.NewGuid();
            BoundingBoxLocations.interiorMap.Add(baseShip.shipInterior.interiorId, baseShip.shipInterior);

            BaseShip baseShipAI = new BaseShip(TeamType.A, "Usopp", new Vector2(500, -140), _content, _graphics);

            baseShipAI.shipInterior.interiorId = Guid.NewGuid();
            BoundingBoxLocations.interiorMap.Add(baseShipAI.shipInterior.interiorId, baseShipAI.shipInterior);

            TeePee teePee = new TeePee(TeamType.A, "Gianna", new Vector2(340, -850), _content, _graphics);

            teePee.structureInterior.interiorId = Guid.NewGuid();
            BoundingBoxLocations.interiorMap.Add(teePee.structureInterior.interiorId, teePee.structureInterior);

            BaseTribal    baseTribalLand = new BaseTribal(TeamType.A, "Gianna", giannaLandTiles[RandomEvents.rand.Next(giannaLandTiles.Count)].location, _content, _graphics);
            BaseCat       baseCatLand    = new BaseCat(TeamType.B, "SnooCat", scLandTiles[RandomEvents.rand.Next(scLandTiles.Count)].location, _content, _graphics);
            Chicken       chickenLand    = new Chicken(TeamType.Animal, "Gianna", giannaLandTiles[RandomEvents.rand.Next(giannaLandTiles.Count)].location, _content, _graphics);
            Snake         snakeLand      = new Snake(TeamType.Animal, "Usopp", usoppLandTiles[RandomEvents.rand.Next(usoppLandTiles.Count)].location, _content, _graphics);
            BlueBird      blueBird       = new BlueBird(TeamType.Animal, "Usopp", usoppLandTiles[RandomEvents.rand.Next(usoppLandTiles.Count)].location, _content, _graphics);
            Tower         tower          = new BaseTower(TeamType.B, "GustoMap", new Vector2(-1600, -1500), _content, _graphics);
            ClayFurnace   furnace        = new ClayFurnace(TeamType.Player, "GustoMap", new Vector2(180, 140), _content, _graphics);
            CraftingAnvil craftingAnvil  = new CraftingAnvil(TeamType.Player, "GustoMap", new Vector2(120, 40), _content, _graphics);
            BaseBarrel    barrelLand     = new BaseBarrel(TeamType.A, "GustoMap", new Vector2(-20, -160), _content, _graphics);
            BaseBarrel    barrelOcean    = new BaseBarrel(TeamType.A, "GustoMap", new Vector2(380, -90), _content, _graphics);
            BaseChest     chestLand      = new BaseChest(TeamType.A, "GustoMap", new Vector2(100, -120), _content, _graphics);
            CampFire      campfire       = new CampFire(TeamType.A, "GustoMap", new Vector2(70, -350), _content, _graphics);

            Shovel shovel = new Shovel(TeamType.A, "GustoMap", new Vector2(200, -330), _content, _graphics);

            shovel.onGround = true;
            Pickaxe pickaxe = new Pickaxe(TeamType.Player, "GustoMap", new Vector2(130, -430), _content, _graphics);

            pickaxe.onGround = true;
            //Pistol pistol = new Pistol(TeamType.A, "GustoMap", new Vector2(250, -300), _content, _graphics);
            //pistol.amountStacked = 1;
            //pistol.onGround = true;
            BaseCannon cannon = new BaseCannon(TeamType.A, "GustoMap", new Vector2(0, -450), _content, _graphics);

            cannon.onGround = true;
            Ballista ballista = new Ballista(TeamType.A, "GustoMap", new Vector2(-120, -550), _content, _graphics);

            ballista.onGround = true;
            CrossBow crossBow = new CrossBow(TeamType.A, "GustoMap", new Vector2(220, -350), _content, _graphics);

            crossBow.amountStacked = 1;
            crossBow.onGround      = true;
            ArrowItem arrows = new ArrowItem(TeamType.A, "GustoMap", new Vector2(210, -340), _content, _graphics);

            arrows.onGround      = true;
            arrows.amountStacked = 10;
            //PistolShotItem pistolAmmo = new PistolShotItem(TeamType.A, "GustoMap", new Vector2(220, -300), _content, _graphics);
            //pistolAmmo.amountStacked = 14;
            //pistolAmmo.onGround = true;
            CannonBallItem cannonAmmo = new CannonBallItem(TeamType.A, "GustoMap", new Vector2(200, -300), _content, _graphics);

            cannonAmmo.amountStacked = 10;
            cannonAmmo.onGround      = true;
            RustyHarpoonItem harpoonAmmo = new RustyHarpoonItem(TeamType.A, "GustoMap", new Vector2(-120, -550), _content, _graphics);

            harpoonAmmo.amountStacked = 10;
            harpoonAmmo.onGround      = true;
            Lantern lantern = new Lantern(TeamType.A, "GustoMap", new Vector2(180, -300), _content, _graphics);

            lantern.onGround = true;
            BasePlank basePlank = new BasePlank(TeamType.A, "GustoMap", new Vector2(150, -300), _content, _graphics);

            basePlank.onGround      = true;
            basePlank.amountStacked = 10;

            // Item utility is global and is accessed in main update, all items that are "dropped" or placed on the world view ground exist in this list (placable, invetory, etc)
            ItemUtility.ItemsToUpdate.Add(lantern);
            ItemUtility.ItemsToUpdate.Add(furnace);
            ItemUtility.ItemsToUpdate.Add(craftingAnvil);
            ItemUtility.ItemsToUpdate.Add(barrelLand);
            ItemUtility.ItemsToUpdate.Add(barrelOcean);
            ItemUtility.ItemsToUpdate.Add(chestLand);
            ItemUtility.ItemsToUpdate.Add(shovel);
            //ItemUtility.ItemsToUpdate.Add(pistol);
            ItemUtility.ItemsToUpdate.Add(cannon);
            ItemUtility.ItemsToUpdate.Add(ballista);
            ItemUtility.ItemsToUpdate.Add(crossBow);
            ItemUtility.ItemsToUpdate.Add(arrows);
            ItemUtility.ItemsToUpdate.Add(pickaxe);
            //ItemUtility.ItemsToUpdate.Add(pistolAmmo);
            ItemUtility.ItemsToUpdate.Add(cannonAmmo);
            ItemUtility.ItemsToUpdate.Add(harpoonAmmo);
            ItemUtility.ItemsToUpdate.Add(basePlank);
            ItemUtility.ItemsToUpdate.Add(campfire);

            UpdateOrder.Add(shortShip);
            UpdateOrder.Add(baseShip);
            UpdateOrder.Add(baseShipAI);
            UpdateOrder.Add(player);
            UpdateOrder.Add(baseTribalLand);
            UpdateOrder.Add(baseCatLand);
            UpdateOrder.Add(chickenLand);
            UpdateOrder.Add(blueBird);
            UpdateOrder.Add(snakeLand);
            UpdateOrder.Add(tower);
            UpdateOrder.Add(teePee);

            // interior set
            BaseTribal baseTribalInShip = new BaseTribal(TeamType.A, "GustoMap", Vector2.Zero, _content, _graphics);

            baseTribalInShip.npcInInterior = baseShipAI.shipInterior;
            baseShipAI.shipInterior.interiorObjects.Add(baseTribalInShip);

            ready = true;
        }