public override void HandleDescriptionUI(ItemDescriptionUI UI) { if (UI) { if (UI.TitleText) { Instantiate(UI.TitleText, UI.TitleText.transform.parent).text = name; } if (UI.Image) { Instantiate(UI.Image, UI.Image.transform.parent).sprite = Sprite.Create(RuntimePreviewGenerator.GenerateModelPreview(WorldModel.transform, _TextureSize, _TextureSize), new Rect(0, 0, _TextureSize, _TextureSize), 0.5f * Vector2.one); } if (UI.GenericText) { for (int i = 0; i < Effects.Length; i++) { var D = Effects[i].GetEffectDescription(); if (!string.IsNullOrWhiteSpace(D)) { Instantiate(UI.GenericText, UI.GenericText.transform.parent).text = D; } } } if (UI.GenericText && !string.IsNullOrWhiteSpace(Description)) { Instantiate(UI.GenericText, UI.GenericText.transform.parent).text = Description; } } }
// Start is called before the first frame update void Start() { helper = new Helper(); player = GameObject.FindGameObjectWithTag(Constants.TAG_PLAYER); playerScript = player.GetComponent <PlayerScript>(); minimapController = GameObject.Find(Constants.GAMEOBJECT_NAME_MINIMAPCAMERA).GetComponent <MinimapController>(); levelManagerTransform = GameObject.Find(Constants.GAMEOBJECT_NAME_LEVELMANAGER).transform; itemUI = GameObject.Find(Constants.GAMEOBJECT_NAME_CANVAS).GetComponent <ItemDescriptionUI>(); items = new List <Item>(); }
public virtual void HandleDescriptionUI(ItemDescriptionUI UI) { if (UI) { if (UI.TitleText) { Instantiate(UI.TitleText, UI.TitleText.transform.parent).text = name; } if (UI.Image) { Instantiate(UI.Image, UI.Image.transform.parent).sprite = Sprite.Create(RuntimePreviewGenerator.GenerateModelPreview(WorldModel.transform, _TextureSize, _TextureSize), new Rect(0, 0, _TextureSize, _TextureSize), 0.5f * Vector2.one); } if (UI.GenericText && !string.IsNullOrWhiteSpace(Description)) { Instantiate(UI.GenericText, UI.GenericText.transform.parent).text = Description; } } }