public void UpdateValues(AbstractWinCondition condition) { if (label == null) { label = GetComponent <UILabel>(); if (brothers != null && brothers.Length > 1) { deactivateOffset = (brothers[0].parent.localPosition.x - brothers[1].parent.localPosition.x) * 0.5f; } } WinDestroyTiles winCondition = (condition as WinDestroyTiles); if (!label.enabled) { UpdateBrothers(deactivateOffset); } if (winCondition == null || (winCondition as WinDestroyTilesSnow) != null || winCondition.destroyTiles.Length <= destroyTilesIndex) { myTexture.gameObject.SetActive(false); label.enabled = false; UpdateBrothers(-deactivateOffset); return; } myTexture.gameObject.SetActive(true); label.enabled = true; DestroyTilesPair destroyTiles = winCondition.destroyTiles[destroyTilesIndex]; myTexture.mainTexture = destroyTiles.type.transform.Find("Model").renderer.sharedMaterial.mainTexture; string key = "Level" + Match3BoardRenderer.levelIdx + "Destroy" + destroyTilesIndex; if (TweaksSystem.Instance.intValues.ContainsKey(key)) { label.text = TweaksSystem.Instance.intValues[key].ToString(); } else { label.text = destroyTiles.number.ToString(); } }
public void UpdateValues(AbstractWinCondition condition) { if (label == null) { label = GetComponent<UILabel>(); if (brothers != null && brothers.Length > 1) { deactivateOffset = (brothers[0].parent.localPosition.x - brothers[1].parent.localPosition.x) * 0.5f; } } WinDestroyTiles winCondition = (condition as WinDestroyTiles); if (!label.enabled) { UpdateBrothers(deactivateOffset); } if (winCondition == null || (winCondition as WinDestroyTilesSnow) != null || winCondition.destroyTiles.Length <= destroyTilesIndex) { myTexture.gameObject.SetActive(false); label.enabled = false; UpdateBrothers(-deactivateOffset); return; } myTexture.gameObject.SetActive(true); label.enabled = true; DestroyTilesPair destroyTiles = winCondition.destroyTiles[destroyTilesIndex]; myTexture.mainTexture = destroyTiles.type.transform.Find("Model").renderer.sharedMaterial.mainTexture; string key = "Level" + Match3BoardRenderer.levelIdx + "Destroy" + destroyTilesIndex; if (TweaksSystem.Instance.intValues.ContainsKey(key)) { label.text = TweaksSystem.Instance.intValues[key].ToString(); } else { label.text = destroyTiles.number.ToString(); } }