示例#1
0
 /// <summary>
 /// Létrehoz egy feladatot a megadott típussal és célponttal
 /// </summary>
 /// <param name="Type">A feladat típusa</param>
 /// <param name="Item">A feladat célpontja</param>
 public Task(TaskType Type, Items.ItemBase Item)
 {
     if (Type == TaskType.Any) { throw new ArgumentException("TaskType.Any cannot be used here"); }
     this.Type = Type;
     this.Item = Item;
     this.AssignedSince = Statistics.CurrentLoop;
 }
示例#2
0
 public Items.ItemBase Unequip()
 {
     if (AttachedItems.IsEmpty())
     {
         return(null);
     }
     Items.ItemBase ret = AttachedItems.GetBag()[0];
     AttachedItems.RemoveItem(ret);
     return(ret);
 }
示例#3
0
 private void OnCollisionStay2D(Collision2D other)
 {
     if (currentAction != Actions.Holding && pick.ButtonDown && other.gameObject.tag == "Item")
     {
         //pick up a repickable item
         HeldItem = other.gameObject.GetComponent <Items.ItemBase>();
         HeldItem.Pick();
         currentAction = Actions.Holding;
     }
 }
示例#4
0
 private void OnTriggerStay2D(Collider2D other)
 {
     if (currentAction != Actions.Holding && pick.ButtonDown && other.tag == "ItemSpawn")
     {
         //pull an item out of ground
         HeldItem = Instantiate(other.GetComponent <Items.Grass>().item).GetComponent <Items.ItemBase>();
         HeldItem.Pick();
         Destroy(other.gameObject);
         currentAction = Actions.Holding;
     }
 }
示例#5
0
 public void TradeBuy(Items.ItemBase ItemToBuy)
 {
     Characters.Hero hero = Characters.Hero.GetInstance(Hero.ClassSpec.WARRIOR);
     foreach (Items.ItemBase item in resources.ItemList)
     {
         if (item == ItemToBuy && item.Price <= resources.gold)
         {
             hero.heroresources.gold += item.Price;
             resources.ItemList.Add(item);
             resources.gold -= item.Price;
             hero.heroresources.ItemList.Remove(item);
             Console.WriteLine($"You have sold '{item.Name}' for {item.Price} gold. Current gold: {hero.heroresources.gold}");
             break;
         }
         else
         {
             Console.WriteLine("Something gone wrong");
         }
     }
 }
示例#6
0
        public void EquipItem(Items.ItemBase item)
        {
            int tmp = 0;

            foreach (Items.ItemBase i in heroresources.ItemList)
            {
                if (i == item)
                {
                    Console.WriteLine("you have equiped a {0} in {1} slot", i.Name, i.itemSlot);
                    attackBehaviour = new CharactersActions.AttackWithWeapon();
                    heroresources.ItemList.Remove(i);
                    tmp++;
                    break;
                }
            }
            if (tmp == 0)
            {
                Console.WriteLine("You dont have such an item: {0}", item.Name);
            }
        }
示例#7
0
        public void TradeSell(Items.ItemBase ItemToSell)
        {
            int tmp = 0;

            Characters.Hero hero = Characters.Hero.GetInstance(Hero.ClassSpec.WARRIOR);
            foreach (Items.ItemBase item in resources.ItemList)
            {
                if (item == ItemToSell && item.Price <= hero.heroresources.gold)
                {
                    hero.heroresources.gold -= item.Price;
                    hero.heroresources.ItemList.Add(item);
                    resources.gold += item.Price;
                    resources.ItemList.Remove(item);
                    Console.WriteLine($"You have bought '{item.Name}' for {item.Price} gold. Current gold: {hero.heroresources.gold}");
                    tmp++;
                    break;
                }
            }
            if (tmp == 0)
            {
                Console.WriteLine("Something gone wrong. Mb you are cut on money))");
            }
        }
示例#8
0
 public abstract bool Equip(Items.ItemBase I);