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; }
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); } }