void Update()
    {
        if (IsTraining())
        {
            bool finished = currentIteration.Train();
            if (render)
            {
                GetComponent <StructureRenderer>().Render(currentIteration.structure);
            }
            if (finished)
            {
                int nextIteration = currentIteration.iteration + 1;
                if (nextIteration > totalNumberOfIterations)
                {
                    currentIteration = null;
                }
                else
                {
                    currentIteration = new Iteration(this,
                                                     generator.GetShape(nextIteration), nextIteration);
                }
            }
        }

        if (Input.GetKeyDown(KeyCode.G))
        {
            string msg = "Count: " + wasps.Count + '\n';
            foreach (var t in wasps)
            {
                msg += t.ToString() + '\n';
            }
            Debug.Log(msg);
        }
    }
Exemplo n.º 2
0
        public void Restart()
        {
            this.Children.Clear();
            this.Background = _bgPlayingBrush;
            _spiteArray     = new Sprite[Size.X, Size.Y];
            _activeShape    = ShapeGenerator.GetShape();
            ShowActualShape();

            OnNewGameStarted(this);
            Play();
        }
 public void StartTrain(ShapeGenerator generator)
 {
     this.generator   = generator;
     currentIteration = new Iteration(this, generator.GetShape(0), 0);
 }