コード例 #1
0
    void Start()
    {
        world = new World(worldWidth, worldHeight);
        world.CreateWorld();

        poblation = new Poblation(individualGO);
        for (int i = 0; i < 1; i++)
        {
            poblation.CreateIndividual(world.GetRandomWalkableTile(), worldWidth, worldHeight);
        }

        food = new FoodManager(foodGO);

        ConfigCamera();

        InvokeRepeating("IncreaseHunger", 0.5f, 1.0f);
    }
コード例 #2
0
    private void ResetWorld()
    {
        //We erase the world
        world.EraseWorld();
        poblation.ErasePoblation();

        //We re-create the world
        world.SetWorldSize(Random.Range(3, 18), Random.Range(3, 18));
        world.CreateWorld();

        for (int i = 0; i < Random.Range(1, 10); i++)
        {
            poblation.CreateIndividual(world.GetRandomWalkableTile(), world.Width, world.Height);
        }

        food.EraseFood();

        ConfigCamera();

        CancelInvoke();
        InvokeRepeating("IncreaseHunger", 0.5f, 1.0f);
    }