private void DeactivateView(TileState.TileStateType stateType) { if (_spawnedTileViews.TryGetValue(stateType, out var spawnedTileView)) { spawnedTileView.SetActive(false); } }
private void ActivateView(TileState.TileStateType stateType) { if (_spawnedTileViews.TryGetValue(stateType, out var spawnedTileView)) { spawnedTileView.SetActive(true); } else { InstantiateNewView(stateType); } }
private void InstantiateNewView(TileState.TileStateType stateType) { if (_spawnedTileViews.ContainsKey(stateType) && _spawnedTileViews[stateType] != null) { throw new Exception(String.Format("TileView of state {0} already instantiated", stateType)); } var newTileView = Instantiate(tileViewInfosContainer.GetTileView(stateType).tileViewPrefab, transform, false); _spawnedTileViews[stateType] = newTileView; }