updateMagicBtn()

Found in:

public void updateMagicBtn(Item newItem){
      _live = true;
      gameObject.transform.Find("Text").GetComponent().text = newItem.amount.ToString();
      Sprite showIcon = newItem.GetSprite();
      float canvasSize = newItem.GetCanvasSize() - 0.2f;
      if(showIcon.bounds.extents.y > showIcon.bounds.extents.x){
        ratio = showIcon.bounds.extents.y/showIcon.bounds.extents.x;
        gameObject.transform.Find("Image").GetComponent().transform.localScale = new Vector3(canvasSize / ratio, canvasSize, canvasSize);
      }else{
        ratio = showIcon.bounds.extents.x/showIcon.bounds.extents.y;
        gameObject.transform.Find("Image").GetComponent().transform.localScale = new Vector3(canvasSize, canvasSize / ratio, canvasSize);
      }
      gameObject.transform.Find("Image").GetComponent().sprite = showIcon;
      gameObject.transform.Find("Image").GetComponent().color = new Color32(255,255,255,255);
      gameObject.transform.Find("textbg").GetComponent().color = new Color32(255,255,225,132);
      gameObject.transform.Find("Image").GetComponent().material = newItem.GetMaterial();
      thisItem = newItem;
    }


Comments

Leave a Reply

Your email address will not be published. Required fields are marked *