void MotiveUpdate(float perHour) { MotivesRatio ratio = Mice.mice.waitMotives; switch (state) { case MSTATE.USEMP: ratio = callbackMousePoint.motivesRatio; break; case MSTATE.MOVE: ratio = Mice.mice.moveMotives; break; } motives[(int)MSTIMULUS.HUNGER].Update(ratio.fullness * motiveMod.fullness, perHour); if (ratio.fullness > 0) { dayFeeding += ratio.fullness * perHour; motives[(int)MSTIMULUS.BATHROOM].Update(-1, perHour); } motives[(int)MSTIMULUS.ENERGY].Update(ratio.physicalEnergy * motiveMod.physicalEnergy, perHour); motives[(int)MSTIMULUS.SOCIAL].Update(ratio.socialEnergy * motiveMod.socialEnergy, perHour); motives[(int)MSTIMULUS.SEXDRIVE].Update(ratio.sexEnergy * motiveMod.sexEnergy, perHour); motives[(int)MSTIMULUS.BATHROOM].Update(ratio.bathroom * motiveMod.bathroom, perHour); motives[(int)MSTIMULUS.BOREDOM].Update(ratio.boredom * motiveMod.boredom, perHour); }
public Mouse(int index, MicePreset.MousePreset preset) { this.index = index; GameObject q = Instantiate(Mice.mice.bodyPrefab); body = q.GetComponent <MouseBody>(); motiveMod = preset.motiveMods; motives = new Appetite[7]; body.tform.parent = mice.transform; scale = Mice.MiceScale(preset.age, preset.maxAge, preset.maxScale); maxScale = preset.maxScale; age = preset.age; rstep = Mice.rstep; rtime = 0; maxAge = preset.maxAge; speed = (preset.energyLevel / Mice.mice.energyLevelG) * Mice.mice.speedG; relationshipsView = new List <int>(); female = preset.female; _relationships = new float[200]; motivesView = new List <int>(); protagRelationship = Mice.rmod * Mice.mice.baseProtagAffection; scale = Mice.MiceScale(age + 0.1f, this.female ? Mice.mice.pubertyf : Mice.mice.pubertym, maxScale); for (int i = 0; i < relationships.Length; ++i) { relationships[i] = Mice.rmod * Mice.mice.baseMouseAffection; } redShift = (preset.color.r / 255f) - 0.5f; greenShift = (preset.color.g / 255f) - 0.5f; blueShift = (preset.color.b / 255f) - 0.5f; affectionRate = Mice.mice.globalAffectionRate - Mice.mice.globalAffectionRate * blueShift; affinity = new Vector3(preset.color.r, preset.color.g, preset.color.b); hiAffinity = (int)Mathf.Max(affinity[0], Mathf.Max(affinity[1], affinity[2])); float hi = float.MinValue; for (int i = 0; i < 3; ++i) { if (affinity[i] > hi && i != hiAffinity) { penHiAffinity = i; hi = affinity[i]; } } body.SetupBody(scale, preset.color, index); goalPoint = MiceZone.zone.GetWanderPoint(); motives[(int)MSTIMULUS.HUNGER] = new AppHunger((int)MSTIMULUS.HUNGER, 0.5f, 0.3f, 0.7f, Mice.mice.hungerThreshold + 2 * greenShift, 10); motives[(int)MSTIMULUS.ENERGY] = new AppEnergy((int)MSTIMULUS.ENERGY, 1f, 0.1f, 0.9f, Mice.mice.energyLevelG + (greenShift + redShift), 15); motives[(int)MSTIMULUS.SOCIAL] = new AppSocial((int)MSTIMULUS.SOCIAL, 1f, 0.1f, 0.9f, Mice.mice.energyLevelG + 2 * blueShift, 8); motives[(int)MSTIMULUS.SEXDRIVE] = new AppSex((int)MSTIMULUS.SEXDRIVE, 0.5f, 0.1f, 0.9f, Mice.mice.energyLevelG + 2 * redShift, 9); motives[(int)MSTIMULUS.BATHROOM] = new AppBathroom((int)MSTIMULUS.BATHROOM, 1, 0.3f, 1, 1, 11); motives[(int)MSTIMULUS.BOREDOM] = new AppBoredom((int)MSTIMULUS.BOREDOM, 0.5f, 0.1f, 0.9f, Mice.mice.energyLevelG + 2 * redShift, 8); motives[(int)MSTIMULUS.CALL] = new AppCall((int)MSTIMULUS.CALL, 1, 0.5f, 0.75f, 1, 100); body.emo.SetNotVisible(); }
public Mouse(int index, int father, int mother) { Mouse f = Mice.GetMouse(father); Mouse m = Mice.GetMouse(mother); this.father = father; this.mother = mother; motives = new Appetite[7]; this.index = index; GameObject q = Instantiate(Mice.mice.bodyPrefab); body = q.GetComponent <MouseBody>(); body.tform.parent = mice.transform; age = 0; maxAge = (m.maxAge + f.maxAge) / 2f; rstep = Mice.rstep; rtime = 0; maxScale = rbool ? m.maxScale : f.maxScale; female = rbool; scale = Mice.MiceScale(age + 0.1f, this.female ? Mice.mice.pubertyf : Mice.mice.pubertym, maxScale); Color fc = f.body.body.material.color; Color mc = m.body.body.material.color; float ccr = rbool ? fc.r : mc.r; float ccg = rbool ? fc.g : mc.g; float ccb = rbool ? fc.b : mc.b; Color cc = new Color(ccr * Mice.rmod, ccg * Mice.rmod, ccb * Mice.rmod, 255); redShift = ccr / 255f - 0.5f; greenShift = ccg / 255f - 0.5f; blueShift = ccb / 255f - 0.5f; affinity = new Vector3(cc.r, cc.g, cc.b); hiAffinity = (int)Mathf.Max(affinity[0], Mathf.Max(affinity[1], affinity[2])); float hi = float.MinValue; for (int i = 0; i < 3; ++i) { if (affinity[i] > hi && i != hiAffinity) { penHiAffinity = i; hi = affinity[i]; } } body.SetupBody(scale, cc, index); motivesView = new List <int>(); speed = (rbool ? m.speed : f.speed) * (1 + 0.5f * redShift); relationshipsView = new List <int>(); motiveMod = rbool ? m.motiveMod : f.motiveMod; _relationships = new float[200]; protagRelationship = Mice.rmod * Mice.mice.baseProtagAffection; for (int i = 0; i < relationships.Length; ++i) { relationships[i] = Mice.rmod * Mice.mice.baseMouseAffection; } relationships[father] = 6f; relationships[mother] = 6f; protagRelationship = Mice.rmod * Mice.mice.baseProtagAffection; affectionRate = rbool ? f.affectionRate : m.affectionRate; goalPoint = MiceZone.zone.GetWanderPoint(); motives[(int)MSTIMULUS.HUNGER] = new AppHunger((int)MSTIMULUS.HUNGER, 0.5f, 0.3f, 0.7f, Mice.mice.hungerThreshold + 2 * greenShift, 10); motives[(int)MSTIMULUS.ENERGY] = new AppEnergy((int)MSTIMULUS.ENERGY, 1f, 0.1f, 0.9f, Mice.mice.energyLevelG + (greenShift + redShift), 15); motives[(int)MSTIMULUS.SOCIAL] = new AppSocial((int)MSTIMULUS.SOCIAL, 0.5f, 0.1f, 0.9f, Mice.mice.energyLevelG + 2 * blueShift, 8); motives[(int)MSTIMULUS.SEXDRIVE] = new AppSex((int)MSTIMULUS.SEXDRIVE, 0.5f, 0.1f, 0.9f, Mice.mice.energyLevelG + 2 * redShift, 9); motives[(int)MSTIMULUS.BATHROOM] = new AppBathroom((int)MSTIMULUS.BATHROOM, 0.9f, 0.3f, 1, 1, 11); motives[(int)MSTIMULUS.BOREDOM] = new AppBoredom((int)MSTIMULUS.BOREDOM, 0.5f, 0.1f, 0.9f, Mice.mice.energyLevelG + 2 * redShift, 8); motives[(int)MSTIMULUS.CALL] = new AppCall((int)MSTIMULUS.CALL, 1, 1, 1, 1, 100); body.emo.SetNotVisible(); }