Example #1
0
 //MEthod used to unequip items
 public void Unequip(Unlockables item)
 {
     //Checks to see if its unlocked
     if (item.Unlocked == true)
     {
         item.Equipped = false; //Sets the item as unequipped
     }
 }
Example #2
0
 //Mehtod to buy an item
 public void Buy(Unlockables item)
 {
     //Checks if the user has enough unlock points
     //to buy the item
     if (unlockPoints >= item.Cost)
     {
         item.Unlocked = true;      //Sets the item as unlocked.
         UnlockPoints -= item.Cost; //Takes the cost and subtracts from users current unlock points
     }
 }
Example #3
0
        //Method to equip unlocked items
        public void Equip(Unlockables item)
        {
            //Checks that the item is unlocked before equipping
            if (item.Unlocked == true)
            {
                //Loops through all the items
                //Sets all unlockables equip status as false
                for (int i = 0; i < itemsList.Count; i++)
                {
                    itemsList[i].Equipped = false;
                }

                item.Equipped = true; //Sets the item wanted to be equipped as true
            }
        }
Example #4
0
        //Constructor
        //Starts the points at 0
        //Has textureManager to load in textures for the items
        //And loads with it each unlockable (also adds each unloackable to list)
        public Unlockables(TextureManager textureManager)
        {
            unlockPoints        = 0;
            this.textureManager = textureManager;
            itemsDictionary     = new Dictionary <string, Unlockables>();
            itemsList           = new List <Unlockables>();

            output = new StreamWriter("unlockablesave.txt");

            //Gives the fez unlockable all its textures and cost
            //And adds it to the dictionary and list
            fez = new Unlockables(5, textureManager.FezRangedEnemy, textureManager.RightFezMelee1, textureManager.RightFezMelee2, textureManager.RightFezMelee3,
                                  textureManager.LeftFezMelee1, textureManager.LeftFezMelee2, textureManager.LeftFezMelee3);
            itemsDictionary.Add("Fez", fez);
            itemsList.Add(fez);

            ushanka = new Unlockables(5, textureManager.UshankaRangedEnemy, textureManager.RightUshankaMelee1, textureManager.RightUshankaMelee2, textureManager.RightUshankaMelee3,
                                      textureManager.LeftUshankaMelee1, textureManager.LeftUshankaMelee2, textureManager.LeftUshankaMelee3);
            itemsDictionary.Add("Ushanka", ushanka);
            itemsList.Add(ushanka);

            beret = new Unlockables(5, textureManager.BeretRangedEnemy, textureManager.RightBeretMelee1, textureManager.RightBeretMelee2, textureManager.RightBeretMelee3,
                                    textureManager.LeftBeretMelee1, textureManager.LeftBeretMelee2, textureManager.LeftBeretMelee3);
            itemsDictionary.Add("Beret", beret);
            itemsList.Add(beret);

            cowboy = new Unlockables(5, textureManager.CowboyRangedEnemy, textureManager.RightCowboyMelee1, textureManager.RightCowboyMelee2, textureManager.RightCowboyMelee3,
                                     textureManager.LeftCowboyMelee1, textureManager.LeftCowboyMelee2, textureManager.LeftCowboyMelee3);
            itemsDictionary.Add("Cowboy", cowboy);
            itemsList.Add(cowboy);

            sombrero = new Unlockables(5, textureManager.SombreroRangedEnemy, textureManager.RightSombreroMelee1, textureManager.RightSombreroMelee2, textureManager.RightSombreroMelee3,
                                       textureManager.LeftSombreroMelee1, textureManager.LeftSombreroMelee2, textureManager.LeftSombreroMelee3);
            itemsDictionary.Add("Sombrero", sombrero);
            itemsList.Add(sombrero);
        }