コード例 #1
0
ファイル: Task.cs プロジェクト: solymosi/hangyaboly
 /// <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
ファイル: Friend.cs プロジェクト: Shadowking1235/oop_laba1
 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
ファイル: Hero.cs プロジェクト: Shadowking1235/oop_laba1
        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
ファイル: Friend.cs プロジェクト: Shadowking1235/oop_laba1
        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);