Example #1
0
    void LayoutEntityAtRandom(GameObject entity, int minimum, int maximum, int maxSize, int cyclesMin, int cyclesMax)
    {
        int objectCount = Random.Range(minimum, maximum + 1);

        for (int i = 0; i < objectCount; i++)
        {
            Vector2 randomPosition = RandomPosition();
            Brain   brain          = new Brain();

            // brain.cyclesPerUpdateMax = 1;
            // brain.cyclesPerUpdateMin = 1;

            brain.cyclesPerUpdateMax = cyclesMin;
            brain.cyclesPerUpdateMin = cyclesMax;
            brain.setMaxSize(maxSize);

            GameObject newEntity = Instantiate(entity, randomPosition, Quaternion.identity);
            newEntity.name = entity.name;

            brain.AddEntity(newEntity);

            brains.Add(brain);
        }
    }