Ejemplo n.º 1
0
	public void init (FightScreen fightScreen, PotionBag potionBag) {
		this.fightScreen = fightScreen;
		this.potionBag = potionBag;
		location = GameObject.FindGameObjectWithTag("LocationScreen").GetComponent<Location>();
		render = transform.Find("WinImage").GetComponent<SpriteRenderer>();
		bg = transform.Find("BG");
		valuesHolder = transform.Find("ValuesHolder");
//		rankPointsValue = valuesHolder.Find("RankPointsValue").GetComponent<TextMesh>();
		goldValue = valuesHolder.Find("GoldValue").GetComponent<TextMesh>();
		newLevelLabel = valuesHolder.Find("NewLevelLabel").GetComponent<TextMesh>();

//		MeshRenderer mesh = valuesHolder.Find("RankPointsLabel").GetComponent<MeshRenderer>();
//		mesh.sortingLayerName = "FightResultLayer";
//		mesh.sortingOrder = 2;
		MeshRenderer mesh = valuesHolder.Find("GoldLabel").GetComponent<MeshRenderer>();
		mesh.sortingLayerName = "FightResultLayer";
		mesh.sortingOrder = 2;
//		mesh = rankPointsValue.GetComponent<MeshRenderer>();
//		mesh.sortingLayerName = "FightResultLayer";
//		mesh.sortingOrder = 2;
		mesh = goldValue.GetComponent<MeshRenderer>();
		mesh.sortingLayerName = "FightResultLayer";
		mesh.sortingOrder = 2;
		mesh = newLevelLabel.GetComponent<MeshRenderer>();
		mesh.sortingLayerName = "FightResultLayer";
		mesh.sortingOrder = 2;

		newLevelLabel.gameObject.SetActive(false);
		valuesHolder.gameObject.SetActive(false);

		transform.Find("ClickText").GetComponent<StrokeText>().init("FightResultLayer", 10);
		gameObject.SetActive(false);
	}
Ejemplo n.º 2
0
	public void init () {
		elementsHolder = transform.Find("ElementsHolder").GetComponent<ElementsHolder>();
		iconsHolderRender = elementsHolder.GetComponent<SpriteRenderer>();
		fightEffectPlayer = transform.Find("FightEffectPlayer").GetComponent<FightEffectPlayer>();
		elementEffectPlayer = transform.Find("ElementEffectPlayer").GetComponent<ElementEffectPlayer>();
		fightInterface = transform.Find("FightInterface").GetComponent<FightInterface>();
		enemy = transform.Find("Enemy").GetComponent<Enemy>();
		resultScreen = transform.Find("FightResultScreen").GetComponent<FightResultScreen>();
		enemyDeadAnimator = transform.Find("EnemyDeadAnim").GetComponent<Animator>();
		fightProcessor = GetComponent<FightProcessor>();
		deadStone = enemyDeadAnimator.transform.Find("DeadStone");
		enemyPos = enemy.transform.localPosition;
		potionBag = Vars.gameplay.getPotionBag();
		elementsHolder.init();
		enemy.init();
		resultScreen.init(this, potionBag);
		fightInterface.init();
		elementEffectPlayer.init(this, enemy);
		fightProcessor.init(this, elementsHolder, enemy, potionBag);

		elementsHolder.gameObject.SetActive(true);
		fightInterface.gameObject.SetActive(true);
		enemyDeadAnimator.gameObject.SetActive(false);
		gameObject.SetActive(false);
	}
Ejemplo n.º 3
0
	public void init () {
		Transform equipments = transform.Find("EquipmentHolders");
		equipments.gameObject.SetActive(true);
		EquipmentHolder holder;
		for (int i = 0; i < equipments.childCount; i++) {
			holder = equipments.GetChild(i).GetComponent<EquipmentHolder>();
			holder.init(this);
			equipmentHolders.Add(holder);
		}
		potionBag = Vars.gameplay.getPotionBag();
		foreach (PotionHolder pHolder in potionBag.getPotionHolders()) {
			equipmentHolders.Add(pHolder);
		}

		inventoryManipulator = GetComponent<InventoryManipulator>();
		inventoryManipulator.init(equipmentHolders);

		Transform attributes = transform.Find("Attributes");
		damageValue = attributes.Find("DamageValue").GetComponent<StrokeText>();
		armorValue = attributes.Find("ArmorValue").GetComponent<StrokeText>();
		strengthValue = attributes.Find("StrengthValue").GetComponent<StrokeText>();
		enduranceValue = attributes.Find("EnduranceValue").GetComponent<StrokeText>();
		agilityValue = attributes.Find("AgilityValue").GetComponent<StrokeText>();
		luckValue = attributes.Find("LuckValue").GetComponent<StrokeText>();
		setLayersForText(attributes);
		addAttributes = attributes.Find("AddAttributes").GetComponent<AddAttributes>();
		addAttributes.init();
		transform.Find("BG").gameObject.SetActive(true);
		attributes.gameObject.SetActive(true);
		gameObject.SetActive(false);
	}
Ejemplo n.º 4
0
 public void SellBackPotion(int inputNumber)
 {
     if (PotionBag.Any())
     {
         this.Gold += (this.PotionBag[inputNumber].Price - 1);
         this.PotionBag.RemoveAt(inputNumber);
     }
 }
Ejemplo n.º 5
0
    void Awake() {
        Vars.gameplay = this;
		Hero.init();
		GetComponent<Imager>().init();
		WorkbenchSchemeDescriptor.fillSchemesMap();
		GameObject.FindGameObjectWithTag("UserInterface").GetComponent<UserInterface>().init();
        GetComponent<ItemFactory>().init();

        itemDescriptor = GameObject.FindGameObjectWithTag("ItemDescriptor").GetComponent<ItemDescriptor>();
        itemDescriptor.init();

		potionBag = GameObject.FindGameObjectWithTag("PotionBag").GetComponent<PotionBag>();
		potionBag.init();

		inventory = GameObject.FindGameObjectWithTag("Inventory").GetComponent<Inventory>();
		inventory.init();
        
        GameObject[] scrs = GameObject.FindGameObjectsWithTag("GameScreen");

        foreach (GameObject gameObj in scrs) {
            GameScreen screen = gameObj.GetComponent<GameScreen>();
            switch (screen.getScreenType()) {
				case ScreenType.CITY: city = screen as CityScreen; break;
				case ScreenType.GUILD: guild = screen as GuildScreen; break;
				case ScreenType.BLACKSMITH: blacksmith = screen as BlacksmithScreen; break;
				case ScreenType.HEALER: healer = screen as HealerScreen; break;
				case ScreenType.HOME: home = screen as HomeScreen; break;
            }
            screens.Add(screen);
            screen.init();
            screen.hideScreen();
        }

		GetComponent<InputProcessor>().init(screens);

        fightScreen = GameObject.FindGameObjectWithTag("FightScreen").GetComponent<FightScreen>();
        equipmentScreen = GameObject.FindGameObjectWithTag("EquipmentScreen").GetComponent<EquipmentScreen>();

        fightScreen.init();
        equipmentScreen.init();

		buffShop = healer.getBuffShop();
		questBoard = guild.getQuestBoard();

		equipmentScreen.setBuffShop(buffShop);
		equipmentScreen.setQuestInformation(questBoard.getQuestInformation());

        worldMap = GameObject.FindGameObjectWithTag("WorldMap").GetComponent<WorldMap>();
        worldMap.init();

        QuestParser.parseQuests(questsFile);

        showScreen(ScreenType.CITY);
    }
Ejemplo n.º 6
0
    // Use this for initialization
    void Start()
    {
        potionBag = GetComponent <PotionBag>();

        ingredientsBag = new List <List <CraftingDataBase.IngredientList> >();

        //Test
        PickUpIngredient(CraftingDataBase.IngredientList.SpeedFlower, 2);
        PickUpIngredient(CraftingDataBase.IngredientList.FireStone, 2);
        PickUpIngredient(CraftingDataBase.IngredientList.OmniaStone, 10);
        PickUpIngredient(CraftingDataBase.IngredientList.IceStone, 2);
        PickUpIngredient(CraftingDataBase.IngredientList.MeteoriteShard, 2);
        PickUpIngredient(CraftingDataBase.IngredientList.MedHerb, 2);
    }
Ejemplo n.º 7
0
    void Awake()
    {
        m_potsImg = new PotSelectImg[5];

        m_potsImg[0] = GameObject.Find("Img1").GetComponent <PotSelectImg>();
        m_potsImg[1] = GameObject.Find("Img2").GetComponent <PotSelectImg>();
        m_potsImg[2] = GameObject.Find("Img3").GetComponent <PotSelectImg>();
        m_potsImg[3] = GameObject.Find("Img4").GetComponent <PotSelectImg>();
        m_potsImg[4] = GameObject.Find("Img5").GetComponent <PotSelectImg>();

        m_pots     = GameObject.FindGameObjectWithTag("Player").GetComponent <PotionBag>();
        m_potsList = m_pots.GetPotiosBag();

        m_initilized = false;
        m_alreadySet = false;
    }
Ejemplo n.º 8
0
        public void UseHealthPotion(int inputNumber)
        {
            if (PotionBag.Any())
            {
                int roundHP;
                roundHP = this.CurrentHP + this.PotionBag[inputNumber].HealthRestored;
                if (roundHP <= this.OriginalHP)
                {
                    this.CurrentHP = roundHP;
                }
                else
                {
                    this.CurrentHP = this.OriginalHP;
                }

                this.PotionBag.RemoveAt(inputNumber);
            }
        }
Ejemplo n.º 9
0
	public void init (FightScreen fightScreen, ElementsHolder elementsHolder, Enemy enemy, PotionBag potionBag) {
		this.fightScreen = fightScreen;
		this.elementsHolder = elementsHolder;
		this.enemy = enemy;
		this.potionBag = potionBag;
	}
Ejemplo n.º 10
0
 public void takePotion(Potion potion)
 {
     usedPotion = PotionBag.IndexOf(potion); //recherche le bon type de potion
     PotionBag.Remove(usedPotion);           //la retire du sac
 }
Ejemplo n.º 11
0
 public void addPotion() //ranger une potion dans le sac
 {
     PotionBag.Add(this);
 }
Ejemplo n.º 12
0
        public void ShowInventory()
        {
            int num1  = 1;
            int num2  = 1;
            var input = "0";

            while (input != "9")
            {
                Console.WriteLine("*****  INVENTORY ******");
                Console.WriteLine("Weapons: ");

                foreach (var weapon in this.WeaponsBag)
                {
                    Console.WriteLine(num1 + " " + weapon.Name + " of " + weapon.Strength + " Strength");
                    num1++;
                }

                Console.WriteLine("Armor: ");

                foreach (var armor in this.ArmorsBag)
                {
                    Console.WriteLine(num2 + " " + armor.Name + " of " + armor.Defense + " Defense");
                    num2++;
                }
                ;

                Console.WriteLine("Shield: ");

                foreach (var shield in this.ShieldBag)
                {
                    Console.WriteLine(num2 + " " + shield.Name + " of " + shield.Defense + " Defense");
                    num2++;
                }
                ;

                Console.WriteLine("Potions: ");

                foreach (var potion in this.PotionBag)
                {
                    Console.WriteLine(num1 + " " + potion.Name + " of " + potion.HealthRestored + " Health");
                    num1++;
                }
                if (EquippedWeapon != null)
                {
                    Console.WriteLine("Equipped Weapon: " + EquippedWeapon.Name);
                }
                else
                {
                    Console.WriteLine("Equipped Weapon: None");
                };

                if (EquippedArmor != null)
                {
                    Console.WriteLine("Equipped Armor: " + EquippedArmor.Name);
                }
                else
                {
                    Console.WriteLine("Equipped Armor: None");
                };

                if (EquippedShield != null)
                {
                    Console.WriteLine("Equipped Shield: " + EquippedShield.Name);
                }
                else
                {
                    Console.WriteLine("Equipped Shield: None");
                };

                Console.WriteLine("Gold: " + Gold);
                Console.WriteLine("Please choose an option by entering a number.");
                Console.WriteLine("1. Equip Armor");
                Console.WriteLine("2. Equip Weapon");
                Console.WriteLine("3. UnEquip Armor");
                Console.WriteLine("4. UnEquip Weapon");
                Console.WriteLine("5. Heal");
                Console.WriteLine("6. Sell");
                Console.WriteLine("7. Equip Shield");
                Console.WriteLine("8. UnEquip Shield");
                Console.WriteLine("9. Return to Main Menu");


                input = Console.ReadLine();
                int inputNumber = Int32.Parse(input) - 1;

                if (input == "1")
                {
                    int num3 = 1;
                    Console.WriteLine("Please choose the armor to equip by entering a number.");
                    foreach (var armor in this.ArmorsBag)
                    {
                        Console.WriteLine(num3 + " " + armor.Name + " of " + armor.Defense + " Defense");
                        num3++;
                    }
                    ;
                    input       = Console.ReadLine();
                    inputNumber = Int32.Parse(input) - 1;
                    this.EquipArmor(inputNumber);
                }
                else if (input == "2")
                {
                    int num4 = 1;
                    Console.WriteLine("Please choose the weapon to equip by entering a number.");
                    foreach (var weapon in this.WeaponsBag)
                    {
                        Console.WriteLine(num4 + " " + weapon.Name + " of " + weapon.Strength + " Strength");
                        num4++;
                    }
                    input       = Console.ReadLine();
                    inputNumber = Int32.Parse(input) - 1;
                    this.EquipWeapon(inputNumber);
                }
                else if (input == "3")
                {
                    this.TotalDefense -= this.EquippedArmor.Defense;
                    this.EquippedArmor = null;
                }
                else if (input == "4")
                {
                    this.TotalStrength -= this.EquippedWeapon.Strength;
                    this.EquippedWeapon = null;
                }
                else if (input == "8")
                {
                    this.TotalDefense  -= this.EquippedShield.Defense;
                    this.EquippedShield = null;
                }
                else if (input == "5")
                {
                    Console.WriteLine("Please choose the potion to heal with by entering a number.");
                    int i;
                    for (i = 0; i < this.PotionBag.Count(); i++)
                    {
                        Console.WriteLine($"{i + 1} {this.PotionBag[i].Name} of {this.PotionBag[i].HealthRestored} Health");
                    }

                    input       = Console.ReadLine();
                    inputNumber = Int32.Parse(input) - 1;
                    this.UseHealthPotion(inputNumber);
                }
                else if (input == "6")
                {
                    var inputKey = "0";
                    while (inputKey != "4")
                    {
                        Console.WriteLine("Please chose which item type to sell by entering a number.");
                        Console.WriteLine("1. Armor");
                        Console.WriteLine("2. Weapon");
                        Console.WriteLine("3. Potion");
                        Console.WriteLine("4. Return");
                        inputKey = Console.ReadLine();
                        var inputNumber2 = Int32.Parse(inputKey) - 1;

                        if (inputKey == "1")
                        {
                            if (ArmorsBag.Any())
                            {
                                Console.WriteLine("Please choose the Armor to sell with by entering a number.");
                                int i;
                                for (i = 0; i < this.ArmorsBag.Count(); i++)
                                {
                                    Console.WriteLine($"{i + 1} {this.ArmorsBag[i].Name} of {this.ArmorsBag[i].Defense} Defence for {this.ArmorsBag[i].Price - 1} Gold");
                                }
                                inputKey     = Console.ReadLine();
                                inputNumber2 = Int32.Parse(inputKey) - 1;
                                SellBackArmor(inputNumber2);
                            }
                            else
                            {
                                Console.WriteLine("Armor Bag Empty");
                            }
                        }
                        else if (inputKey == "2")
                        {
                            if (WeaponsBag.Any())
                            {
                                Console.WriteLine("Please choose the Weapon to sell by entering a number.");
                                int i;
                                for (i = 0; i < this.WeaponsBag.Count(); i++)
                                {
                                    Console.WriteLine($"{i + 1} {this.WeaponsBag[i].Name} of {this.WeaponsBag[i].Strength} Strength, Selling Price: {this.WeaponsBag[i].Price - 1}");
                                }
                                inputKey     = Console.ReadLine();
                                inputNumber2 = Int32.Parse(inputKey) - 1;
                                SellBackWeapon(inputNumber2);
                            }
                            else
                            {
                                Console.WriteLine("Weapon Bag Empty");
                            }
                        }
                        else if (inputKey == "3")
                        {
                            if (PotionBag.Any())
                            {
                                Console.WriteLine("Please choose the Potion to sell by entering a number.");
                                int i;
                                for (i = 0; i < this.PotionBag.Count(); i++)
                                {
                                    Console.WriteLine($"{i + 1} {this.PotionBag[i].Name} of {this.PotionBag[i].HealthRestored} Health for {this.PotionBag[i].Price - 1} Gold");
                                }
                                inputKey     = Console.ReadLine();
                                inputNumber2 = Int32.Parse(inputKey) - 1;
                                SellBackPotion(inputNumber2);
                            }
                            else
                            {
                                Console.WriteLine("Potion Bag Empty");
                            }
                        }
                    }
                }
                if (input == "7")
                {
                    int num3 = 1;
                    Console.WriteLine("Please choose the shield to equip by entering a number.");
                    foreach (var shield in this.ShieldBag)
                    {
                        Console.WriteLine(num3 + " " + shield.Name + " of " + shield.Defense + " Defense");
                        num3++;
                    }
                    ;
                    input       = Console.ReadLine();
                    inputNumber = Int32.Parse(input) - 1;
                    this.EquipShield(inputNumber);
                }
            }
        }
Ejemplo n.º 13
0
        static public void LoadProgress(bool currentSave)
        {
            int ID;
            int ILVL;

            if (!currentSave)
            {
                SaveFileMenu.isLoading = true;
                SaveFileHandler();

                if (!File.Exists(savename))
                {
                    Console.WriteLine("Данный файл не существует. Попробуйте ещё раз.");
                    LoadProgress(false);
                }
            }

            using (StreamReader sr = new StreamReader(savename))
            {
                try
                {
                    string line;

                    line          = sr.ReadLine();
                    City.cityBank = Convert.ToSingle(line);

                    line = sr.ReadLine();
                    LVL  = Convert.ToByte(line);

                    line = sr.ReadLine();
                    XP   = Convert.ToInt32(line);

                    MaxXP = GetMaxXP();

                    line = sr.ReadLine();
                    HP   = Convert.ToInt32(line);

                    MaxHP = GetMaxHP();

                    line  = sr.ReadLine();
                    Money = Convert.ToInt32(line);

                    line = sr.ReadLine();
                    City.currentPlotState = (City.QuestState)Enum.Parse(typeof(City.QuestState), line);

                    line     = sr.ReadLine();
                    questNum = Convert.ToInt32(line);

                    line           = sr.ReadLine();
                    City.wasInCity = Convert.ToBoolean(line);

                    line          = sr.ReadLine();
                    MasteryPoints = Convert.ToInt32(line);

                    line     = sr.ReadLine();
                    towerLoc = Convert.ToBoolean(line);

                    line           = sr.ReadLine();
                    Tower.mageName = line;

                    line = sr.ReadLine();
                    Tower.wasIntroduced = Convert.ToBoolean(line);

                    line       = sr.ReadLine();
                    gotAnarchy = Convert.ToBoolean(line);

                    line   = sr.ReadLine();
                    ahShit = Convert.ToBoolean(line);

                    line     = sr.ReadLine();
                    brokeOut = Convert.ToBoolean(line);

                    line      = sr.ReadLine();
                    BHDweller = Convert.ToBoolean(line);

                    #region Inventory Loading (Leave for last)

                    for (int i = 0; i < Inventory.Length + Passive_Inventory.Length; i++)
                    {
                        line = sr.ReadLine();
                        ID   = Convert.ToInt16(line);
                        // This is absolutely f*****g horrible and disgusting, but I have no other clue on how to implement this. ffs!

                        /*
                         * Let me explain why I have to resort to such measures: Even though I could have a list of Items from wich I could pull from in
                         * the previous version of loading/saving the inventory, that would lead to something unpleasant: if you have Ying and have
                         * leveled it up, then each new Ying you get will be leveled up as well. See why this is an issue?
                         *
                         * Basically, all I want to do is make unique examples of Items everytime the player gets one. Which is not ideal anyway.
                         */

                        Item buffer;
                        switch (ID)
                        {
                        case 0:
                            buffer = new None_Item();
                            break;

                        case 1:
                            buffer = new Default_A();
                            break;

                        case 2:
                            buffer = new Ying_A();
                            break;

                        case 3:
                            buffer = new Default_W();
                            break;

                        case 4:
                            buffer = new Yang_W();
                            break;

                        case 5:
                            buffer = new PotionBag();
                            break;

                        default:
                            buffer = new None_Item();
                            break;
                        }

                        line = sr.ReadLine();
                        ILVL = Convert.ToInt16(line);

                        buffer.LVL = ILVL;
                        buffer.Upgrade();

                        if (i >= Inventory.Length)
                        {
                            Passive_Inventory[i - Inventory.Length] = buffer;
                        }
                        else
                        {
                            Inventory[i] = buffer;
                        }
                    }
                    #endregion
                }
                catch
                {
                    Console.WriteLine("Загружаемый файл, скорее всего, повреждён.");
                    LoadProgress(false);
                }

                Console.WriteLine("Файл загружен");
            }
        }