public void ChangeSprite(UIAttributeType type, ArrowType arrow, ref int index) { int sign = (int)arrow; //if (sign == 0) { Debug.Log("Arrow Type is 0.. Updating"); } switch (type) { case UIAttributeType.None: //Debug.Log("Wrong Type"); break; case UIAttributeType.Hair: ClampInt(ref HairStyleIndex, Collection.Hairstyles.Count, sign, out index); PreviewManager.SetHair(Collection.Hairstyles[HairStyleIndex]); CurrentCharacterInfo.SpriteSets[CharacterPart.Hair] = Collection.Hairstyles[HairStyleIndex]; break; case UIAttributeType.Colour: ClampInt(ref HairColorIndex, System.Enum.GetValues(typeof(HairColor)).Length, sign, out index); Collection.hairColor = (HairColor)HairColorIndex; PreviewManager.SetHair(Collection.Hairstyles[HairStyleIndex]); CurrentCharacterInfo.SpriteSets[CharacterPart.Hair] = Collection.Hairstyles[HairStyleIndex]; break; case UIAttributeType.Face: ClampInt(ref FaceIndex, Collection.SpriteSets[SpriteSetCollection.GeneralCharacterPart.Face].Count, sign, out index); //PreviewManager.SetHair(Collection.Hairstyles[HairStyleIndex]); CurrentCharacterInfo.SpriteSets[CharacterPart.Face] = Collection.SpriteSets[SpriteSetCollection.GeneralCharacterPart.Face][0]; break; case UIAttributeType.Facial: break; case UIAttributeType.Top: Collection.clothing = SpriteSetCollection.CharacterClothing.Top; ClampInt(ref ShirtIndex, Collection.Clothes.Count, sign, out index); PreviewManager.SetShirt(Collection.Clothes[ShirtIndex]); CurrentCharacterInfo.SpriteSets[CharacterPart.Top] = Collection.Clothes[ShirtIndex]; break; case UIAttributeType.Skin: ClampInt(ref BodyToneIndex, 5, sign, out index); PreviewManager.SetBody(Collection.SpriteSets[SpriteSetCollection.GeneralCharacterPart.Body][BodyToneIndex]); PreviewManager.SetHead(Collection.SpriteSets[SpriteSetCollection.GeneralCharacterPart.Head][BodyToneIndex]); PreviewManager.SetHands(Collection.SpriteSets[SpriteSetCollection.GeneralCharacterPart.Hands][BodyToneIndex]); CurrentCharacterInfo.SpriteSets[CharacterPart.Body] = Collection.SpriteSets[SpriteSetCollection.GeneralCharacterPart.Body][BodyToneIndex]; CurrentCharacterInfo.SpriteSets[CharacterPart.Head] = Collection.SpriteSets[SpriteSetCollection.GeneralCharacterPart.Head][BodyToneIndex]; CurrentCharacterInfo.SpriteSets[CharacterPart.Hands] = Collection.SpriteSets[SpriteSetCollection.GeneralCharacterPart.Hands][BodyToneIndex]; break; case UIAttributeType.Bottom: Collection.clothing = SpriteSetCollection.CharacterClothing.Bottom; ClampInt(ref PantsIndex, Collection.Clothes.Count, sign, out index); PreviewManager.SetPants(Collection.Clothes[PantsIndex]); CurrentCharacterInfo.SpriteSets[CharacterPart.Bottom] = Collection.Clothes[PantsIndex]; break; case UIAttributeType.Other: break; } }
void Awake() { instance = this; }