public void ChangeClothes(ClotheType type, string name) { if (name != "" && name != null) { switch (type) { case ClotheType.Hat: hat.GetComponent <Image>().sprite = clothesDictionary[name]; dataHandler.Hat = name; break; case ClotheType.Glasses: glasses.GetComponent <Image>().sprite = clothesDictionary[name]; dataHandler.Glasses = name; break; case ClotheType.Accessory: accessory.GetComponent <Image>().sprite = clothesDictionary[name]; dataHandler.Accessory = name; break; case ClotheType.Shirt: shirt.GetComponent <Image>().sprite = clothesDictionary[name]; dataHandler.Shirt = name; break; } } }
public void ChangeClothes(Clothes clothes) { ClotheType type = clothes.type; string name = clothes.name; ChangeClothes(type, name); }