void Update() { if (XPMaster.s != null) { if (XPMaster.s.level.Count > XPMaster.SideToInt(mySide)) { level = XPMaster.s.level [XPMaster.SideToInt(mySide)]; txtLvl.text = (level + 1).ToString(); xp_percent = XPMaster.s.xp_percent [XPMaster.SideToInt(mySide)]; sldXp.value = xp_percent; } } }
void Start() { s = this; print("Setting up XPMaster values"); if (level.Count == 0) { SetUp(); } for (int i = 0; i < 3; i++) { reqXp [i] = ReqLevelCalculator(level[i]); } }
IEnumerator SetUpSide() { yield return(null); while (PlayerSpawner.LocalPlayerSpawner == null) { yield return(null); } while (PlayerSpawner.LocalPlayerSpawner.myHealth == null) { yield return(null); } switch (visualId) { case 0: mySide = PlayerSpawner.LocalPlayerSpawner.mySide; break; case 1: if (PlayerSpawner.LocalPlayerSpawner.mySide == Health.Side.blue) { mySide = Health.Side.red; } else { mySide = Health.Side.blue; } break; case 2: if (PlayerSpawner.LocalPlayerSpawner.mySide == Health.Side.blue) { mySide = Health.Side.green; } else if (PlayerSpawner.LocalPlayerSpawner.mySide == Health.Side.red) { mySide = Health.Side.green; } else { mySide = Health.Side.red; } break; default: Debug.LogError("XPandHeroVisualsDisplay VisualId not set"); break; } SetColor(); HeroTopBarDisplay[] myDisps = GetComponentsInChildren <HeroTopBarDisplay> (); for (int i = 0; i < 3; i++) { myDisps [i].myPlayerId = (XPMaster.SideToInt(mySide) * 3) + (2 - i); myDisps [i].SetUp(); //print (myDisps [i].gameObject.name); } }