Example #1
0
        public Eye(double x, double y, DNA dna, Organ parent)
        {
            base.Init(parent, int.Parse(dna.abstraction.GetElementsByTagName("size")[0].InnerText), x, y);
            amount = 3;

            foreach (XmlElement xml in dna.abstraction.GetElementsByTagName("MainCell"))
            {
                double dir;
                int    size;
                switch (xml.Name)
                {
                case "MainCell":
                    dir  = double.Parse(xml.GetElementsByTagName("dir")[0].Value);
                    size = int.Parse(xml.GetElementsByTagName("size")[0].Value);
                    Organs.Add(new MainCell((int)(x + size * Math.Cos(dir)), (int)(y + size * Math.Sin(dir)), creature, new DNA(xml)));
                    break;

                case "Fin":
                    dir  = double.Parse(xml.GetElementsByTagName("dir")[0].Value);
                    size = int.Parse(xml.GetElementsByTagName("size")[0].Value);
                    Organs.Add(new Fin((int)(x + size * Math.Cos(dir)), (int)(y + size * Math.Sin(dir)), this, new DNA(xml)));
                    break;

                default:
                    break;
                }
            }
        }
Example #2
0
        public virtual void Init(Organ parent, int size, double x, double y)
        {
            this.parent   = parent;
            this.creature = parent.creature;
            this.size     = size;
            this.x        = x;
            this.y        = y;

            creature.organs.Add(this);
        }
Example #3
0
 public override void Init(Organ parent, Creature creature, int size, double x, double y)
 {
     base.Init(parent, creature, size, x, y);
     creature.inputs.Add(this);
 }