public Item(string name, int id, string description, int intensity, e_itemType itemType, e_element elementType) { m_itemName = name; m_itemID = id; m_itemDescription = description; m_intensity = intensity; m_typeItem = itemType; m_itemIcon = AssignResources(itemType); m_elementType = elementType; }
public Item(int id, string name, string description, int intensity, e_itemType type, e_element eltTarget, e_itemRarity rarity, bool isStackable) : this(id, name, description, intensity, type, eltTarget) { LevelRarity = rarity; IsStackable = isStackable; }
public Item(int id, string name, string description, int intensity, e_itemType type, e_element eltTarget) { Id = id; Name = name; Description = description; Intensity = intensity; TypeItem = type; ElementTarget = eltTarget; LevelRarity = e_itemRarity.Normal; IsStackable = false; Sprite = AssignResources(type); }
/// <summary> /// Interaction with the creature in game. /// </summary> /// <param name="action">The different's actions on creature</param> /// <param name="percentage">percentage = value between 0 and 1, 1 correspond to 100 %</param> /// <param name="value">value is the intensity of action on creature</param> public void Interact(e_action action, Item item) { //TODO kr : Debug.Log(Mathf.FloorToInt(10.1f)); int tmpValue = item.Intensity; switch (action) { case e_action.Eat: //verify if the item is really food if(item.m_typeItem == e_itemType.FOOD) { //if creature type is normal or food is normal, no problem //idem if creature and food type are compatible //if not, ... if(m_typeCreature[0] == e_element.Normal || item.m_elementType == e_element.Normal) { ChangeHunger(tmpValue); } else { bool isGood = false; for(int i = 0; i < m_typeCreature.Length; ++i) { if(m_typeCreature[i] == item.m_elementType) { isGood = true; break; } } if(isGood) { ChangeHunger(tmpValue); } else { //do something if the food is not of the same type } } } break; case e_action.DrinkPotion: switch (item.m_typeItem) { case e_itemType.POTION: ChangeHunger(tmpValue); break; case e_itemType.POTION_EVOLVE: if (m_typeCreature[0] == e_element.Normal) { m_typeCreature[0] = item.m_elementType; } else { e_element[] tmpTypeCreature = new e_element[m_typeCreature.Length + 1]; for(int i = 0; i < m_typeCreature.Length; ++i) { tmpTypeCreature[i] = m_typeCreature[i]; } tmpTypeCreature[tmpTypeCreature.Length - 1] = item.m_elementType; } break; case e_itemType.POTION_POISON: ChangeHunger(tmpValue); int xpToRemove = Toolbox.RoundValueToInt(XpMax * -0.2f); ChangeExperience(xpToRemove); break; default: break; } break; case e_action.BeingStroke: ChangeKarma(tmpValue); break; case e_action.BeingHit: ChangeHunger(tmpValue); break; default: break; } }