public static void AddBird(Bird b) { foreach (var old in birds) { if (old.cHead == b.cHead && old.cTail == b.cTail && old.cTorso == b.cTorso && old.cWing == b.cWing && old.BeakType == b.BeakType) return; } birds.Add(b); WriteStuff(); }
public Bird CreateBird(Island i, Vector3 pos) { int beak = G.r.Next(5); Bird b = new Bird(i, pos); b.BeakType = beak; b.SetTexturesSide(sHead, sTorso, sTail, sLeg, sBeaks[beak], sWing); b.SetTexturesFront(fHead, fTorso, fLeg, fBeaks[beak], fWing); b.SetTexturesBack(bHead, bTorso, bLeg, bWing, bTail); Color baseColor = GenColor(Color.White); b.SetColors(GenColor(baseColor), GenColor(baseColor), baseColor, GenColor(baseColor)); b.FinalizeBird(); return b; }
static Encyclopedia() { try { var lines = File.ReadAllLines("encyclopedia.txt"); foreach (var line in lines) { try { var s = line.Split(':'); var head = ToColor(s[0]); var tail = ToColor(s[1]); var torso = ToColor(s[2]); var wing = ToColor(s[3]); var beak = int.Parse(s[4]); var name = s.Length == 6 ? s[5] : ""; Bird b = new Bird(null, Vector3.Zero); b.cHead = head; b.cTail = tail; b.cTorso = torso; b.cWing = wing; b.BeakType = beak; b.Name = name; birds.Add(b); } catch { } } } catch { } }
internal static void NameBird(Bird b, string name) { foreach (var old in birds) { if (old.cHead == b.cHead && old.cTail == b.cTail && old.cTorso == b.cTorso && old.cWing == b.cWing && old.BeakType == b.BeakType) { old.Name = name; WriteStuff(); } } }
internal static string GetName(Bird b) { if (b == null) { return ""; } foreach (var old in birds) { if (old.cHead == b.cHead && old.cTail == b.cTail && old.cTorso == b.cTorso && old.cWing == b.cWing && old.BeakType == b.BeakType) return old.Name; } return ""; }