private void ProcessAP(AvataaarPart ap, string applekey, float val) { if (ap.appleKey == applekey) { float percent; /* if ((aps[i].yScaleMinMax.x - aps[i].yScaleMinMax.y)<Mathf.Epsilon) * percent = aps[i].baseMultiplier; * else */ percent = ap.yScaleMinMax.x + (val - ap.threshhold) * ap.yScaleMinMax.y; if (ap.greaterThan) { if (val > ap.threshhold) { ConditionalThreshold(ap, percent); } } else { if (val < ap.threshhold) { ConditionalThreshold(ap, percent); } } } }
/* private void AddSprite(Sprite sprite,AvataaarPart apart){ * if(apart.uniqueSprite) * dicSprite2AvataaarPart.Add(sprite, apart); * }*/ private void AddAttachmentPoint(AvataaarPart apart) { if (dicAtach2AvataaarPart.ContainsKey(apart.attachmentPoint)) { dicAtach2AvataaarPart[apart.attachmentPoint].Add(apart); } else { dicAtach2AvataaarPart[apart.attachmentPoint] = new List <AvataaarPart>() { apart }; } if (dicEmo2Part.ContainsKey(apart.emotions)) { dicEmo2Part[apart.emotions].Add(apart); } else { dicEmo2Part[apart.emotions] = new List <AvataaarPart>() { apart }; } }
public void UpdatePartAppearance(AvataaarPart ap, float yscale) { Transform t = dicAttachmentPoint2Transform[ap.attachmentPoint]; t.GetComponent <Image>().sprite = ap.sprite; t.localScale = new Vector3(ap.xMult * ap.baseMultiplier, yscale, ap.baseMultiplier); // if(ap.attachmentPoint == AttachmentPoints.EyeLeft) print(ap.sprite.name); }
private void ConditionalThreshold(AvataaarPart ap, float percent) { if (ap.useThreshhold) { UpdatePartAppearance(ap, percent); } else { UpdatePartAppearance(ap, ap.baseMultiplier); } }
void LoopBlendsThroughCrucialParts(Dictionary <string, float> bs) { for (int i = 0; i < crucialParts.Length; i++) { AvataaarPart ap = crucialParts[i]; foreach (KeyValuePair <string, float> kvp in bs) { if ((ap.emotionallyDependent)) { if (currentEmotion == ap.emotions && dicEmo2Part[ap.emotions].Contains(ap)) { ProcessAP(ap, kvp.Key, kvp.Value); } } else { ProcessAP(ap, kvp.Key, kvp.Value); } } } }