void InstantiateObstacle(Vector3 position, int type = 1, int collectableType = 0, int directionMultiplier = 1) { float collectableHeight = blockHeight; switch (type) { case 0: //empty space collectableHeight = 2 * blockHeight; break; case 1: //basic floor //Instantiate(staticBlockPrefab, position, Quaternion.identity); pooling.InstantiateStaticBlock(position, Quaternion.identity); collectableHeight = blockHeight; break; case 2: //basic floor with simple obstacle on top of it //Instantiate(staticBlockPrefab, position, Quaternion.identity); //Instantiate(staticBlockPrefab, position + Vector3.up * blockHeight * directionMultiplier, Quaternion.identity); pooling.InstantiateStaticBlock(position, Quaternion.identity); pooling.InstantiateStaticBlock(position + Vector3.up * blockHeight * directionMultiplier, Quaternion.identity); collectableHeight = 2 * blockHeight; break; case 3: //basic floor with flying obstacle above it //Instantiate(staticBlockPrefab, position, Quaternion.identity); //Instantiate(staticBlockPrefab, position + Vector3.up * blockHeight * 2 * directionMultiplier, Quaternion.identity); pooling.InstantiateStaticBlock(position, Quaternion.identity); pooling.InstantiateStaticBlock(position + Vector3.up * blockHeight * 2 * directionMultiplier, Quaternion.identity); collectableHeight = blockHeight; break; case 4: //basic floor with simple obstacle on top of it and with flying obstacle above the obstacle //Instantiate(staticBlockPrefab, position, Quaternion.identity); //Instantiate(staticBlockPrefab, position + Vector3.up * blockHeight * directionMultiplier, Quaternion.identity); //Instantiate(staticBlockPrefab, position + Vector3.up * blockHeight * 3 * directionMultiplier, Quaternion.identity); pooling.InstantiateStaticBlock(position, Quaternion.identity); pooling.InstantiateStaticBlock(position + Vector3.up * blockHeight * directionMultiplier, Quaternion.identity); pooling.InstantiateStaticBlock(position + Vector3.up * blockHeight * 3 * directionMultiplier, Quaternion.identity); collectableHeight = 2 * blockHeight; break; case 5: //basic floor with simple obstacle on top of it and with another simple obstacle on top of the first one //Instantiate(staticBlockPrefab, position, Quaternion.identity); //Instantiate(staticBlockPrefab, position + Vector3.up * blockHeight * directionMultiplier, Quaternion.identity); //Instantiate(staticBlockPrefab, position + Vector3.up * blockHeight * 2 * directionMultiplier, Quaternion.identity); pooling.InstantiateStaticBlock(position, Quaternion.identity); pooling.InstantiateStaticBlock(position + Vector3.up * blockHeight * directionMultiplier, Quaternion.identity); pooling.InstantiateStaticBlock(position + Vector3.up * blockHeight * 2 * directionMultiplier, Quaternion.identity); collectableHeight = 3 * blockHeight; break; case 6: //basic floor with moving obstacle on top of it //Instantiate(staticBlockPrefab, position, Quaternion.identity); //Instantiate(movingBlockPrefab, position + Vector3.up * blockHeight * directionMultiplier, Quaternion.identity); pooling.InstantiateStaticBlock(position, Quaternion.identity); pooling.InstantiateMovingBlock(position + Vector3.up * blockHeight * directionMultiplier, Quaternion.identity, directionMultiplier, 1); collectableHeight = 2 * blockHeight; break; case 7: //basic floor with moving obstacle on top of it //Instantiate(staticBlockPrefab, position, Quaternion.identity); //Instantiate(movingBlockPrefab, position + Vector3.up * blockHeight * directionMultiplier, Quaternion.identity); pooling.InstantiateStaticBlock(position, Quaternion.identity); pooling.InstantiateMovingBlock(position + Vector3.up * blockHeight * directionMultiplier, Quaternion.identity, directionMultiplier, -1); collectableHeight = 2 * blockHeight; break; default: //Instantiate(staticBlockPrefab, position, Quaternion.identity); pooling.InstantiateStaticBlock(position, Quaternion.identity); collectableHeight = blockHeight; break; } InstantiateCollectable(position + Vector3.up * collectableHeight * directionMultiplier, collectableType); }