Esempio n. 1
0
    public void StartUp(VoxelMap map)
    {
        voxelMap   = map;
        mainCamera = Camera.main;

        terrainMap    = FindObjectOfType <TerrainMap>();
        voxelMesh     = FindObjectOfType <VoxelMesh>();
        chunkCollider = FindObjectOfType <ChunkCollider>();
        worldManager  = FindObjectOfType <WorldManager>();
        uiHotBar      = FindObjectOfType <UI_HotBar>();

        var blockCollection = BlockManager.Read();

        if (worldManager.creativeMode)
        {
            foreach (var block in blockCollection.blocks)
            {
                fillTypeNames.Add(block.blockType.ToString());
            }
        }

        boxCollider = gameObject.GetComponent <BoxCollider>();
        if (boxCollider != null)
        {
            DestroyImmediate(boxCollider);
        }

        boxCollider      = gameObject.AddComponent <BoxCollider>();
        boxCollider.size = new Vector3((voxelMap.chunkResolution - voxelMap.viewDistance) * voxelMap.voxelResolution,
                                       (voxelMap.chunkResolution - voxelMap.viewDistance) * voxelMap.voxelResolution);
    }
Esempio n. 2
0
    private void Start()
    {
        uiHotBar        = FindObjectOfType <UI_HotBar>();
        uiMainInventory = FindObjectOfType <UI_PlayerInventory>();

        uiHotBar.SetupInventory(hotBarInventory);
        uiMainInventory.SetupInventory(mainInventory);

        inventoriesController.activeInventories.Add(hotBarInventory);

        uIController.AddUI(uiHotBar);
    }
Esempio n. 3
0
    private void Start()
    {
        uIController    = FindObjectOfType <UIController>();
        pauseMenu       = FindObjectOfType <PauseMenu>();
        currentCategory = CategoryType.Test1;
        playerInventory = FindObjectOfType <UI_PlayerInventory>();
        hotbarInventory = FindObjectOfType <UI_HotBar>();

        recipeCollection = RecipeManager.Read();
        itemCollection   = ItemManager.Read();

        isActive = false;

        uIController.togglableUIs.Add(gameObject);

        UpdateUI();
    }
Esempio n. 4
0
    public void Initialize(bool useVoxelPoints, int resolution)
    {
        this.useVoxelPoints = useVoxelPoints;
        this.resolution     = resolution;

        uiHotBar = FindObjectOfType <UI_HotBar>();

        StartUp();

        GetComponent <MeshFilter>().mesh = mesh = new Mesh();
        material.SetVector(Resolution, Vector2.one * resolution);
        GetComponent <MeshRenderer>().material = material;
        mesh.name = "VoxelChunk Mesh";

        blockCollection = BlockManager.Read();

        ResetValues();

        Refresh();
    }