Continuing the BergZerg tutorials. This script initially compiled just fine, but then all of a sudden it went crazy and had a problem with everything.
The sticky point seems to be the enum list and the class derived from it. Someone please help me understand how to fix it.
Thanks!
- Did I miss a type declaration?(Has to do with the Rarity of the item.
- Am I missing a cast somewhere(it was complaining about that too). Tried using a ToString() in several places, but it gave more errors.
`using UnityEngine;
using System;
public class Item {
private string _itemName;
private int _itemValue;
private RarityType _rarity;
private int _maxDurability;
private int _currentDurability;
public Item(){
_itemName="";
_itemValue=0;
_rarity=RarityType;
_maxDurability=50;
_currentDurability=_maxDurability;
}
public Item(string name , int value, RarityType rarity, int CurrentDurability, int MaxDurability){
_itemName="";
_itemValue=0;
_rarity=RarityType.Common;
_maxDurability=50;
_currentDurability=_maxDurability;
}
public string ItemName{
get{return _itemName;}
set{_itemName=value;}
}
public int ItemValue {
get{return _itemValue;}
set{_itemValue=value;}
}
public string Rarity {
get{return _rarity;}
set{_rarity=value;}
}
public int MaxDurability{
get{return _maxDurability;}
set{_maxDurability=value;}
}
public int CurrentDurability{
get{return _currentDurability;}
set{_currentDurability=value;}
}
}
public enum RarityType{
Common,
Uncommon,
Rare,
Epic
}`