Esempio n. 1
0
    void OnTriggerEnter2D(Collider2D other)
    {
        // If player collided with bow
        if (other.tag == "Player")
        {
            stat = other.GetComponent <StatCollectionClass>();
            Up   = other.GetComponent <ItemUpgrade>();
            // set item bow unlocked
            stat.itemBow = true;

            Up.BowLevel++;

            Up.BowDamage += 50;

            if (stat.ArmorEquip == false && stat.SwordEquip == false)
            {
                //add player attack damage with bow damage
                stat.damage += Up.BowDamage;

                stat.BowEquip = true;
            }
        }

        // Destroy the item
        Destroy(this.gameObject);
    }
Esempio n. 2
0
    void OnTriggerEnter2D(Collider2D other)
    {
        // If player collided with item armor
        if (other.tag == "Player") {

            stat=other.GetComponent<StatCollectionClass>();

            // set item armor unlocked
            stat.itemArmor = true;

            Up = other.GetComponent<ItemUpgrade>();

            Up.ArmorLevel++;

            Up.ArmorDamage+=1f;

            //if not equipment now just equip it
            if(stat.SwordEquip ==false && stat.BowEquip==false)
            {
                //add player defend with armor defend
                stat.defend+=Up.ArmorDamage;
                //set armor equip true
                stat.ArmorEquip = true;
            }

            // Destroy the item
            Destroy(this.gameObject);

        }
    }
Esempio n. 3
0
    void OnTriggerEnter2D(Collider2D other)
    {
        // If player collided with item Sword
        if (other.tag == "Player") {

            stat=other.GetComponent<StatCollectionClass>();

            Up = other.GetComponent<ItemUpgrade>();

            Destroy(this.gameObject);

            // set item sword unlocked
            stat.itemSword = true;

            Up.SwordLevel++;

            Up.SwordDamage+=100f;

            //if no equipment now just equip sword to player
            if(stat.ArmorEquip==false &&stat.BowEquip==false)
            {

                //add player attack damage with SwordDamage
                stat.damage+=Up.SwordDamage;

                //set sword equip to true
                stat.SwordEquip= true;
            }

            }

            // Destroy the item
    }
Esempio n. 4
0
    void OnTriggerEnter2D(Collider2D other)
    {
        // If player collided with item armor
        if (other.tag == "Player")
        {
            stat = other.GetComponent <StatCollectionClass>();

            // set item armor unlocked
            stat.itemArmor = true;

            Up = other.GetComponent <ItemUpgrade>();

            Up.ArmorLevel++;

            Up.ArmorDamage += 50f;

            //if not equipment now just equip it
            if (stat.SwordEquip == false && stat.BowEquip == false)
            {
                //add player defend with armor defend
                stat.defend += Up.ArmorDamage;
                //set armor equip true
                stat.ArmorEquip = true;
            }

            // Destroy the item
            Destroy(this.gameObject);
        }
    }
Esempio n. 5
0
    void OnTriggerEnter2D(Collider2D other)
    {
        // If player collided with item Sword
        if (other.tag == "Player")
        {
            stat = other.GetComponent <StatCollectionClass>();

            Up = other.GetComponent <ItemUpgrade>();

            Destroy(this.gameObject);


            // set item sword unlocked
            stat.itemSword = true;

            Up.SwordLevel++;

            Up.SwordDamage += 100f;

            //if no equipment now just equip sword to player
            if (stat.ArmorEquip == false && stat.BowEquip == false)
            {
                //add player attack damage with SwordDamage
                stat.damage += Up.SwordDamage;

                //set sword equip to true
                stat.SwordEquip = true;
            }
        }

        // Destroy the item
    }
Esempio n. 6
0
    void OnTriggerEnter2D(Collider2D other)
    {
        // If player collided with bow
        if (other.tag == "Player") {
            stat=other.GetComponent<StatCollectionClass>();
            Up = other.GetComponent<ItemUpgrade>();
            // set item bow unlocked
            stat.itemBow = true;

            Up.BowLevel++;

            Up.BowDamage+=0.5f;

            if (stat.ArmorEquip == false && stat.SwordEquip == false) {

                //add player attack damage with bow damage
                stat.damage += Up.BowDamage;

                stat.BowEquip = true;
            }
        }

        // Destroy the item
        Destroy(this.gameObject);
    }
Esempio n. 7
0
 public FactoryUIData(FactoryBuildTask task)
 {
     selectedTask          = task;
     selectedItem          = selectedTask.buildItem;
     selectedUpgrade       = selectedItem.currentUpgrade;
     buildCount            = selectedTask.itemBuildAmount;
     colonistAssignedCount = selectedTask.allocatedColonists.Count;
 }
Esempio n. 8
0
        public void OnLoad(DataSnapshot snapshot)
        {
            ItemUpgrade upgrade = snapshot.ItemUpgrades.SingleOrDefault(x => x.ItemId == _id);

            if (upgrade != null)
            {
                int tierIndex = upgrade.Level;
                this.Item.CurrentTier = GetTierByIndex(tierIndex);
            }
        }
Esempio n. 9
0
 public void CreateInstance()
 {
     _defaultStrategy = new ItemUpgrade(item => true);
     _itemUpgrades    = new List <ItemUpgrade>
     {
         new ItemUpgrade(_ => _.Name == SULFURAS_HAND_OF_RAGNAROS, new DoesNotAge(), new LegendaryQuality()),
         new ItemUpgrade(_ => _.Name == AGED_BRIE, itemAging: null, qualityStrategy: new QualityIncreases()),
         new ItemUpgrade(_ => _.Name == BACKSTAGE_PASSES, itemAging: null, qualityStrategy: new BackStagePassQuality()),
         new ItemUpgrade(_ => _.Name != null && _.Name.StartsWith("Conjured"), itemAging: null, qualityStrategy: new QualityDegradesTwiceAsFast()),
     };
 }
Esempio n. 10
0
        public void ResetItem(DataSnapshot snapshot)
        {
            ItemUpgrade upgrade = snapshot.ItemUpgrades.SingleOrDefault(x => x.ItemId == _id);

            if (upgrade != null)
            {
                upgrade.Level = 0;
            }

            this.Item.CurrentTier = GetTierByIndex(0);
        }
Esempio n. 11
0
    void Start()
    {
        player = this.gameObject;

        stat = player.GetComponent<StatCollectionClass >();

        skill = player.GetComponent<SkillTree >();

        quest = player.GetComponent<All_Quests> ();

        ps = player.GetComponent<PlayerStateGUI>();

        up = player.GetComponent<ItemUpgrade> ();
    }
Esempio n. 12
0
 // Update is called once per frame
 void Update()
 {
     itemUpgrade = GameObject.Find("Enclume").GetComponent <ItemUpgrade>();
     mousePos    = controller.cam.ScreenToWorldPoint(Input.mousePosition);
     DetectMoving();
     AnimationYAxis();
     AnimationXAxis();
     AttackMilo();
     TurnMilo();
     IsHurt();
     IsDead();
     DoShoot();
     weaponAnim();
 }
Esempio n. 13
0
        public IActionResult UpgradeItem([FromBody] ItemUpgrade item, string name)
        {
            if (name == "" || item.code == -1 || item.gold <= 0)
            {
                return(BadRequest());
            }
            var items  = _context.Items.FirstOrDefault(x => x.NameCharacter.Equals(name) && x.ItemId == item.code);
            var player = _context.Character.FirstOrDefault(x => x.Name.Equals(name));

            if (items == null || player == null)
            {
                return(NotFound());
            }
            items.Level++;
            player.Gold -= item.gold;
            _context.Character.Update(player);
            _context.Items.Update(items);
            _context.SaveChanges();
            string json = "UPGRADE|" + player.Name + "|" + items.ItemId + "|" + player.Gold;

            return(new ObjectResult(json));
        }
Esempio n. 14
0
        public void OnSave(DataSnapshot snapshot)
        {
            if (string.IsNullOrEmpty(_id))
            {
                return;
            }

            ItemUpgrade upgrade = snapshot.ItemUpgrades.SingleOrDefault(x => x.ItemId == _id);

            var currUpgrade = new ItemUpgrade
            {
                ItemId = _id,
                Level  = GetCurrTierIndex()
            };

            if (upgrade == null)
            {
                snapshot.ItemUpgrades.Add(currUpgrade);
            }
            else
            {
                upgrade.Level = currUpgrade.Level;
            }
        }
Esempio n. 15
0
 public void CreateInstance()
 {
     _itemUpgrade = new ItemUpgrade(item => true);
 }
Esempio n. 16
0
 public Item()
 {
     currentUpgrade = new ItemUpgrade();
 }
 public void Init(ItemUpgrade upgrade)
 {
     buttonUpgrade      = upgrade;
     upgradeIcon.sprite = buttonUpgrade.icon;
 }
Esempio n. 18
0
    void Start()
    {
        male = GameObject.Find("MalePlayerPrefab");

        female = GameObject.Find("FemalePlayerPrefab");

        if (male != null) {
            Item = male.GetComponent<ItemUpgrade> ();
        } else {
            Item = female.GetComponent<ItemUpgrade> ();
        }
    }