public void WearCurrent() { if (CurrentSelection.Valid) { if (Worn.ContainsKey(CurrentSelection.ClothingType.Value)) { // We're already wearing something. StripCurrent(); } GameObject inst = GameObject.Instantiate(selectedCloth.Prefab); WardrobeSelection newlyWorn = new WardrobeSelection(CurrentSelection.ClothingType.Value, CurrentSelection.Index, inst); this.Worn.Add(newlyWorn.ClothingType.Value, newlyWorn); } }
private void Awake() { Worn = new Dictionary <EClothingType, WardrobeSelection>(); CurrentSelection = new WardrobeSelection(); KnownClothingByType = new Dictionary <EClothingType, List <Clothing> >(); foreach (Clothing c in KnownClothes) { if (!KnownClothingByType.ContainsKey(c.CType)) { KnownClothingByType[c.CType] = new List <Clothing>(); } KnownClothingByType[c.CType].Add(c); } }
public bool SetView(EClothingType drawer) { if (this.Worn.ContainsKey(drawer)) { // We're already wearing something from this drawer WardrobeSelection curr = Worn[drawer]; this.CurrentSelection = new WardrobeSelection(curr.ClothingType.Value, curr.Index); } else { if (this.KnownClothingByType.ContainsKey(drawer)) { this.CurrentSelection = new WardrobeSelection(drawer); } } RefreshView(); return(CurrentSelection.Valid); }