public void SetupFace(Face f, FIRL frame, GrandData g) { f.AddAction(TouchAction.Up, () => { if (ginfo_target != g) { if (ginfo != null) { ginfo.PoolDestroy(); } ginfo_face = f; ginfo_target = g; ginfo = GameManager.UI.GrandInfo(g); Vector3 pos = new Vector3(this.transform.position.x, f.transform.position.y - 10, 0.0F); ginfo.SetUIPositionFromWorld(pos); ginfo.FitOnScreen(); ginfo.SetActive(false); ginfo.TweenActive(true); lastsmiles = g.Smiles.Value; lastgrumps = g.Grumps.Value; Tweens.Bounce(f.transform); } else if (ginfo != null) { ginfo.PoolDestroy(); ginfo_target = null; } }); }
public void SetPupilInfo(GrandData final) { Vector3 eyescale = (final.Info.Eye._Scale - Vector3.one); Vector3 r = eyescale * Random.Range(0.7F, 1.3F); final.Info.PupilScale = Vector3.one * 0.5F + Utility.RandomVectorInclusive(r.x + 0.1F, r.y + 0.1F, 0.0F); }
public Face GenerateNewFace(GrandData targ) { GameObject _base = (GameObject)Instantiate(Base.GetObject(targ.Info.Gender, targ.Info.Base.Index)); Face final = _base.GetComponent <Face>(); final.FaceChildren.Left_Eye = Instantiate(Eye.GetObject(targ.Info.Gender, targ.Info.Eye.Index)).GetComponent <Face_Obj>(); final.FaceChildren.Right_Eye = Instantiate(Eye.GetObject(targ.Info.Gender, targ.Info.Eye.Index)).GetComponent <Face_Obj>(); final.FaceChildren.Left_Ear = Instantiate(Ear.GetObject(targ.Info.Gender, targ.Info.Ear.Index)).GetComponent <Face_Obj>(); final.FaceChildren.Right_Ear = Instantiate(Ear.GetObject(targ.Info.Gender, targ.Info.Ear.Index)).GetComponent <Face_Obj>(); final.FaceChildren.Left_Brow = Instantiate(Brow.GetObject(targ.Info.Gender, targ.Info.Brow.Index)).GetComponent <Face_Obj>(); final.FaceChildren.Right_Brow = Instantiate(Brow.GetObject(targ.Info.Gender, targ.Info.Brow.Index)).GetComponent <Face_Obj>(); final.FaceChildren.Hair = Instantiate(Hair.GetObject(targ.Info.Gender, targ.Info.Hair.Index)).GetComponent <Face_Obj>(); final.FaceChildren.Nose = Instantiate(Nose.GetObject(targ.Info.Gender, targ.Info.Nose.Index)).GetComponent <Face_Obj>(); final.FaceChildren.Jaw = Instantiate(Jaw.GetObject(targ.Info.Gender, targ.Info.Jaw.Index)).GetComponent <Face_Obj>(); if (targ.Info.Glasses != null) { final.Glasses_Left = Instantiate(Glasses.GetObject(true, targ.Info.Glasses.Index)).GetComponent <Face_Obj>(); final.Glasses_Right = Instantiate(Glasses.GetObject(true, targ.Info.Glasses.Index)).GetComponent <Face_Obj>(); } final.Create(targ.Info); _base.transform.SetParent(GameManager.GetWorldObjects().transform); _base.transform.localPosition = Vector3.zero; _base.name = targ.Info.Name; targ.Faces.Add(final); return(final); }
public FIRL MeterAlert(GrandData g, AlertType t) { Face f = g.TargetFace; FIRL alert = Instantiate(Prefabs.GetObject("fobj_meter") as GameObject).GetComponent <FIRL>(); alert.Init(0, null); alert.transform.position = f.pos + f.T.up; Resource res = null; string title = ""; switch (t) { case AlertType.Hunger: res = g.Hunger; title = "HUNGER"; break; case AlertType.Fitness: res = g.Fitness; title = "Fitness"; break; case AlertType.Social: res = g.Social; title = "Social"; break; } alert[0].transform.localScale = new Vector3(res.Ratio, 1.0F, 1.0F); alert.Text[0].text = title; alert.TweenActive(true); return(alert); }
public GrandData GenerateGrand() { GrandData fin = new GrandData(System.Guid.NewGuid()); fin.RoleType = Role.Resident; RandomiseGrandData(fin); RandomiseFaceData(fin); return(fin); }
public UIObj GrandInfo(GrandData g) { UIObj final = (Prefabs.GetObject("grandinfo") as GameObject).GetComponent <UIObj>(); final.Init(-1, WorldObjects); WorldObjects.AddChild(final); final.ResetRect(); final.transform.localPosition = Vector3.zero; SetGrandInfoObj(final, g); return(final); }
public GreatGrand GenerateGuest() { GrandData guest = GenerateGrand(); guest.RoleType = Role.Visitor; guest.Hunger.Set(Random.Range(25, 50)); guest.Social.Set(Random.Range(25, 50)); guest.Fitness.Set(Random.Range(25, 50)); GreatGrand fin = Generate(guest); return(fin); }
public void RandomiseFaceData(GrandData final) { final.Info.C_Hair = HairGrad.Evaluate(Random.value); //RandomHair(); final.Info.C_Skin = SkinGrad.Evaluate(Random.value); //RandomSkin(); final.Info.C_Eye = RandomEye(); RandomiseOffsetColours(final); final.Info.Base = Base.Randomise(final.Info.Gender, Simple2x2.zero, Simple2x2.zero, Simple2x2.zero); final.Info.Eye = Eye.Randomise(final.Info.Gender, new Simple2x2(0.0F, -0.5F, 0.0F, 0.9F), Simple2x2.zero, new Simple2x2(-0.2F, -0.2F, 0.1F, 0.1F)); // new Vector3(0,0.05F), 0.0F, new Vector3(0.1F, 0.1F)); final.Info.Ear = Ear.Randomise(final.Info.Gender, new Simple2x2(0.0F, -1.5F, 0.0F, 1.5F), new Simple2x2(-4.0F, 0.0F, 4.0F, 0.0F), new Simple2x2(-0.3F, -0.3F, 0.05F, 0.25F)); //new Vector3(0,0.3F), 4.0F, new Vector3(0.3F, 0.3F)); final.Info.Brow = Brow.Randomise(final.Info.Gender, new Simple2x2(0.0F, -0.1F, 0.0F, 0.15F), new Simple2x2(-5.0F, 0.0F, 7.0F, 0.0F), new Simple2x2(-0.2F, -0.15F, 0.35F, 0.35F)); //new Vector3(0,0.1F), 6.0F, new Vector3(0.3F, 0.2F)); final.Info.Hair = Hair.Randomise(final.Info.Gender, Simple2x2.zero, Simple2x2.zero, new Simple2x2(0.0F, -0.1F, 0.0F, 0.1F)); //Vector3.zero, 0.0F, new Vector3(0.0F, 0.1F)); final.Info.Jaw = Jaw.Randomise(final.Info.Gender, Simple2x2.zero, Simple2x2.zero, new Simple2x2(-0.15F, -0.15F, 0.13F, 0.2F)); //Vector3.zero, 0.0F, new Vector3(0.35F, 0.25F)); final.Info.Nose = Nose.Randomise(final.Info.Gender, new Simple2x2(0.0F, -0.7F, 0.0F, 0.7F), Simple2x2.zero, new Simple2x2(-0.2F, -0.15F, 0.2F, 0.35F)); //new Vector3(0,0.1F), 0.0F, new Vector3(0.1F, 0.3F)); final.Info.Glasses = Random.value > (float)final.Age.Current / 100 ? null : Glasses.Randomise(true, Simple2x2.zero, Simple2x2.zero, new Simple2x2(0.0F, 0.0F, 0.34F, 0.35F)); if (final.Info.Glasses != null) { final.Info.Glasses._Scale += (final.Info.Eye._Scale - Vector3.one); final.Info.Glasses._Position = final.Info.Eye._Position; } SetPupilInfo(final); }
public GrandData EditorGenerate() { GrandData fin = new GrandData(System.Guid.NewGuid()); fin.RoleType = Role.Resident; RandomiseGrandData(fin); CheckEditorInfo(fin); RandomiseOffsetColours(fin); SetPupilInfo(fin); return(fin); }
public void CheckEditorInfo(GrandData fin) { fin.Info.Base = Base.GetCurrent(); fin.Info.Eye = Eye.GetCurrent(); fin.Info.Ear = Ear.GetCurrent(); fin.Info.Brow = Brow.GetCurrent(); fin.Info.Hair = Hair.GetCurrent(); fin.Info.Jaw = Jaw.GetCurrent(); fin.Info.Nose = Nose.GetCurrent(); fin.Info.C_Hair = HairCurrent; fin.Info.C_Skin = SkinCurrent; fin.Info.C_Eye = EyeCurrent; }
public void RandomiseOffsetColours(GrandData final) { Color skin = final.Info.C_Skin; HSBColor offtemp = new HSBColor(skin); //offtemp.h += (Random.value - Random.value)/50; //offtemp.s += (Random.value)/10; //offtemp.b += Random.Range(-0.05F, 0.02F); final.Info.C_Offset = offtemp.ToColor(); HSBColor nosetemp = new HSBColor(skin); nosetemp.s *= 1.6F; final.Info.C_Nose = nosetemp.ToColor(); }
public GreatGrand Generate(GrandData g) { GreatGrand final = (GreatGrand)Instantiate(GGObj); final.Data = g; final.Data.GrandObj = final; Transform p = GameManager.Data.ResidentParent.transform; if (g.RoleType == Role.Visitor) { p = GameManager.Data.GuestParent.transform; } final.transform.SetParent(p); final.gameObject.name = final.Data.Info.Name + "-" + final.Data.RoleType; return(final); }
public void RandomiseGrandData(GrandData final) { final.Info.Gender = Random.value > 0.5F; final.Info.Name = final.Info.Gender ? GrandData.Names_Male_Random : GrandData.Names_Female_Random; final.SetTimeLast(System.DateTime.Now); final.Social.Set((int)Random.Range(30, 70)); final.Social.SetRate(-4.0F + Random.Range(-2.0F, 4.0F), new System.TimeSpan(0, 1, 0)); final.Fitness.Set((int)Random.Range(30, 70)); final.Fitness.SetRate(-2.0F + Random.Range(-3.0F, -1.0F), new System.TimeSpan(0, 1, 0)); final.Hunger.Set(100); final.Hunger.SetRate(-2.0F + Random.Range(-3.0F, -1.0F), new System.TimeSpan(0, 1, 0)); final.Age.Set(Random.Range(60, 70)); final.Age.SetRate(1, new System.TimeSpan(24, 0, 0)); //Add grump based on age if male, remove if female //float agefactor = Mathf.Clamp((float)Info.Age/100.0F, 0.0F, 0.2F); //final.Info.GFactor += gender ? agefactor : -agefactor; final.Info.MStat = Random.value > 0.65F ? MaritalStatus.Married : (Random.value > 0.8F ? MaritalStatus.Divorced : MaritalStatus.Donor); //Add grump if divorced, remove if married switch (final.Info.MStat) { case MaritalStatus.Married: //Info.GFactor -= 0.15F; break; case MaritalStatus.Divorced: //Info.GFactor += 0.15F; break; case MaritalStatus.Donor: break; } final.Info.Military = Random.value > 0.95F; }
public void SetGrandInfoObj(UIObj final, GrandData g) { final[0].Txt[0].text = g.Info.Name; final[0].Txt[1].text = "Age " + g.Age.Value; final[0].Txt[2].text = g.RoleType + ""; final[1][0].Txt[0].text = "Hungry "; final[1][0].Svg[0].transform.localScale = Vector3.Lerp( final[1][0].Svg[0].transform.localScale, new Vector3(g.Hunger.Ratio, 1, 1), Time.deltaTime * 10); final[1][0].Svg[0].color = Color.Lerp(Color.red, Color.green, g.Hunger.Ratio); final[1][1].Txt[0].text = "Fitness "; final[1][1].Svg[0].transform.localScale = Vector3.Lerp( final[1][1].Svg[0].transform.localScale, new Vector3(g.Fitness.Ratio, 1, 1), Time.deltaTime * 10); final[1][1].Svg[0].color = Color.Lerp(Color.red, Color.green, g.Fitness.Ratio); final[1][2].Txt[0].text = "Social "; final[1][2].Svg[0].transform.localScale = Vector3.Lerp( final[1][2].Svg[0].transform.localScale, new Vector3(g.Social.Ratio, 1, 1), Time.deltaTime * 10); final[1][2].Svg[0].color = Color.Lerp(Color.red, Color.green, g.Social.Ratio); }
IEnumerator EndGame() { while (!AllSeated) { yield return(null); } UIObj endgame = MUI["endgame"]; Running = false; GameManager.IgnoreInput = true; timerobj.Txt[0].text = ""; timerobj.Txt[1].text = ""; if (!GameManager.WorldRes.Funds.Charge(DinnerCost)) { endgame[0].TweenActive(true); endgame[1].SetActive(false); endgame[2].SetActive(false); endgame[0].Txt[0].text = "No Funds!"; FinalScore = 0; yield return(new WaitForSeconds(0.8F)); endgame[0].TweenActive(false); yield return(StartCoroutine(FinishDinner())); yield break; } endgame[0].TweenActive(true); endgame[1].SetActive(false); endgame[2].SetActive(false); endgame[0].Txt[0].text = "Let's Eat!"; FinalScore = 0; yield return(new WaitForSeconds(0.85F)); endgame[0].TweenActive(false); List <FOBJ> correct = new List <FOBJ>(); List <FOBJ> wrong = new List <FOBJ>(); for (int i = 0; i < _TableManager.Seat.Length; i++) { GreatGrand grand = _TableManager.Seat[i].Target; if (grand == null) { continue; } int targ_grumps = grand.GetGrumps(false); yield return(new WaitForSeconds(Time.deltaTime * 5)); Sprite s = targ_grumps >= 0 ? Alert_Right : Alert_Wrong; FOBJ a = Instantiate(GameManager.UI.Prefabs.GetObject("FOBJ_Default") as GameObject).GetComponent <FOBJ>(); (a as FIRL).IMG[0].sprite = s; a.SetActive(false); a.transform.position = grand.TargetFace.pos - Vector3.forward * 1; a.transform.localScale = Vector3.one * 1.8F; a.TweenActive(true); if (targ_grumps >= 0) { correct.Add(a); } else { wrong.Add(a); } yield return(new WaitForSeconds(0.12F)); } UIObj info = MUI["kitchen"]; info.Txt[1].text = "HAPPY\nGRANDS"; info.Txt[0].text = FinalScore + ""; Tweens.Bounce(info.transform); info.TweenActive(true); yield return(new WaitForSeconds(0.5F)); bool isCounting = true; for (int i = 0; i < correct.Count; i++) { SendCorrectAlert(correct[i], info.transform); } for (int i = 0; i < wrong.Count; i++) { wrong[i].transform.DOScale(Vector3.zero, 0.3F).OnComplete(() => {}); } while (isCounting) { info.Txt[0].text = FinalScore + ""; bool complete = true; for (int i = 0; i < correct.Count; i++) { if (correct[i] != null) { complete = false; break; } } if (complete) { isCounting = false; } yield return(null); } int rep = (int)((FinalScore * 5) * (1.0F + (Difficulty * Bonus_DifficultyMultiplier))); info.Txt[0].text = rep + ""; if (GameTime < Timer) { yield return(new WaitForSeconds(0.4F)); float mult = 1.0F - (GameTime / Timer * Bonus_TimerDecay); mult = Mathf.Clamp(1.0F + mult, 1.0F, Bonus_TimerMax); rep = (int)((float)rep * mult); info.Txt[0].text = rep + ""; info.Txt[1].text = "TIME\nBONUS"; info.Txt[1].color = Color.green; Tweens.Bounce(info.transform); yield return(null); } if (FinalScore == GGNum) { yield return(new WaitForSeconds(0.4F)); rep = (int)((float)rep * Bonus_Perfect); info.Txt[0].text = rep + ""; info.Txt[1].text = "PERFECT!"; info.Txt[1].color = Color.blue; Tweens.Bounce(info.transform); yield return(null); } yield return(new WaitForSeconds(0.4F)); StartCoroutine(GameManager.UI.ResourceAlert(GameManager.WorldRes.Rep, rep)); List <FIRL> alerts = new List <FIRL>(); for (int i = 0; i < _TableManager.Seat.Length; i++) { GrandData g = _TableManager.Seat[i].Target.Data; FIRL a = GameManager.UI.MeterAlert(g, AlertType.Hunger); alerts.Add(a); Tweens.Bounce(a.transform); yield return(null); } //FUTURE ANIMATION OF GRANDS EATING yield return(new WaitForSeconds(0.3F)); //$$$$$$$ int hungerticks = 10 + FinalScore * 10; int ticks = 0; float tickrate = 1; while (true) { for (int i = 0; i < _TableManager.Seat.Length; i++) { GrandData g = _TableManager.Seat[i].Target.Data; g.Hunger.Add((int)tickrate); alerts[i][0].transform.localScale = new Vector3(g.Hunger.Ratio, 1.0F, 1.0f); } ticks += (int)tickrate; tickrate *= 1.1F; if (ticks >= hungerticks) { break; } yield return(null); } yield return(new WaitForSeconds(0.3F)); for (int i = 0; i < alerts.Count; i++) { alerts[i].PoolDestroy(); } yield return(new WaitForSeconds(0.5F)); yield return(StartCoroutine(FinishDinner())); }
public void Load() { Debug.Log("---- LOADING FROM " + Save_Target); Grands = new List <GrandData>(); if (!System.IO.File.Exists(Save_Target)) { Debug.Log("COULDN'T FIND SAVE FILE"); SetupData(); Save(); return; } Save_Data = SaveData.Load(Save_Target); Debug.Log("--LOADING SAVE DATA: " + Save_Data); if (Save_Data == null) { Debug.Log("COULDN'T FIND SAVE FILE"); SetupData(); return; } if (!Save_Data.TryGetValue <System.DateTime>("Time", out TimeLast)) { TimeLast = System.DateTime.Now; } FundsHourly = new GoodBoy(TimeLast, new System.TimeSpan(1, 0, 0)); //Loading World string [] s; if (Save_Data.TryGetValue <string[]>("World-Resources", out s)) { //World = new WorldResources(); for (int i = 0; i < s.Length; i++) { World[i].Name = s[i]; World[i].Multiplier = Save_Data.GetValue <float>("World-" + s[i] + "-Multiplier"); //World[i].Index = Save_Data.GetValue<int>("World-"+s[i]+"-Index"); //World[i].Col = Save_Data.GetValue<Color>("World-"+s[i]+"-Col"); if (World[i] is Stat) { (World[i] as Stat).SetLevel(Save_Data.GetValue <int>("World-" + s[i] + "-Level")); } else { World[i].Max = Save_Data.GetValue <int>("World-" + s[i] + "-Max"); } World[i].Set(Save_Data.GetValue <int>("World-" + s[i] + "-Current")); } } RepLast = Save_Data.TryGetValue <int>("Rep Last"); //Loading Grands System.Guid [] prevhex; if (Save_Data.TryGetValue <System.Guid[]>("Prev Grands", out prevhex)) { for (int i = 0; i < World.Population; i++) { if (i >= prevhex.Length || prevhex[i] == null) { continue; } GrandData g = new GrandData(prevhex[i]); string pref = "Grand:" + prevhex[i].ToString(); g.Info.Name = Save_Data.TryGetValue <string>(pref + "-Name"); g.Info.Gender = Save_Data.TryGetValue <bool>(pref + "-Gender"); g.Info.PupilScale = Save_Data.TryGetValue <Vector3>(pref + "-Pupils"); g.Info.Nation = Save_Data.TryGetValue <NationStatus>(pref + "-Nation"); g.Info.C_Skin = Save_Data.TryGetValue <Color>(pref + "-C_Skin"); g.Info.C_Hair = Save_Data.TryGetValue <Color>(pref + "-C_Hair"); g.Info.C_Eye = Save_Data.TryGetValue <Color>(pref + "-C_Eye"); g.Info.C_Offset = Save_Data.TryGetValue <Color>(pref + "-C_Offset"); g.Info.C_Nose = Save_Data.TryGetValue <Color>(pref + "-C_Nose"); for (int a = 0; a < f_inf.Length; a++) { g.SetFaceInfo(f_inf[a], new FaceInfo( Save_Data.TryGetValue <int>(pref + "-" + f_inf[a] + ":Index"), Save_Data.TryGetValue <Vector3[]>(pref + "-" + f_inf[a] + ":Values"), Save_Data.TryGetValue <ColorType>(pref + "-" + f_inf[a] + ":Colour"))); } for (int r = 0; r < g.Resources.Length; r++) { g.Resources[r] = new Resource( Save_Data.TryGetValue <int>(pref + "-Res " + r + ":Index"), Save_Data.TryGetValue <int>(pref + "-Res " + r + ":Current"), Save_Data.TryGetValue <int>(pref + "-Res " + r + ":Max") ); g.Resources[r].Set(Save_Data.TryGetValue <int>(pref + "-Res " + r + ":Current")); System.TimeSpan span = System.TimeSpan.FromSeconds(Save_Data.GetValue <double>(pref + "-Res " + r + ":SpanSecs")); g.Resources[r].SetRate(Save_Data.TryGetValue <float>(pref + "-Res " + r + ":Rate"), span); g.Resources[r].TimeLast = Save_Data.TryGetValue <System.DateTime>(pref + "-Res " + r + ":TimeLast"); } Grands.Add(g); } } print("Loaded info: " + Grands.Count + " grands"); }
public GrandAlert(AlertType t, GrandData g, params int [] v) { Type = t; Grand = g; Values = v; }
public void Act(GrandData d) { _action(d, Values); }
public void Save() { PlayerPrefs.SetInt("Alert_Pigeonhole", Alert_Pigeonhole ? 1 : 0); PlayerPrefs.SetInt("Alert_ScrollUp", Alert_ScrollUp ? 1 : 0); PlayerPrefs.SetInt("Alert_Letter", Alert_Letter ? 1 : 0); Save_Data = new SaveData(Save_File); Save_Data["Time"] = System.DateTime.Now; //Saving World Save_Data["World-Resources"] = World.Names; for (int i = 0; i < World.Length; i++) { Save_Data["World-" + World[i].Name + "-Current"] = World[i].Current; Save_Data["World-" + World[i].Name + "-Multiplier"] = World[i].Multiplier; Save_Data["World-" + World[i].Name + "-Index"] = World[i].Index; Save_Data["World-" + World[i].Name + "-Max"] = World[i].Max; Save_Data["World-" + World[i].Name + "-Col"] = World[i].Col; if (World[i] is Stat) { Save_Data["World-" + World[i].Name + "-Level"] = (World[i] as Stat).Level; } } //Saving Grands GrandData [] prev_GG = GameManager.instance.Grands; System.Guid [] prevgrands = new System.Guid[prev_GG.Length]; for (int i = 0; i < prev_GG.Length; i++) { string pref = "Grand:" + prev_GG[i].Hex.ToString(); GrandData Data = prev_GG[i]; prevgrands[i] = Data.Hex; Save_Data[pref + "-Name"] = Data.Info.Name; Save_Data[pref + "-Gender"] = Data.Info.Gender; Save_Data[pref + "-Pupils"] = Data.Info.PupilScale; Save_Data[pref + "-Nation"] = Data.Info.Nation; Save_Data[pref + "-C_Skin"] = Data.Info.C_Skin; Save_Data[pref + "-C_Hair"] = Data.Info.C_Hair; Save_Data[pref + "-C_Eye"] = Data.Info.C_Eye; Save_Data[pref + "-C_Offset"] = Data.Info.C_Offset; Save_Data[pref + "-C_Nose"] = Data.Info.C_Nose; for (int a = 0; a < f_inf.Length; a++) { FaceInfo f = Data.GetFaceInfo(f_inf[a]); string s = pref + "-" + f_inf[a]; Save_Data[s + ":Index"] = f.Index; Save_Data[s + ":Values"] = f.Values; Save_Data[s + ":Colour"] = f.Colour; } for (int r = 0; r < Data.Resources.Length; r++) { Resource res = Data.Resources[r]; string s = pref + "-Res " + r; Save_Data[s + ":Current"] = res.Current; Save_Data[s + ":Max"] = res.Max; Save_Data[s + ":Index"] = res.Index; Save_Data[s + ":Rate"] = res.Rate; Save_Data[s + ":SpanHours"] = res.Span.TotalHours; Save_Data[s + ":SpanMins"] = res.Span.Minutes; Save_Data[s + ":SpanSecs"] = res.Span.TotalSeconds; Save_Data[s + ":TimeLast"] = res.TimeLast; } } Save_Data["Rep Last"] = RepLast; Save_Data["Prev Grands"] = prevgrands; Save_Data.Save(Save_Target); print("Saved at " + Save_Target); print("Saved info: " + prevgrands.Length + " grands"); }
public override IEnumerator Load() { GameManager.instance.CheckPopulation(); int framenum = 10;//GameManager.WorldRes.Population; Faces = new Face[framenum]; Frames = new FIRL[framenum]; List <GrandData> allgrands = new List <GrandData>(); allgrands.AddRange(GameManager.instance.Grands); for (int i = 0; i < Faces.Length; i++) { if (allgrands.Count <= 0) { continue; } int num = Random.Range(0, allgrands.Count); GrandData f = allgrands[num]; if (f == null) { continue; } Frames[i] = Instantiate(GameManager.Data.RandomFrame()); Frames[i].transform.SetParent(MOB[0].transform); Frames[i].transform.position = MOB[0][i].transform.position; Frames[i].transform.localScale = Vector3.one * 0.15F; Faces[i] = GameManager.Generator.GenerateNewFace(f); Frames[i].Child[0].AddChild(Faces[i]); Faces[i].transform.localPosition = Vector3.zero; Frames[i].Text[0].text = f.Info.Name; SetupFace(Faces[i], Frames[i], f); yield return(null); } GameManager.instance.InitTimeChecks(); TrayObj.ClearActions(); TrayObj.AddAction(TouchAction.Up, () => { if (!GameManager.Paused) { StartCoroutine(GameManager.instance.ShowAlerts()); Tweens.Bounce(MOB["notices"].transform); } }); MOB["dinner"].AddAction(TouchAction.Up, () => { StartCoroutine(GameManager.instance.LoadModule("Dinner")); Tweens.Bounce(MOB["dinner"].transform); }); MOB["garden"].AddAction(TouchAction.Up, () => { StartCoroutine(GameManager.instance.LoadModule("bowls")); Tweens.Bounce(MOB["garden"].transform); }); }
public void AddGrand(GrandData g) { Data.Grands.Add(g); }