// Set as a border cube public void SetAsBorderCube() { cubeDestructible = false; cubeType = CUBETYPE.BORDER; GetComponent <MeshRenderer>().material = GameObject.FindGameObjectWithTag(Tags.gameControllerTag).GetComponent <Map>().borderMaterial; transform.rotation = Random.rotation; }
// Set as a rock cube public void SetAsRockCube() { cubeDestructible = true; cubeType = CUBETYPE.ROCK; GetComponent <MeshRenderer>().material = GameObject.FindGameObjectWithTag(Tags.gameControllerTag).GetComponent <Map>().rockMaterial; currentHealth = maxHealth = rockHealth; transform.rotation = Random.rotation; }
// Set as an empty cube public void SetAsEmptyCube() { cubeDestructible = false; cubeType = CUBETYPE.EMPTY; Destroy(GetComponent <MeshFilter>()); Destroy(GetComponent <BoxCollider>()); Destroy(GetComponent <MeshRenderer>()); cubeDestroyed = true; cubeOpen = true; currentHealth = maxHealth = 0; }
// Remove the opened grid cube from the cube counts public void RemoveOpenedCubeFromCounts(CUBETYPE cubeType) { // If removing a rock cube if (cubeType == CUBETYPE.ROCK) { numberOfRockCubes--; numberOfTotalCubes--; } // If removing a rock cube if (cubeType == CUBETYPE.CRYSTAL) { numberOfCrystalCubes--; numberOfTotalCubes--; } }
// Count the destroyed grid cube and send count to game data manager public void CountDestroyedGridCubeType(CUBETYPE cubeType, Vector3 cubePos) { // If the cube destroyed is a rock add to the rock cubes destroyed count if (cubeType == CUBETYPE.ROCK) { numberOfCubesDestroyedRock++; } // If the cube destroyed is a crystal add to the crystal cubes destroyed count if (cubeType == CUBETYPE.CRYSTAL) { numberOfCubesDestroyedCrystal++; } // Count the destroyed grid cube and record the position numberOfCubesDestroyed++; cubePositionsDestroyed.Add(new CubeDestroyedStat { position = cubePos, type = cubeType, destroyed = true }); }
public void SetCubeType(CUBETYPE type) { cubeType = type; }