private void Start() { CreateUnits(); _view = Camera.main.GetComponent <ISelectorView>(); _selector.Initialize(_view); _selector.UpdateSelectables(BaseUnit.FirstCreated); _selector.OnSelected += OnSelectorSelected; _inputControllable.Begin += Input_Begin; _inputControllable.IsEnabled = true; }
public void Draw(IPainter <TVertex, TBox> painter, ISelector <TVertex, TBox> selector) { if (painter == null) { return; } if (IsFrozen) { selector = null; } else if (selector != null) { selector.Initialize(Settings.BoundsBox); } painter.BeginPaint(Settings.BoundsBox); foreach (TCell visualCell in Cells) { visualCell.Draw(painter, selector); } painter.EndPaint(); }
public void Step(int survivors, ISelector selector, IProcreator procreator, IEvaluator evaluator, Random random) { pooledPopulation.Clear(); for (int i = 0; i < survivors; i++) { pooledPopulation.Append().GetChromosome().AddRange(CurrentPopulation.ReadOnlyIndividuals[i].Chromosome); } selector.Initialize(CurrentPopulation); while (pooledPopulation.Individuals.Count < CurrentPopulation.ReadOnlyIndividuals.Count) { procreator.Procreate(pooledPopulation.Append().GetChromosome(), selector, random); } pooledPopulation.Freeze(evaluator); Population temp = (Population)CurrentPopulation; CurrentPopulation = pooledPopulation; GenerationCount++; pooledPopulation = temp; }