Ejemplo n.º 1
0
        internal override void Action(Organism organism, ThisWorld thisWorld, StorageForElements storageForElements)
        {
            var options = new Specification();
            var element = thisWorld.CheckField(organism.State.Cell, _x, _y);

            if (element == null)
            {
                var cell = thisWorld.GetCell(organism.State.Cell.Point.X / options.SizeCell + _x, organism.State.Cell.Point.Y / options.SizeCell + _y);
                cell.Element = organism;
                organism.State.Cell.Element = null;
                organism.State.Cell         = thisWorld.GetCell(organism.State.Cell.Point.X / options.SizeCell + _x, organism.State.Cell.Point.Y / options.SizeCell + _y);
            }
            organism.Defense = false;
            organism.Scout   = false;
        }
Ejemplo n.º 2
0
 internal override void Action(Organism organism, ThisWorld thisWorld, StorageForElements storageForElements)
 {
     organism.Defense = false;
     if (organism.Scout)
     {
         organism.Scout = false;
         HelpAction(organism, thisWorld, -1, 0, storageForElements);
         HelpAction(organism, thisWorld, 1, 0, storageForElements);
         HelpAction(organism, thisWorld, 0, -1, storageForElements);
         HelpAction(organism, thisWorld, 0, 1, storageForElements);
     }
     else
     {
         HelpAction(organism, thisWorld, _x, _y, storageForElements);
     }
 }
Ejemplo n.º 3
0
 internal abstract void Action(Organism organism, ThisWorld thisWorld, StorageForElements storageForElements);
Ejemplo n.º 4
0
 internal override void Action(Organism organism, ThisWorld thisWorld, StorageForElements storageForElements)
 {
     organism.Scout   = true;
     organism.Defense = false;
 }
Ejemplo n.º 5
0
        private void HelpAction(Organism organism, ThisWorld thisWorld, int x, int y, StorageForElements storageForElements)
        {
            var options = new Specification();
            var element = thisWorld.CheckField(organism.State.Cell, x, y);

            if (element != null)
            {
                if (element.GetType() == typeof(Eat))
                {
                    organism.State.UpLifeFromEat();
                }
                if (element.GetType() == typeof(Organism))
                {
                    var bufOrganism = (Organism)element;
                    if (bufOrganism.Defense)
                    {
                        thisWorld.DeleteElement(organism);
                        return;
                    }
                    organism.State.UpLifeFromOrganism();
                }
                thisWorld.DeleteElement(element);
            }
        }