public void OnItemSelected(ITileView tile, GameObject tileGameObject) { _currentTile = tile; BuildingModel data = tile.ContentModel as BuildingModel; _toggleMenu.ToggleMenu(); SharedModels.GetWriteableModel <SharedDataModel>().SelectedBuilding.Value = data; }
private void Awake() { Assert.IsNotNull(_raycaster, "You must specify a raycaster"); Assert.IsNotNull(_selectedCellObject, "You must provide an object to highlight the landing place of the building"); _selectedCell = _selectedCellObject.GetComponent <SelectedCellView>(); _sharedData = SharedModels.GetWriteableModel <SharedDataModel>(); _sharedData.SelectedBuilding.OnChange += OnSelectedBuildingChange; _gridModel = SharedModels.Get <IGridModel <BuildingModel> >(); _scaledCell = new Vector3( (_cellSize.x * transform.localScale.x) / _gridModel.Rows, 0f, (_cellSize.y * transform.localScale.z) / _gridModel.Columns); _scaledOffset = new Vector3( (_cellSize.x / 2f) * transform.localScale.x, 0f, (_cellSize.y / 2f) * transform.localScale.z); }