public CharacterLogic() { characters = new List <Character>(); superHero = new SuperHero(); vilan = new Vilan(); superPower = new SuperPower(); }
public void SetSuperPower(Texture pickupType) { switch (pickupType.name) { case "Break": m_powerUpType = SuperPower.BREAK; break; case "Catch": m_powerUpType = SuperPower.CATCH; break; case "Disrupt": m_powerUpType = SuperPower.DISRUPT; break; case "Enlarge": m_powerUpType = SuperPower.ENLARGE; break; case "Laser": m_powerUpType = SuperPower.LASER; break; case "Life": m_powerUpType = SuperPower.LIFE; break; case "Slow": m_powerUpType = SuperPower.SLOW; break; } // set the texture GetComponent <Renderer>().material.mainTexture = pickupType; }
public SuperHero GetHeroDetails() { SuperHero hero = new SuperHero(); List <SuperPower> superPowers = new List <SuperPower>(); Console.Write("Enter Hero Name: "); hero.Alias = Console.ReadLine(); Console.Write("Enter Hero's Real Name: "); hero.RealName = Console.ReadLine(); Console.Write("Enter Hero Hideout: "); hero.HideOut = Console.ReadLine(); do { SuperPower superPower = new SuperPower(); Console.WriteLine("Enter Hero Superpowers (type end to stop): "); Console.Write("Enter Super Power Name:"); superPower.Name = Console.ReadLine(); if (superPower.Name.Equals("end")) { break; } Console.Write("Enter Super Power Description:"); superPower.Description = Console.ReadLine(); superPowers.Add(superPower); }while(true); hero.SuperPowers = superPowers; //needs code to get all the villains and add them as a villain to the hero return(hero); }
static void Main(string[] args) { // Create hero method/logic Hero newHero = new Hero(); Console.WriteLine("Enter Hero Name: "); newHero.HeroName = Console.ReadLine(); Console.WriteLine("Enter HP value: "); newHero.HP = int.Parse(Console.ReadLine()); Console.WriteLine("Enter SuperPower details"); SuperPower newSuperPower = new SuperPower(); Console.WriteLine("Enter SuperPower name:"); newSuperPower.Name = Console.ReadLine(); Console.WriteLine("Enter SuperPower description"); newSuperPower.Description = Console.ReadLine(); Console.WriteLine("Enter SuperPower damage"); newSuperPower.Damage = int.Parse(Console.ReadLine()); newHero.SuperPower = newSuperPower; Console.WriteLine("Set the element of the hero: "); newHero.ElementType = Enum.Parse <Element>(Console.ReadLine()); heroBL.AddHero(newHero); foreach (var item in heroBL.GetHeroes()) { Console.WriteLine(item.ToString()); } }
/// <summary> /// Adds a new SuperPower to the set of SuperPowers the SuperHuman /// possesses, and adjusts their total power accordingly. /// </summary> /// <param name="newPower">The new SuperPower</param> /// // INSERT AddSuperPower METHOD public void AddSuperPower(SuperPower superPower) { if (!superPowers.Contains(superPower)) { superPowers.Add(superPower); } }
public void LoseSinglePower(SuperPower power) { if (powerSet.Contains(power)) { powerSet.Remove(power); sumOfPowers -= (int)power; } }
public void AddSuperPower(SuperPower newPower) { if (!powerSet.Contains(newPower)) { powerSet.Add(newPower); sumOfPowers += (int)newPower; } }
public void AddSuperPower(SuperPower newPower) { if (!powerSet.Contains(newPower)) { powerSet.Add(newPower); sumOfPowers += GetPowerValue(newPower); } }
public void LoseSinglePower(SuperPower power) { if (powerSet.Contains(power)) { powerSet.Remove(power); sumOfPowers -= GetPowerValue(power); } }
public Powers ParseSuperPower(SuperPower superPower) { return(new Powers() { Name = superPower.Name, Description = superPower.Description }); }
public void Insert(SuperPower superPower) { _context.SuperPowers.Add(superPower); _context.SaveChanges(); _auditService.Save(new AuditEvent { CreatedDate = DateTime.Now, Action = "Insert", Entity = "SuperPower", Id = superPower.Id }); }
public void ManuallyPassValueToEachProperty(SuperPower superpowerMapped) { var superpower = _unitOfWork.SuperPowerRepository.GetById(superpowerMapped.Id); superpower.Id = superpowerMapped.Id; superpower.SuperPowerName = superpowerMapped.SuperPowerName; superpower.Type = superpowerMapped.Type; superpower.Value = superpowerMapped.Value; }
public async Task DeleteSuperPowerAsync(int id) { var superpower = new SuperPower { Id = id }; _context.Attach(superpower); _context.Remove(superpower); await _context.SaveChangesAsync(); }
public override bool Heal() { if (SuperPower.ToUpper() == "SEASHELL SPELLS") { Console.WriteLine($"{Name} successfuly healed with their {SuperPower} super power."); return(true); } Console.WriteLine($"{Name}'s {SuperPower} super power is not an healing power."); return(false); }
// Methods of Fantasy Creature public override bool Attack() { if (SuperPower.ToUpper() == "TAIL WHIP") { Console.WriteLine($"{Name} successfuly attacked with their {SuperPower} super power."); return(true); } Console.WriteLine($"{Name}'s {SuperPower} super power is not an attacking power."); return(false); }
public static SuperPower AcceptPowers() { SuperPower superPower = new SuperPower(); Console.WriteLine("Enter super power"); superPower.Power = Console.ReadLine(); Console.WriteLine("Enter power impact"); superPower.Impact = ValidationLogic.ConvertValue(Console.ReadLine()); return(superPower); }
public Superhuman(int id, int weeksOld, Stats stats, SuperPower superPower, string superhumanName, DBManager dbManager) { this.id = id; this.stats = stats; this.superPower = superPower; this.superhumanName = superhumanName; this.weeksOld = weeksOld; this.dbManager = dbManager; setAge(); }
public IActionResult PostSuperPower([FromBody] SuperPower superPower) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } _superPowerService.Insert(superPower); return(CreatedAtAction("GetSuperPower", new { id = superPower.Id }, superPower)); }
public override bool HasPower(SuperPower whatPower) { if ((enhanced == true) & (powerSet.Contains(whatPower))) { return(true); } else { return(false); } }
public SuperPower UpdateSuperPower(SuperPower superPower) { var record = context.SuperPowers.FirstOrDefault(x => x.Id == superPower.Id); record.Name = superPower.Name; record.Description = superPower.Description; record.OwnerId = superPower.OwnerId; context.Update(record); context.SaveChanges(); return(mapper.Map(record)); }
/// <summary> /// Determines whether the SuperHuman has a particular SuperPower. /// </summary> /// <param name="whatPower">The SuperPower to be queried</param> /// <returns>True is the SuperHuman has the provided SuperPower, /// false otherwise</returns> /// // INSERT OVERRIDE FOR HasPower METHOD public override bool HasPower(SuperPower whatPower) { bool result = false; superPowers.ForEach(x => { if (x == whatPower) { result = true; } }); return(result); }
public async void GetById_ShouldReturnNotFound() { var expected = new SuperPower(); _superPowerServiceMock.Setup(t => t.GetByIdAsync(0)) .ThrowsAsync(new CustomNotFoundException("Super Power")); var result = await _controllerTest.GetById(0); Assert.IsType <NotFoundResult>(result); }
public async void GetById_ShouldReturnSuperPower() { int id = 1; var expected = new SuperPower(); _superPowerRepositoryMock.Setup(t => t.GetByIdAsync(id)) .ReturnsAsync(expected).Verifiable(); var result = await _serviceTest.GetByIdAsync(id); Assert.Equal(expected, result); _superPowerRepositoryMock.Verify(t => t.GetByIdAsync(id), Times.Once); }
public async void GetById_ShouldReturnNotFoundException() { int id = 1; SuperPower expected = null; _superPowerRepositoryMock.Setup(t => t.GetByIdAsync(id)) .ReturnsAsync(expected) .Verifiable(); await Assert.ThrowsAsync <CustomNotFoundException>(() => _serviceTest.GetByIdAsync(id)); _superPowerRepositoryMock.Verify(t => t.GetByIdAsync(id), Times.Once); }
public async Task <SuperPower> UpdateAsync(SuperPower obj) { if (await _superPowerRepository.ExistsAsync(t => t.Name == obj.Name && t.Id != obj.Id)) { throw new CustomFieldAlreadyExistsException("name"); } obj.UpdateDate = DateTime.Now; _superPowerRepository.Update(obj); await _superPowerRepository.SaveChangesAsync(); return(obj); }
public IActionResult Update(int id, SuperPower newSuperPower) { var superPower = _context.superPowers.Find(id); if (superPower == null) { return(NotFound()); } superPower.category = newSuperPower.category; superPower.power = newSuperPower.power; _context.superPowers.Update(superPower); _context.SaveChanges(); return(NoContent()); }
public async void Update_ShouldUpdateAndReturnSuperPowerUpdated() { var expected = new SuperPower(); _superPowerRepositoryMock.Setup(t => t.Update(expected)) .Verifiable(); var result = await _serviceTest.UpdateAsync(expected); Assert.Same(expected, result); _superPowerRepositoryMock.Verify(t => t.Update(expected), Times.Once); _superPowerRepositoryMock.Verify(t => t.SaveChangesAsync(), Times.Once); }
public async void Create_ShouldReturnFieldExistsException() { var obj = new SuperPower(); _superPowerRepositoryMock.Setup(t => t.ExistsAsync(It.IsAny <Expression <Func <SuperPower, bool> > >())) .ReturnsAsync(true) .Verifiable(); await Assert.ThrowsAsync <CustomFieldAlreadyExistsException>(() => _serviceTest.InsertAsync(obj)); _superPowerRepositoryMock.Verify(t => t.InsertAsync(obj), Times.Never); _superPowerRepositoryMock.Verify(t => t.ExistsAsync(It.IsAny <Expression <Func <SuperPower, bool> > >()), Times.Once); _superPowerRepositoryMock.Verify(t => t.SaveChangesAsync(), Times.Never); }
public async void Update_ShouldReturnNotFound() { var model = new SuperPowerModel(); var superPower = new SuperPower(); _superPowerServiceMock.Setup(t => t.GetByIdAsync(It.IsAny <int>())) .ThrowsAsync(new CustomNotFoundException("Super Power")); var result = await _controllerTest.Update(1, model); Assert.IsType <NotFoundResult>(result); _superPowerServiceMock.Verify(t => t.GetByIdAsync(It.IsAny <int>()), Times.Once); _superPowerServiceMock.Verify(t => t.UpdateAsync(It.IsAny <SuperPower>()), Times.Never); }
private void SetCurrentSuperPower(SuperPower superPowerToActivate) { if (_activeSuperPower != null) { _activeSuperPower.OnDeactivate(); } _activeSuperPower = superPowerToActivate; _activeSuperPower.OnActivate(); if (GameUiController.Instance != null) { GameUiController.Instance.SetSuperPowerActivated(superPowerToActivate.SuperPowerType); } }
void Start() { big = star = fire = null; bricksLayer = LayerMask.NameToLayer("Obstacles"); enemyLayer = LayerMask.NameToLayer("Enemies"); runningEnemyLayer = LayerMask.NameToLayer("RunningEnemies"); _motion = GetComponent <MarioMovement>(); _collector = GetComponent <ItemCollector>(); _collector.OnItemCollision += pickItem; _marioCollider = GetComponent <BoxCollider2D>(); _currentY = transform.position.y; _audio = gameObject.AddComponent <AudioSource>(); _animator = GetComponent <Animator>(); }
public Supervillain(int id, int weeksOld, Stats stats, SuperPower superPower, string superhumanName, DBManager dbManager) : base(id, weeksOld, stats, superPower, superhumanName, dbManager){ }
private void loadSuperPowers() { for (int i = 0; i < 2; i++) { string powersDir; if(i == 0) powersDir = "Data\\Superpowers\\Passives"; else powersDir = "Data\\Superpowers\\Abilities"; try { string[] directories = Directory.GetDirectories(powersDir); foreach (string dirPath in directories) { string xmlPath = Directory.GetFiles(dirPath, "*.xml")[0]; XElement rootXML = XElement.Load(xmlPath); SuperPower power = new SuperPower(); power.name = rootXML.Element("name").Value; power.description = rootXML.Element("description").Value; power.dna_used = getXElementAttrValueAsInt(rootXML, "dna_used"); power.rank_current = 0; if (i == 0) // passives GlobalVariables.passiveTemplates.Add(power.name, (Passive)power); else // abilities { Ability ability = (Ability)power; ability.damage = getXElementAttrValueAsInt(rootXML, "damage"); ability.cost = getXElementAttrValueAsInt(rootXML, "cost"); foreach(XElement damageTypeXML in rootXML.Descendants("damageType")) { foreach(DamageType damageType in Enum.GetValues(typeof(DamageType))) { if (damageTypeXML.Value.ToUpper() == damageType.ToString()) ability.damageTypes.Add(damageType); } } GlobalVariables.abilitiyTemplates.Add(power.name, ability); } } } catch (Exception e) { Debug.Log(e); } } }
public void addSuperPower(SuperPower sp){ allSP.Add (sp.Id, sp); }
public Hero(PlayerStats stats, Armor armor, Weapon weapon, SuperPower powers) : base(stats, armor, weapon) { this.Powers = powers; }