public void UpdateDetails(Zone zone) { _menuButtonsHandler.OnDisplay(); DragDropReceptor.SetOpenZone(zone); Debug.Log("OPEN COUNT: " + zone.PlacedBoats.Count); _dragDropReceptor.DragDropZone = zone; _name.text = zone.Descriptor.ZoneName; _health.fillAmount = zone.CurrentHealth / zone.Descriptor.MaxHealth; _profit.text = "Profit: " + zone.Descriptor.RentabilityFactor.ToString(); _risk.text = "Danger: " + zone.Descriptor.DangerFactor.ToString(); _preview.sprite = zone.Descriptor.ZoneBackground; foreach (Transform t in _weatherRoot.transform) { Destroy(t.gameObject); } foreach (Weather weather in zone.Descriptor.PossibleWeathers) { Image weatherBackground = GameObject.Instantiate(_weatherPrefab, _weatherRoot); Image weatherSprite = weatherBackground.rectTransform.GetChild(0).GetComponent <Image>(); weatherSprite.sprite = weather.WeatherSprite; weatherBackground.color = (zone.CurrentWeather == weather) ? _enabledColor : _disabledColor; } foreach (Transform t in _boatsRoot.transform) { Destroy(t.gameObject); } foreach (Boat b in zone.PlacedBoats) { BoatListItem db = GameObject.Instantiate(_boatPrefab, _boatsRoot); db.SetBoat(b); } if (_gameInfo.Player.CurrentZone == zone) { //TODO Debug.Log("Bateau du joueur à afficher dans ZoneDetails"); GameObject.Instantiate(_playerBoatPrefab, _boatsRoot); } }
public void OnClose() { DragDropReceptor.SetOpenZone(null); }