// Spawns a new weapon with at a 25% chance at the Vector3 position public void SpawnWeapon(Vector3 pos) { EnemyLoot loot = GetComponent <EnemyLoot>(); if (loot != null) { loot.SpawnGun(pos.x, pos.y); } }
/// <summary> /// Remove an item from a enemy's loot /// </summary> /// <param name="enemyId">Id of enemy</param> /// <param name="itemId">Id of item</param> /// <returns>Successful result of item removal</returns> public async Task RemoveItemFromLoot(int enemyId, int itemId) { EnemyLoot result = await _context.EnemyLoot.FindAsync(enemyId, itemId); if (result != null) { _context.Entry(result).State = EntityState.Deleted; await _context.SaveChangesAsync(); } }
public List <Loot> FilterLoot(int rarity) { try { return(EnemyLoot.FindAll(l => l.Rarity == rarity)); } catch (NullReferenceException) { return(null); } }
/// <summary> /// Add an item to a enemy's loot /// </summary> /// <param name="enemyId">Id of enemy</param> /// <param name="itemId">Id of item</param> /// <returns>Successful result of item addition</returns> public async Task AddItemToLoot(int enemyId, int itemId) { EnemyLoot loot = new EnemyLoot() { EnemyId = enemyId, ItemId = itemId }; _context.Entry(loot).State = EntityState.Added; await _context.SaveChangesAsync(); }
void EnemyDifficultyWithLevel() { //this.level = GameObject.FindObjectOfType<PlayerAttribute>().Level; this.life.Max = (this.level * 10 * this.level) + 30; this.damage.Initialize((int)(this.level * this.level * 2f) + 15, (int)(this.level * this.level * 3f) + 18); this.moveSpeed += this.level * 2; this.attributes[((int)e_entityAttribute.Attack_Speed_Percent)] = 1f - this.level * 0.005f; this.attributes[(int)(e_entityAttribute.Range)] = 2f; this.enemyLoot = new EnemyLoot <TModuleType>(); //this.enemyLoot.Initialize(this, this.trans); }