public bool CreateAlert(AlertData alertData, AlertColorArray colorArray = null) { if (m_ActiveAlerts >= m_MaxAlerts) { return(false); } // TODO: Implement method for populating an alert panel grid with self-destructing alerts // TODO: Create alert specific class that controls the alert text + icon var alert = Instantiate(m_AlertPrefab, m_AlertPanel); m_ActiveAlerts++; // Set the appropriate fields/values if (colorArray != null) { alert.SetColorArray(colorArray); } alert.Text.text = alertData.message; alert.Icon.sprite = alertData.icon; // Destroy the alert after a predefined length of time StartCoroutine(FadeAlert(alert)); return(true); }
public void SetColorArray(AlertColorArray colorArray) { this.Panel.color = colorArray.panelColor; this.Text.color = colorArray.textColor; }