/// <summary> /// Creates a random armor from available armor types. /// </summary> /// <returns>The armor.</returns> /// <param name="spawnPoint">Spawn point.</param> public BodyArmor CreateArmor(Transform spawnPoint, string name) { //int randomNum = Random.Range(0, 3); BodyArmor a = blankHeavyArmorPrefab; switch (name) { case "HeavyArmor": a = CreateHeavyArmor(spawnPoint); break; case "MediumArmor": a = CreateMediumArmor(spawnPoint); break; case "LightArmor": a = CreateLightArmor(spawnPoint); break; case "BlankArmor": a = CreateBlankArmor(spawnPoint); break; default: Debug.Log("No armor to create!"); break; } return(a); }
public void TakeOn(Fighter fighter, Armor armor) { try { Armor Armor; Fighter Fighter = _fight.Fighters.Find(fighter.FighterId); switch (armor.type) { case ("Helmet"): Armor = _fight.Helmets.Find(armor.Id); if (Fighter.HelmetId != null) { Helmet Helmet = _fight.Helmets.Find(Fighter.HelmetId); Helmet.IsWearing = false; Fighter.Armor -= Helmet.ArmorPoints; } Fighter.HelmetId = Armor.Id; Fighter.Armor += Armor.ArmorPoints; Armor.IsWearing = true; break; case ("BodyArmor"): Armor = _fight.BodyArmors.Find(armor.Id); if (Fighter.BodyArmorId != null) { BodyArmor bodyArmor = _fight.BodyArmors.Find(Fighter.BodyArmorId); bodyArmor.IsWearing = false; Fighter.Armor -= bodyArmor.ArmorPoints; } Fighter.BodyArmorId = Armor.Id; Fighter.Armor += Armor.ArmorPoints; Armor.IsWearing = true; break; case ("FeetArmor"): Armor = _fight.FeetArmors.Find(armor.Id); if (Fighter.FeetArmorId != null) { FeetArmor feet = _fight.FeetArmors.Find(Fighter.FeetArmorId); feet.IsWearing = false; Fighter.Armor -= feet.ArmorPoints; } Fighter.FeetArmorId = Armor.Id; Fighter.Armor += Armor.ArmorPoints; Armor.IsWearing = true; break; default: break; } } catch (NullReferenceException) { } _fight.SaveChanges(); }
public Legionnaire() : base() { name = "Legionnaire"; body = new BodyArmor(Body.Ringmail); Defense(); speed = 2; attack = 1.0; healthPoints = 10; }
public Principes() : base() { body = new BodyArmor(Body.Scalemail); g = new Gladius(); name = "Principes"; Defense(); armorLevel += g.Armor(); attack = g.Attack(); speed = 1; healthPoints = 15.0; }
public Triarii() : base() { body = new BodyArmor(Body.Plate); g = new Gladius(); name = "Triarii"; Defense(); armorLevel += g.Armor(); attack = g.Attack(); speed = 1; healthPoints = 40.0; }
protected void SetArmor(string name) { GameObject body = playerBody.gameObject; // Gets a reference for the body to see if there.. if (body.GetComponentInChildren <Armor>() == true) // If there is Armor on the body.. { Destroy(body.GetComponentInChildren <Armor>().gameObject); // .. Destroy it. } this.playerArmor = ItemFactory.instance.CreateArmor(playerBody, name); // Spawn specified Armor. this.playerArmor.transform.parent = playerBody; // Make it the child of the body. this.playerArmor.transform.localScale = new Vector3(1, 1, 1); // Fix the scale. /*if (spawnWithArmor) * { * // Calls coroutine to that renders the armor. Coroutine is the method below this one. * StartCoroutine("RenderArmorAtEoF"); * }*/ }
public void SetEquippedBodyArmor(BodyArmor bodyArmor) { this.bodyArmor = bodyArmor; switch (bodyArmor) { case BodyArmor.None: shield = 0; break; case BodyArmor.Tier_1: shield = SHIELD_AMOUNT_PER_SEGMENT * 2; break; case BodyArmor.Tier_2: shield = SHIELD_AMOUNT_PER_SEGMENT * 3; break; case BodyArmor.Tier_3: shield = SHIELD_AMOUNT_PER_SEGMENT * 4; break; } }
/// <summary> /// Initializes a new instance of the <see cref="Armor"/> class. /// </summary> /// <param name="itemBase"><inheritdoc cref="Base"/></param> public Armor(BodyArmor itemBase) : base(itemBase) { Base = itemBase; }
public Character() { bodyArmor = BodyArmor.None; health = HEALTH_MAX; }
private BodyArmor CreateBlankArmor(Transform spawnPoint) { BodyArmor i = Instantiate(blankArmorPrefab, spawnPoint.position, spawnPoint.transform.rotation) as BodyArmor; return(i); }
public void UpdateLists() { try { using (UnitOfWork T = new UnitOfWork()) { //T.Weapons.Add(new Bow() { Call = "assd", Username = CurrentUser.Username }); //T.Weapons.Add(new Bow() { Call = "4len", Username = CurrentUser.Username }); //T.Weapons.Add(new MiniGun() { Call = "hehe", Username = CurrentUser.Username }); //T.Weapons.Add(new Bow() { Call = "aga", Username = CurrentUser.Username }); //T.SaveChanges(); if (selectedFighter != null) { selectedFighter = T.GetFighters().Find(selectedFighter.FighterId); SelectedWeapon = (T.GetWeapons().Find(selectedFighter.WeaponId)) ?? (SelectedWeapon = new Bow() { Call = "Без оружия" }); SelectedHelmet = (T.GetHelmets().Find(selectedFighter.HelmetId)) ?? (SelectedHelmet = new Helmet() { Call = "Без шлема" }); SelectedBodyArmor = (T.GetBodyArmor().Find(selectedFighter.BodyArmorId)) ?? (SelectedBodyArmor = new BodyArmor() { Call = "Без брони" }); SelectedFeetArmor = (T.GetFeetArmor().Find(selectedFighter.FeetArmorId)) ?? (SelectedFeetArmor = new FeetArmor() { Call = "Без ботинок" }); HelmetName = SelectedHelmet.Call; BodyArmorName = SelectedBodyArmor.Call; FeetArmorName = SelectedFeetArmor.Call; WeaponName = SelectedWeapon.Call; OnPropertyChanged("SelectedFighter"); } } //T.Helmets.Add(new Helmet() { Call = "sosat", Username = CurrentUser.Username }); //T.Helmets.Add(new Helmet() { Call = "sosat1", Username = CurrentUser.Username }); //T.Helmets.Add(new Helmet() { Call = "sosat2", Username = CurrentUser.Username }); //T.BodyArmors.Add(new BodyArmor() { Call = "Sos", Username = CurrentUser.Username }); //T.BodyArmors.Add(new BodyArmor() { Call = "Sos1", Username = CurrentUser.Username }); //T.BodyArmors.Add(new BodyArmor() { Call = "Sos2", Username = CurrentUser.Username }); //T.FeetArmors.Add(new FeetArmor() { Call = "nog", Username = CurrentUser.Username }); //T.FeetArmors.Add(new FeetArmor() { Call = "nog1", Username = CurrentUser.Username }); //T.FeetArmors.Add(new FeetArmor() { Call = "nog2", Username = CurrentUser.Username }); //T.SaveChanges(); } catch (NullReferenceException) { } catch (Exception Ex) { MessageBox.Show(Ex.ToString()); } }
void CreateNewItem(ItemCreator creator) { Item newItem = null; if(index1==0){ if(index2==0){ //One Handed Melee OneHandedMelee ohm = new OneHandedMelee(); newItem = ohm as Item; } else if(index2==1){ //Two Handed Melee TwoHandedMelee thm = new TwoHandedMelee(); newItem = thm as Item; } else if(index2==2){ //Bow Bow b = new Bow(); newItem = b as Item; } else if(index2==3){ //Staff Staff s = new Staff(); newItem = s as Item; } else if(index2==4){ //Shield Shield s = new Shield(); newItem = s as Item; } } else if(index1==1){ if(index2==0){ //Head HeadArmor ha = new HeadArmor(); newItem = ha as Item; } else if(index2==1){ //Body BodyArmor ba = new BodyArmor(); newItem = ba as Item; } else if(index2==2){ //Hand HandArmor ha = new HandArmor(); newItem = ha as Item; } else if(index2==3){ //Leg LegArmor la = new LegArmor(); newItem = la as Item; } } else if(index1==2){ } newItem.ID = creator.itemID; creator._Item = newItem; creator.Save(); creator.AddSpriteManager(sm); creator.isEditing = true; creator.isCreating = false; }
public void GetBodyArmor(BodyArmor armor) { this.BodyArmor = armor; }