ARKBreedingStats.Pedigree.createParentsChild C# (CSharp) Method

createParentsChild() private method

private createParentsChild ( Creature creature, int x, int y, bool drawWithNoParents = false, bool highlightCreature = false ) : bool
creature Creature
x int
y int
drawWithNoParents bool
highlightCreature bool
return bool
        private bool createParentsChild(Creature creature, int x, int y, bool drawWithNoParents = false, bool highlightCreature = false)
        {
            if (creature != null && (drawWithNoParents || creature.Mother != null || creature.Father != null))
            {
                // scrolloffset for control-locations (not for lines)
                int xS = AutoScrollPosition.X;
                int yS = AutoScrollPosition.Y;
                // creature
                PedigreeCreature pc = new PedigreeCreature(creature, enabledColorRegions);
                if (highlightCreature)
                    pc.highlight = true;
                pc.Location = new Point(x + xS, y + yS + 40);
                Controls.Add(pc);
                pc.CreatureClicked += new PedigreeCreature.CreatureChangedEventHandler(CreatureClicked);
                pc.CreatureEdit += new PedigreeCreature.CreatureEditEventHandler(CreatureEdit);
                pc.BestBreedingPartners += new PedigreeCreature.CreaturePartnerEventHandler(BestBreedingPartners);
                pcs.Add(pc);
                // mother
                if (creature.Mother != null)
                {
                    pc = new PedigreeCreature(creature.Mother, enabledColorRegions);
                    pc.Location = new Point(x + xS, y + yS);
                    Controls.Add(pc);
                    pc.CreatureClicked += new PedigreeCreature.CreatureChangedEventHandler(CreatureClicked);
                    pc.CreatureEdit += new PedigreeCreature.CreatureEditEventHandler(CreatureEdit);
                    pc.BestBreedingPartners += new PedigreeCreature.CreaturePartnerEventHandler(BestBreedingPartners);
                    pcs.Add(pc);
                }
                // father
                if (creature.Father != null)
                {
                    pc = new PedigreeCreature(creature.Father, enabledColorRegions);
                    pc.Location = new Point(x + xS, y + yS + 80);
                    Controls.Add(pc);
                    pc.CreatureClicked += new PedigreeCreature.CreatureChangedEventHandler(CreatureClicked);
                    pc.CreatureEdit += new PedigreeCreature.CreatureEditEventHandler(CreatureEdit);
                    pc.BestBreedingPartners += new PedigreeCreature.CreaturePartnerEventHandler(BestBreedingPartners);
                    pcs.Add(pc);
                }
                // gene-inheritance-lines
                // better: if father < mother: 1, if mother < father: -1
                int better;
                for (int s = 0; s < 7; s++)
                {
                    better = 0;
                    if (creature.Mother != null && creature.Father != null)
                    {
                        if (creature.Mother.levelsWild[s] < creature.Father.levelsWild[s])
                            better = -1;
                        else if (creature.Mother.levelsWild[s] > creature.Father.levelsWild[s])
                            better = 1;
                    }
                    if (creature.Mother != null && creature.levelsWild[s] >= 0 && creature.levelsWild[s] == creature.Mother.levelsWild[s])
                    {
                        lines[0].Add(new int[] { 38 + x + 28 * s, y + 33, 38 + x + 28 * s, y + 42, (better == -1 ? 1 : 2) });
                    }
                    if (creature.Father != null && creature.levelsWild[s] >= 0 && creature.levelsWild[s] == creature.Father.levelsWild[s])
                    {
                        lines[0].Add(new int[] { 38 + x + 28 * s, y + 83, 38 + x + 28 * s, y + 74, (better == 1 ? 1 : 2) });
                    }
                }
                return true;
            }
            return false;
        }