private void Awake() { CursorSlotImage = CursorSlot.GetComponentInChildren <RawImage>(); CursorSlotCount = CursorSlot.GetComponentInChildren <Text>(); MaterialsSides = new Vector2[Enum.GetNames(typeof(BlockType)).Length, 6]; playerService = new PlayerService(); buildingService = new BuildingService(); invenvtoryImagesGameObjects = GameObject.FindGameObjectsWithTag("MainInventorySlots"); inventoryImages = new RawImage[invenvtoryImagesGameObjects.Length]; for (int i = 0; i < invenvtoryImagesGameObjects.Length; i++) { inventoryImages[i] = invenvtoryImagesGameObjects[i].GetComponent <RawImage>(); } inventoryItemCountsGameObjects = GameObject.FindGameObjectsWithTag("MainInventoryCount"); inventoryItemCounts = new Text[inventoryItemCountsGameObjects.Length]; for (int i = 0; i < inventoryItemCountsGameObjects.Length; i++) { inventoryItemCounts[i] = inventoryItemCountsGameObjects[i].GetComponent <Text>(); } inventory = GameObject.FindGameObjectWithTag("Inventory"); inventory.SetActive(false); hotbarSlotSelected = GameObject.FindGameObjectsWithTag("ItemSelected"); hotbarSlotsGameObjects = GameObject.FindGameObjectsWithTag("InventorySlots"); hotbarSlotsImages = new RawImage[hotbarSlotsGameObjects.Length]; hotbarCountGameObjects = GameObject.FindGameObjectsWithTag("ItemCount"); hotbarItemCounts = new Text[hotbarCountGameObjects.Length]; for (int i = 0; i < hotbarSlotsGameObjects.Length; i++) { hotbarSlotsImages[i] = hotbarSlotsGameObjects[i].GetComponent <RawImage>(); } for (int i = 0; i < hotbarCountGameObjects.Length; i++) { hotbarItemCounts[i] = hotbarCountGameObjects[i].GetComponent <Text>(); } perlinNoiseService = new PerlinNoiseService(); inventoryService = new InventoryService(); BlockService = new BlockService(); for (int i = 0; i < MaterialsSides.GetLength(0); i++) { MaterialsSides[i, 0] = MaterialsSideTop[i]; if (MaterialsSideBottom[i].x != -1) { MaterialsSides[i, 1] = MaterialsSideBottom[i]; MaterialsSides[i, 2] = MaterialsSideRight[i]; MaterialsSides[i, 3] = MaterialsSideLeft[i]; MaterialsSides[i, 4] = MaterialsSideFront[i]; MaterialsSides[i, 5] = MaterialsSideBack[i]; } else { MaterialsSides[i, 1] = MaterialsSideTop[i]; MaterialsSides[i, 2] = MaterialsSideTop[i]; MaterialsSides[i, 3] = MaterialsSideTop[i]; MaterialsSides[i, 4] = MaterialsSideTop[i]; MaterialsSides[i, 5] = MaterialsSideTop[i]; } } gameController = new GameController(100, 100, 100); gameChunks = new GameObject[gameController.GetGameModel().Blocks.GetLength(0) / chunkSize, gameController.GetGameModel().Blocks.GetLength(2) / chunkSize]; playerCamera = GameObject.FindGameObjectWithTag("MainCamera").GetComponent <Camera>(); Cursor.lockState = CursorLockMode.Locked; //Materials = new Material[Enum.GetNames(typeof(BlockType)).Length]; }
public new void Setup() { base.Setup(); perlinNoiseService = new PerlinNoiseService(); }