void Start() { _spawner = this.gameObject; currentObject = Instantiate(m_cards[currentIndex]); currentObject.transform.SetParent(_spawner.transform); _cardProfile = currentObject.GetComponent <scrpt_cardProfile>(); m_nameText.text = _cardProfile.m_name; m_artNameText.text = _cardProfile.m_artistname; Camera.main.backgroundColor = _cardProfile.m_background; }
public void Next() { Destroy(currentObject); currentIndex++; if (currentIndex > (m_cards.Length - 1) || currentIndex < 0) { currentIndex = 0; } currentObject = Instantiate(m_cards[currentIndex]); currentObject.transform.SetParent(_spawner.transform); _cardProfile = currentObject.GetComponent <scrpt_cardProfile>(); m_nameText.text = _cardProfile.m_name; m_artNameText.text = _cardProfile.m_artistname; Camera.main.backgroundColor = _cardProfile.m_background; }