/// <summary> /// Called after all players are added /// </summary> public void Init(Player pPlayer) { player = pPlayer; //color and name dont change during game background.color = UIColorDB.GetColor(pPlayer.InitInfo.Color); //todo: sortingOrder is not applied -> set it manually background.GetComponent <Canvas>().sortingOrder = -1; playerName.text = pPlayer.InitInfo.Name; if (pPlayer.IsItMe) { //register for stats change pPlayer.Stats.SetOnStatsChange(OnStatsChanged); //invoke first change manually OnStatsChanged(pPlayer.Stats); } pPlayer.Visual.Scoreboard = this; game.Lighting.RegisterForLighting(background); }
/// <summary> /// Called after all players are added /// </summary> public void Init(Player pPlayer) { player = pPlayer; gameObject.SetActive(true); image.color = UIColorDB.GetColor(pPlayer.InitInfo.Color); portrait.sprite = brainiacs.HeroManager.GetHeroConfig(pPlayer.InitInfo.Hero).Portrait; if(pPlayer.IsItMe) { pPlayer.WeaponController.SetOnWeaponInfoChanged(SetWeaponInfo); pPlayer.Stats.SetOnStatsChange(OnPlayerStatsChange); } pPlayer.Visual.PlayerInfo = this; game.Lighting.RegisterForLighting(image); game.Lighting.RegisterForLighting(portrait); game.Lighting.RegisterForLighting(frame); //game.Lighting.RegisterForLighting(weapon); //controlled in Update }
private void AssignColor(EPlayerColor pColor) { Info.Color = pColor; color.color = UIColorDB.GetColor(Info.Color); }