Esempio n. 1
0
        public void DrinkPotion(IPotion potion)
        {
            if (Health == 0)
            {
                Health = 0;
            }
            if (Health + potion.Healing > 10)
            {
                Health = 10;
            }
            if (Health != 0 && (Health + potion.Healing) <= 10)
            {
                Health += potion.Healing;
            }

            if (Health == 10)
            {
                State = FighterState.Healthy;
            }
            if (Health < 10)
            {
                State = FighterState.Hurt;
            }
            if (Health == 0)
            {
                State = FighterState.Dead;
            }
        }
Esempio n. 2
0
 // Update is called once per frame
 void Update()
 {
     if (CanSpawn && !gameover)
     {
         spawnTimer += Time.deltaTime;
         if (spawnTimer >= spawnTime)
         {
             spawnTimer = 0;
             IPotion pooledPotion = PoolManager.instance.GetPooledPotion();
             if (pooledPotion != null)
             {
                 pooledPotion.Spawn(spawnPosition.position, RandomizeType(), speed);
                 inGamePotions++;
                 PotionSpawned++;
                 if (inGamePotions >= maxPotionSpawn)
                 {
                     CanSpawn   = false;
                     spawnTimer = spawnTime;
                 }
                 if (PotionSpawned >= 10)
                 {
                     PotionSpawned = 0;
                     speed        += 1f;
                     level++;
                     if (level == 2 || level == 7)
                     {
                         maxPotionSpawn++;
                     }
                 }
             }
         }
     }
 }
Esempio n. 3
0
 public void PotionDestroy(IPotion _potion)
 {
     inGamePotions--;
     if (inGamePotions == 0)
     {
         CanSpawn = true;
     }
 }
Esempio n. 4
0
 public void SelectPotion(int index)
 {
     if (index < 0 || index >= potions.Count)
     {
         return;
     }
     activePotion = potions[index];
 }
Esempio n. 5
0
 public StandardRoom()
 {
     WasVisited = false;
     HasPillar  = false;
     Potion     = PotionFactory.MakeRandomPotion();
     Trap       = TrapFactory.MakeRandomTrap();
     Enemy      = MonsterFactory.MakeRandomMonster();
 }
Esempio n. 6
0
 private void PotionDestroy(IPotion potion)
 {
     if (potionBreakClip != null)
     {
         potionBreakSource.clip = potionBreakClip;
         potionBreakSource.Play();
     }
 }
Esempio n. 7
0
    void AddPotion(IPotion item)
    {
        GameObject newDisplayObject = Instantiate(potionDisplayPrefab, scrollRect.content);

        newDisplayObject.name = potionDisplayPrefab.name + " " + item.itemName;
        PotionInventoryDisplay newDisplay = newDisplayObject.GetComponent <PotionInventoryDisplay>();

        newDisplay.SetItem(item, amounts[item]);
        displays.Add(item, newDisplay);
    }
Esempio n. 8
0
 public override void SetItem(IItem itemToDisplay, int amount)
 {
     if (!(itemToDisplay is IPotion))
     {
         return;
     }
     base.SetItem(itemToDisplay, amount);
     potion       = (IPotion)itemToDisplay;
     statBox.text = potion.stat + ": +" + potion.statValue;
 }
Esempio n. 9
0
 // Use this for initialization
 void Start()
 {
     EventManager.OnPotionDestroy += OnPotionDestroyed;
     for (int i = 0; i < ammount; i++)
     {
         IPotion instantiatedPotion = Instantiate(potionPrefab, transform).GetComponent <IPotion>();
         instantiatedPotion.gameObject.transform.position = poolPosition;
         instantiatedPotion.CurrentState = PotionState.inPool;
         pooledPotions.Add(instantiatedPotion);
     }
 }
Esempio n. 10
0
 public void Attack(Direction direction, Random random)
 {
     if (equippedWeapon != null)
     {
         equippedWeapon.Attack(direction, random);
         if (equippedWeapon is IPotion)
         {
             IPotion potion = equippedWeapon as IPotion;
             weapons.Remove(equippedWeapon);
         }
     }
 }
Esempio n. 11
0
    public void StockPotion(IPotion item)
    {
        bool stocked = stock.AddPotion(item);

        if (stocked && state != GameStates.Purchasing)
        {
            if (!ItemInStock(item))
            {
                return;
            }
            inventory.DecrementAmount(item);
        }
    }
Esempio n. 12
0
 public void PotionDestroyed(IPotion _potion)
 {
     inGamePotions.Remove(_potion);
     if (_potion.isRefilled())
     {
         score += 100;
         ui.ScoreUpdate(score);
     }
     else if (_potion.isWrong())
     {
         EventManager.GameOver();
     }
 }
Esempio n. 13
0
 public void UseItem(IItem item)
 {
     if (item is IEquipment)
     {
         IEquipment equipment = (IEquipment)item;
         ChangeOffense(equipment.itemOffense);
         ChangeDefense(equipment.itemDefense);
     }
     else if (item is IPotion)
     {
         IPotion potion = (IPotion)item;
         potion.UsePotion(this);
     }
 }
Esempio n. 14
0
 public void UseItem(IItem item)
 {
     if (item is IEquipment)
     {
         IEquipment equipment = (IEquipment)item;
         GameManager.instance.IncreaseActiveQuestDefense(equipment.itemOffense);
         GameManager.instance.IncreaseActiveQuestAttack(equipment.itemDefense);
     }
     else if (item is IPotion)
     {
         IPotion potion = (IPotion)item;
         potion.UsePotion(GameManager.instance.GetActiveQuest());
     }
 }
Esempio n. 15
0
 public void UsePoition(int poitionNumber)
 {
     if (poitionNumber == 1)
     {
         IPotion potion = (IPotion)_player.Equipped.GetItem(InventorySlotId.POTION1);
         _player.TakeDamage(-potion.HealValue);
         _player.Equipped.Unequip(InventorySlotId.POTION1);
     }
     else
     {
         IPotion potion = (IPotion)_player.Equipped.GetItem(InventorySlotId.POTION2);
         _player.TakeDamage(-potion.HealValue);
         _player.Equipped.Unequip(InventorySlotId.POTION2);
     }
 }
Esempio n. 16
0
        public bool CheckPotionUsed(string potionName)
        {
            IPotion potion;
            bool    potionUsed = false;

            foreach (Weapon weapon in inventory)
            {
                if (weapon.Name == potionName && weapon is IPotion)
                {
                    potion     = weapon as IPotion;
                    potionUsed = potion.Used;
                }
            }

            return(potionUsed);
        }
Esempio n. 17
0
 public void Attack(Direction direction, Random random)
 {
     if (EquippedWeapon != null)
     {
         EquippedWeapon.Attack(direction, random);
         if (EquippedWeapon is IPotion)
         {
             IPotion potion = EquippedWeapon as IPotion;
             potion.Used = true;
         }
     }
     // Attack Rectangle
     for (int i = 0; i < 4; ++i)
     {
         RectOfAttackRange[i].Location = base.Location;
     }
 }
Esempio n. 18
0
        public void Attack(Direction direction, Random random)
        {
            if (equippedWeapon != null)
            {
                equippedWeapon.Attack(direction, random);

                // Checking if equipped weapon is a potion.  If so, and it was used, removes it from inventory
                if (equippedWeapon is IPotion)
                {
                    IPotion potion = equippedWeapon as IPotion;
                    if (potion.Used)
                    {
                        inventory.Remove(equippedWeapon);
                        equippedWeapon = null;
                    }
                }
            }
        }
Esempio n. 19
0
 public void Attack(Direction direction, Random random)
 {
     if (equippedWeapon != null)
     {
         if (equippedWeapon is IPotion)
         {
             IPotion potion = equippedWeapon as IPotion;
             if (!potion.Used)
             {
                 equippedWeapon.Attack(direction, random);
             }
         }
         else
         {
             equippedWeapon.Attack(direction, random);
         }
     }
 }
Esempio n. 20
0
 public void Attack(Direction direction, Random random)
 {
     if (equippedWeapon != null)
     {
         equippedWeapon.Attack(direction, random);
         if (equippedWeapon is IPotion)
         {
             IPotion temporary = equippedWeapon as IPotion;
             if (temporary.Used)
             {
                 inventory.Remove(equippedWeapon);
             }
         }
     }
     else
     {
         return;
     }
 }
Esempio n. 21
0
        public void AttemptDrinkPotion(string input)
        {
            int index = Inventory.FindIndex(item => item is IPotion && item.Name.Contains(input));

            if (index == -1)
            {
                OutputHelper.Display.StoreUserOutput(
                    Settings.FormatFailureOutputText(),
                    Settings.FormatDefaultBackground(),
                    Settings.DrinkPotionFailMessage());
            }
            else
            {
                IPotion potionToDrink = Inventory[index] as IPotion;
                potionToDrink.DrinkPotion(this);

                Inventory.RemoveAt(index);
            }
        }
Esempio n. 22
0
 public void Attack(Direction direction, Random random)
 {
     if (equippedWeapon != null)
     {
         if (equippedWeapon is IPotion)
         {
             IPotion potion = equippedWeapon as IPotion;
             if (potion.Used == false)
             {
                 equippedWeapon.Attack(direction, random);
                 inventory.Remove(equippedWeapon);
                 equippedWeapon = null;
             }
         }
         else
         {
             equippedWeapon.Attack(direction, random);
         }
     }
 }
Esempio n. 23
0
 public void AddItem(IItem item, int amount = 1)
 {
     if (items.Contains(item))
     {
         IncrementAmount(item, amount);
         return;
     }
     items.Add(item);
     amounts.Add(item, amount);
     if (item is IEquipment)
     {
         IEquipment equip = (IEquipment)item;
         AddEquipment(equip);
     }
     else if (item is IPotion)
     {
         IPotion potion = (IPotion)item;
         AddPotion(potion);
     }
 }
Esempio n. 24
0
    public bool AddPotion(IPotion item)
    {
        if ((!purchaseMode && stockDisplays.Count >= maxStock) || (purchaseMode && stockDisplays.Count >= maxStockPurchases))
        {
            return(false);
        }
        PotionStockDisplay potionStock = Instantiate(potionDisplayPrefab, stockRect.content).GetComponent <PotionStockDisplay>();

        potionStock.SetItem(item);
        stockDisplays.Add(potionStock);
        potionStocks.Add(potionStock);
        if (purchaseMode)
        {
            UpdateCost(item.GetBasePrice());
        }
        ResizeStockRect();
        if (stockDisplays.Count == maxStock)
        {
            ReadyToSell.Invoke(true);
        }
        return(true);
    }
Esempio n. 25
0
 public void Attack(Direction direction, Random random)
 {
     //si no tiene arma equipada sale
     //usa el método attack del arma equipada
     //verificar que es poción (if (this 'is' that))
     //  verificar que fue usada (as potion)
     //      eliminar del inventario y eliminar el arma equipada
     if (equipedWeapon == null)
     {
         return;
     }
     equipedWeapon.Attack(direction, random);
     if (equipedWeapon is IPotion)
     {
         IPotion potion = equipedWeapon as IPotion;
         if (potion.Used)
         {
             inventory.Remove(equipedWeapon);
             equipedWeapon = null;
         }
     }
 }
Esempio n. 26
0
 public AddOE(IPotion potion) : base(potion)
 {
 }
Esempio n. 27
0
 public AddLylack(IPotion potion) : base(potion)
 {
 }
Esempio n. 28
0
 public void addPotion(IPotion potion)
 {
     this.potions.Add(potion);
     this.sortedInventory.Add(potion);
 }
Esempio n. 29
0
 public AbstractFactoryDecorator(IPotion Potion)
 {
     m_DecoratedPotion = Potion;
 }
Esempio n. 30
0
 public AddRT(IPotion potion) : base(potion)
 {
 }
Esempio n. 31
0
 public AddSilver(IPotion potion) : base(potion)
 {
 }