public void LootEnemy(GameObject go) { CharacterLoot cl = go.GetComponent <CharacterLoot>(); if (cl != null) { GainCoins(cl.coins); } }
public override void Awake() { characterHealth = GetComponent <CharacterHealth>(); characterLoot = GetComponent <CharacterLoot>(); characterLevel = GetComponent <CharacterLevel>(); enemyAttackRanged = GetComponentInChildren <EnemyAttackRanged>(); enemyAttackMelee = GetComponent <EnemyAttackMelee>(); enemyExperience = GetComponent <EnemyExperience>(); }
public void Awake() { spriteRenderer = GetComponent <SpriteRenderer>(); characterHealth = GetComponent <CharacterHealth>(); characterLoot = GetComponent <CharacterLoot>(); enemyMovement = GetComponent <EnemyMovement>(); enemyAttackRanged = GetComponentInChildren <EnemyAttackRanged>(); enemyAttackMelee = GetComponentInChildren <EnemyAttackMelee>(); enemyExperience = GetComponent <EnemyExperience>(); }
public void DeleteCharacterLoot(CharacterLoot CharacterLoot) { try { dbContext.CharacterLoot.Remove(CharacterLoot); dbContext.SaveChanges(); } catch (Exception) { throw; } }
/// <summary> /// This method removes and existing Raids from the DbContext and saves it /// </summary> /// <param name="CharacterLoot"></param> /// <returns></returns> public async Task DeleteCharacterLootAsync(CharacterLoot CharacterLoot) { try { dbContext.CharacterLoot.Remove(CharacterLoot); await dbContext.SaveChangesAsync(); } catch (Exception) { throw; } }
/// <summary> /// This method add a new Raids to the DbContext and saves it /// </summary> /// <param name="CharacterLoot"></param> /// <returns></returns> public async Task <CharacterLoot> AddCharacterLootAsync(CharacterLoot CharacterLoot) { try { dbContext.CharacterLoot.Add(CharacterLoot); await dbContext.SaveChangesAsync(); } catch (Exception) { throw; } return(CharacterLoot); }
/// <summary> /// This method update and existing Raids and saves the changes /// </summary> /// <param name="CharacterLoot"></param> /// <returns></returns> public async Task <CharacterLoot> UpdateCharacterLootAsync(CharacterLoot CharacterLoot) { try { var RaidsExist = dbContext.CharacterLoot.FirstOrDefault(p => p.ID == CharacterLoot.ID); if (RaidsExist != null) { dbContext.Update(CharacterLoot); await dbContext.SaveChangesAsync(); } } catch (Exception) { throw; } return(CharacterLoot); }
public void ChangeTemplate(EnemyTemplate enemyTemplate) { if (enemyTemplate != null) { SpriteRenderer spriteRenderer = GetComponent <SpriteRenderer>(); CharacterHealth characterHealth = GetComponent <CharacterHealth>(); CharacterLoot characterLoot = GetComponent <CharacterLoot>(); if (spriteRenderer != null) { spriteRenderer.sprite = enemyTemplate.sprite; } if (characterHealth != null) { characterHealth.maxHealth = enemyTemplate.health; } if (characterLoot != null) { characterLoot.coins = enemyTemplate.coins; } } }