Пример #1
0
    void onStart(SocketIOEvent e)
    {
        statusGame = STARTING;
        Debug.Log("Starting Game");
        Debug.Log(e.data.ToString());
        JSONObject[] itemList = e.data.GetField("data").GetField("items").list.ToArray();
        Debug.Log(itemList);

        MapGenerator mapGen = map.GetComponent <MapGenerator> ();

        mapGen.GenerateMap();

        Debug.Log("Generate Randomizer");
        PositionRandomizer randomizer = map.GetComponent <PositionRandomizer> ();

        ItemsGenerator itemsGen = items.GetComponent <ItemsGenerator> ();

        itemsGen.GenerateItems(randomizer, itemList);

        EnvironmentGenerator enviGen = environment.GetComponent <EnvironmentGenerator> ();

        enviGen.GenerateEnvironment(randomizer);

        player.transform.position = randomizer.RandomPosition(PositionRandomizer.PLAYER);

        EnemyManager enemyManager = enemies.GetComponent <EnemyManager> ();

        enemyManager.CreateEnemyManager(randomizer);

        socket.Emit("GAME_STATUS_READY");
    }
Пример #2
0
        public async Task TestItemListResult()
        {
            var result = await _controller.ItemListResult();

            var expectedItems = await ItemsGenerator.GenerateItems();

            Assert.Equal(expectedItems, result);
        }
    void GenerateAll()
    {
        map_gen.GenerateMap();

        // Euristic:)
        int tileAmountForeground = map_gen.width / 16;

        int tileAmountBackgroundX = map_gen.width / 64;
        int tileAmountBackgroundY = map_gen.height / 64;

        mesh_gen.GenerateMesh(map_gen.borderedMap, squareSize, tileAmountBackgroundX, tileAmountBackgroundY, tileAmountForeground);
        items_gen.GenerateItems(mesh_gen.vertices, mesh_gen.outlines, map_gen.borderedMap, squareSize);
    }
Пример #4
0
        public async Task <List <Item> > ItemListResult()
        {
            var items = await ItemsGenerator.GenerateItems();

            return(await Task.FromResult(items));
        }