public void SetUp(Data.Card.Attribute attr) { var filename = $"AttributeImages/{attr.klass}"; var sprite = Resources.Load <Sprite>(filename); if (sprite == null) { Debug.Log($"cant't find such file: {filename}"); } icon.sprite = sprite; value.text = $"+{attr.level}"; }
public Data.Card Create() { List <Data.Card.Attribute> attributes = new List <Data.Card.Attribute>(); int n = UnityEngine.Random.Range(0, 4); for (int i = 0; i < n; i++) { var a = new Data.Card.Attribute(); a.klass = Misc.RandomEnum <Data.Card.Attribute.Klass>(); a.level = 1; attributes.Add(a); } var card = new Data.Card(); card.SetUp(Misc.RandomEnum <PawnKlass>(), attributes); return(card); }