public override IPointAdapter GetNextLocation()
    {
        IPointAdapter point = positions[currentIteration];

        IterationHandler.GetInstance().UpdateIteration(currentIteration);
        if (currentIteration == deathDate) //notify the movement script that the cell should die
        {
            isDone = true;
            CellDoneHandler.CellDone();
            foreach (ICellDeathListener listener in cellDeathListeners)
            {
                listener.Notify();
            }
        }
        else if (children.ContainsKey(currentIteration)) //send the command to create the new e-coli object
        {
            model.GiveBirthToCell(children[currentIteration]);
        }

        if (currentIteration == iterations && !isDone)
        {
            CellDoneHandler.CellDone();
            isDone = true;
        }
        currentIteration = currentIteration + 1 > iterations ? iterations : currentIteration + 1;

        return(point);
    }
Exemplo n.º 2
0
    // Update is called once per frame
    void Update()
    {
        elpasedTime = elpasedTime + Time.deltaTime * model.GetTimeScaleFactor();


        timeTMP.text        = FormatTimeString();
        countTMP.text       = model.GetNumCells(IterationHandler.GetInstance().GetCurrentInteration()).ToString();
        environmentTMP.text = "Basic";


        if (Input.GetKeyDown(KeyCode.Escape) && !pauseScreen.gameObject.activeSelf)
        {
            pauseScreen.gameObject.SetActive(true);
            prevTimeScaleFactor = model.GetTimeScaleFactor();
            model.SetTimeScaleFactor(0);
        }
        else if (Input.GetKeyDown(KeyCode.Escape) && pauseScreen.gameObject.activeSelf)
        {
            OnResumeClick();
        }

        if (CellInfo.focusedCell != null)
        {
            largeCellInfoCanvas.gameObject.SetActive(true);
        }
        else
        {
            largeCellInfoCanvas.gameObject.SetActive(false);
        }
    }
Exemplo n.º 3
0
 public static IterationHandler GetInstance()
 {
     if (instance == null)
     {
         instance = new IterationHandler();
     }
     return(instance);
 }
Exemplo n.º 4
0
        public ProcessingThread(string name, IterationHandler iterationFunction)
        {
            _iterationFunction = iterationFunction;

            _thread = new Thread(ThreadStart)
            {
                IsBackground = true,
                Name         = name
            };
            _thread.Start();
        }
Exemplo n.º 5
0
 //Sets up the model and factory to simulate numCells many cells with iterations many steps
 public void SetupCells(int numCells, int iterations)
 {
     cells = new List <Cell> [iterations + 1];
     for (int i = 0; i < cells.Length; i++)
     {
         cells[i] = new List <Cell>();
     }
     initalNumOfCells = numCells;
     BacteriaFactory.SetCellIterations(iterations);
     timeScaleFactor    = 1;
     cellBirthListeners = new List <ICellBirthListener>();
     allCells           = new List <Cell>();
     IterationHandler.GetInstance().Reset();
     averageLigandC = null;
 }
Exemplo n.º 6
0
 public void Reset()
 {
     instance = new IterationHandler();
 }