Removed TOTU 103
This commit is contained in:
		
							
								
								
									
										55
									
								
								Assets/Scripts/ButtonManager.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										55
									
								
								Assets/Scripts/ButtonManager.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,55 @@ | ||||
| using System.Collections; | ||||
| using System.Collections.Generic; | ||||
| using UnityEngine; | ||||
| using UnityEngine.UI; | ||||
| using DG.Tweening; | ||||
|  | ||||
| public class ButtonManager : MonoBehaviour | ||||
| { | ||||
|     private Button btn; | ||||
|     [SerializeField] private RawImage buttonImage; | ||||
|  | ||||
|     public GameObject furniture; | ||||
|  | ||||
|     private int _itemId; | ||||
|     private Sprite _buttonTexture; | ||||
|  | ||||
|     public int ItemId  | ||||
|     { | ||||
|         set => _itemId = value; | ||||
|     } | ||||
|  | ||||
|     public Sprite ButtonTexture | ||||
|     { | ||||
|         set | ||||
|         { | ||||
|             _buttonTexture = value; | ||||
|             buttonImage.texture = _buttonTexture.texture; | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     // Start is called before the first frame update | ||||
|     void Start() | ||||
|     { | ||||
|         btn = GetComponent<Button>(); | ||||
|         btn.onClick.AddListener(SelectObject); | ||||
|     } | ||||
|  | ||||
|     // Update is called once per frame | ||||
|     void Update() | ||||
|     { | ||||
|         if (UIManager.Instance.OnEntered(gameObject)) | ||||
|         { | ||||
|             transform.DOScale(Vector3.one * 2, 0.3f); | ||||
|         } | ||||
|         else | ||||
|         { | ||||
|             transform.DOScale(Vector3.one, 0.3f); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     void SelectObject() | ||||
|     { | ||||
|         DataHandler.Instance.SetFurniture(_itemId); | ||||
|     } | ||||
| } | ||||
		Reference in New Issue
	
	Block a user
	 Ignacio Gómez Puga
					Ignacio Gómez Puga