コード例 #1
0
    //Simulates numCells many cells with iterations many steps each
    public void CreateCells(int numCells)
    {
        cells[0] = new List <Cell>();
        for (int i = 0; i < numCells; i++)
        {
            float x = RandomFloat.Range(-12f, 12f);
            float z = RandomFloat.Range(-12f, 12f);

            Cell cell = BacteriaFactory.CreateNewCell(x, z, RandomFloat.Range(0, 2 * MathFloat.PI), false);
            cells[0].Add(cell);
            allCells.Add(cell);
        }
    }
コード例 #2
0
    // Start is called before the first frame update
    void Start()
    {
        model = Model.GetInstance();

        if (!BacteriaFactory.IsForwardSimulation() || smart)
        {
            cell         = BacteriaFactory.CreateNewCell(transform.position.x, transform.position.z, transform.rotation.y, smart);
            nextLocation = TranslateToVector3(cell.GetNextLocation()); //calculate the first location
        }

        myAnimator    = GetComponent <Animator>();
        cellRigidBody = GetComponent <Rigidbody>();

        originalScale = transform.localScale;
        run           = false; // set run to false so that it begins by rotating towards the first location
    }