public static GameElementTypesEnum StringToGameElementType(string gameElementTypeString) { GameElementTypesEnum gameElementTypeEnum = GameElementTypesEnum.OrangeBox; switch (gameElementTypeString) { case Strings.TAG_BLUEMULTIANGLE: gameElementTypeEnum = GameElementTypesEnum.BlueMultiAngle; break; case Strings.TAG_GREENDOWNTIRANGLE: gameElementTypeEnum = GameElementTypesEnum.GreenDownTriangle; break; case Strings.TAG_ORANGEBOX: gameElementTypeEnum = GameElementTypesEnum.OrangeBox; break; case Strings.TAG_REDCIRCLE: gameElementTypeEnum = GameElementTypesEnum.RedCircle; break; case Strings.TAG_YELLOWUPTRIANGLE: gameElementTypeEnum = GameElementTypesEnum.YellowUpTriangle; break; default: Debug.LogWarning("Element with this tag no found: " + gameElementTypeString); break; } return(gameElementTypeEnum); }
public GameObject SpawnPrefab(GameElementTypesEnum elementTypeEnum, Vector3 position) { GameObject newGameObject = _objectStorage.GetGameElement(elementTypeEnum); newGameObject.name = newGameObject.tag; newGameObject.transform.position = position; return(newGameObject); }
public ICell SpawnNormalCell(GameElementTypesEnum gameElement, Vector3 position) { GameObject newGameObject = SpawnPrefab(gameElement, position); ICell newNormalCell = new NormalCell((int)position.x, (int)position.y); newNormalCell.CurrentGameObject = newGameObject; return(newNormalCell); }
public IEnumerator Board_CreateWithOnlyOneElementType(GameElementTypesEnum gameElement, int boardWidth, int boardHeight) { #region Create Board IObjectStorage objectStorage = new ObjectStorage(); ISpawnManager spawnManager = new SpawnManager(objectStorage); IBoard board = ObjectsCreator.CreateBoard(boardWidth, boardHeight); #endregion yield return(null); #region Fill Board for (int i = 0; i < board.Width; i++) { for (int j = 0; j < board.Height; j++) { if (board.Cells[i, j] == null) { Vector2 tempPos = new Vector2(i, j); ICell newCell = spawnManager.SpawnNormalCell(gameElement, tempPos); board.Cells[i, j] = newCell; yield return(new WaitForSeconds(.1f)); } } } #endregion #region Remove From Scene yield return(new WaitForSeconds(.5f)); foreach (var cell in board.Cells) { GameObject.Destroy(cell.CurrentGameObject); } #endregion }
public GameObject GetGameElement(GameElementTypesEnum gameElementTypeEnum) { GameObject gameElement = Object.Instantiate(_normalCellsPrefabs[gameElementTypeEnum]); return(gameElement); }