using System.Collections; using System.Collections.Generic; using UnityEngine; public class TaskBox : MonoBehaviour { [Header("Task Box Template")] [SerializeField] private GameObject taskBox_header; [SerializeField] private GameObject taskBox_body; [Header("Task Box Content")] [SerializeField] private GameObject title; [SerializeField] private GameObject content; [SerializeField] public Task task; public void Update() { RectTransform rt = gameObject.GetComponent(); //rt.sizeDelta = new Vector2(100, 100); if(taskBox_body.active) { rt.sizeDelta = new Vector2(rt.sizeDelta.x, taskBox_header.GetComponent().sizeDelta.y + taskBox_body.GetComponent().sizeDelta.y); } if(!taskBox_body.active) { rt.sizeDelta = new Vector2(rt.sizeDelta.x, taskBox_header.GetComponent().sizeDelta.y); } } public void SetTask(Task _task) { this.task = _task; this.SetTitle(_task.Title); this.SetContent(_task.Description); } private void SetTitle(string _title) { this.title.GetComponent().text = _title; } private void SetContent(string _content) { this.content.GetComponent().text = _content; } }