public void setPlayerData(int _Level, int _maxHP, int _currentHP, hpController _hpCntler, Slider _hpSlider) { Level = _Level; maxHP = _maxHP; currentHP = _currentHP; hpBar = _hpCntler; hpBar.setController(gameObject, maxHP, currentHP, _hpSlider); hpBar.setHP(currentHP); }
void proc_createChar(System.UInt64 _Index, byte _charType, string _nickName, Vector3 _Position, Quaternion _transformForward, bool _controlType, int _Level, int _maxHP, int _currentHP) { GameObject newPlayer = Instantiate(Instance.prefabsArry[_charType], _Position, _transformForward); playerObject player = new playerObject(); GameObject nameObj = Instantiate(Resources.Load("NameObject")) as GameObject; nameObj.transform.parent = newPlayer.transform; playerName name = nameObj.AddComponent <playerName>(); name.setPlayer(newPlayer, _nickName); GameObject hpBar = Instantiate(Resources.Load("HPBar")) as GameObject; hpBar.transform.parent = Instance.HPCanvas.transform; hpController hpCntler = newPlayer.AddComponent <hpController>(); if (!_controlType) { Destroy(newPlayer.GetComponent <Gamekit3D.PlayerController>()); Destroy(newPlayer.GetComponent <PlayerInput>()); player.Controller = newPlayer.AddComponent <otherEllenController>(); player.Controller.setIndex(_Index); player.Player = newPlayer; player.Controller.setPlayerData(_Level, _maxHP, _currentHP, hpCntler, hpBar.GetComponent <Slider>()); Instance.playerDic.Add(_Index, player); Instance.hpDic.Add(_Index, hpBar); } else { newPlayer.GetComponent <PlayerInput>().enabled = true; Instance.Controller = newPlayer.GetComponent <Gamekit3D.PlayerController>(); Player = newPlayer; Instance.Index = _Index; Instance.Controller.setPlayerData(_Level, _maxHP, _currentHP, hpCntler, hpBar.GetComponent <Slider>()); Instance.StartCoroutine(Gamekit3D.ScreenFader.FadeSceneIn()); } }