private void GetEquipment() { foreach (WeaponObject weapon in Assets.assets.weaponTemp) { if (weapon.wpLevel == 0) { startWeaponList.Add(weapon); } } startWeapon = startWeaponList[Random.Range(0, startWeaponList.Count)]; foreach (ClothItemObject cloth in Assets.assets.clothTemp) { if (cloth.clothCategory == ClothScript.ClothCategory.StartGear) { switch (cloth.clothType) { case ClothScript.ClothType.Cloth: startCloth.Add(cloth); break; case ClothScript.ClothType.HeadGear: startHeadGear.Add(cloth); break; } } } cloth = startCloth[Random.Range(0, startCloth.Count)]; headGear = startHeadGear[Random.Range(0, startHeadGear.Count)]; }
public void GetHolder(CharacterScript characterScript, Stats stats, string itemId) { this.characterScript = characterScript; this.stats = stats; item = FindItem(itemId); if (item != null) { GetComponent <Image>().sprite = item.portrait; } else { GetComponent <Image>().sprite = UIMask; } }
public void ChangeCloth(ClothItemObject NewItem) { if (item != null) { changeStats(item, -1); } //Tar bort all boost som gamla itemet hade if (NewItem != null) { changeStats(NewItem, 1); //Lägger till boost som den nya itemet har item = NewItem; //Updaterar så att den har det nya itemet som old GetComponent <Image>().sprite = item.portrait; //Updaterar Bilden } }
private void changeStats(ClothItemObject item, int modifier) //Ändrar statsen beroende på plaggets värde { if (stats == null) { stats = Character.GetComponent <Stats>(); } stats.maxHp += (item.maxHp * modifier); stats.hp += (item.maxHp * modifier); stats.str += (item.str * modifier); stats.def += (item.def * modifier); stats.Int += (item.Int * modifier); stats.dex += (item.dex * modifier); stats.cha += (item.cha * modifier); stats.ldr += (item.ldr * modifier); stats.nrg += (item.nrg * modifier); stats.snt += (item.snt * modifier); }
public void ChangeCloth(ClothItemObject newCloth) { if (characterScript == null) { stats = GetComponent <Stats>(); characterScript = GetComponent <CharacterScript>(); headScript = HeadGear.GetComponent <ClothScript>(); clothScript = Cloth.GetComponent <ClothScript>(); } switch (newCloth.clothType) { case ClothType.HeadGear: characterScript.headId = newCloth.name; headScript.ChangeCloth(newCloth); break; case ClothType.Cloth: characterScript.clothId = newCloth.name; clothScript.ChangeCloth(newCloth); break; } }