void Update() { instance = this; if (stat == null) { stat = GetComponent <Stats>(); } if (!Application.isPlaying) { if (stats == null) { stats = new List <StatsForAndAgainst>(); stats.Add(new StatsForAndAgainst()); } for (int i = 0; i < stats.Count; i++) { if (stats[i].isStatNull == true) { AddNewStats(stats[i].m_attack, TypeOfStat.Attack); AddNewStats(stats[i].m_defense, TypeOfStat.Defense); AddNewStats(stats[i].m_other, TypeOfStat.Other); } } } }
void Update() { if (Application.isPlaying) { _instance = this; if (m_attack == null || m_defense == null || m_other == null) { LoadValues(); } } if (!Application.isPlaying) { _instance = this; //If the stats type against each is null then it will create a new one. //Goes through a loop of all the stats and checks if they exist or not, if they do, then ignore otherwise make new one if (hasSavedValues) { LoadValues(); } else if (m_attack == null || m_defense == null || m_other == null) { showItem = new List <bool>(); isOtherActive = new List <bool>(); m_attack = new List <List <string> >(); m_defense = new List <List <string> >(); m_other = new List <List <string> >(); indexAttack = new List <int>(); indexDefense = new List <int>(); indexOtherFor = new List <int>(); indexOtherAgainst = new List <int>(); m_attack.Add(new List <string>()); m_defense.Add(new List <string>()); m_other.Add(new List <string>()); AddNewStats(m_attack[0], TypeOfStat.Attack); AddNewStats(m_defense[0], TypeOfStat.Defense); AddNewStats(m_other[0], TypeOfStat.Other); indexAttack.Add(0); indexDefense.Add(0); indexOtherFor.Add(0); indexOtherAgainst.Add(0); isOtherActive.Add(false); showItem.Add(false); } } }