public void ReadTo(ref Player player) { //Set health player.healthManager.health = health; //Set arsenal ArsenalSystem gunController = player.myPickup.gunController; for (int i = 0; i < ammo.Length; ++i) { gunController.arsenal[i]._gun.ammo = ammo[i]; gunController.arsenal[i].isInArsenal = inArse[i]; } gunController.EquipGun((ArsenalSystem.GunType)equip); }
/// <summary> /// 初始化 /// </summary> public void Initinal() { //辅助系统 m_TipsSystem = new TipsSystem(this); m_SwitchSystem = new SwitchSystem(this); m_arsenalSystem = new ArsenalSystem(this); //界面 m_tipsPanel = new TipsPanel(); m_TipsSystem.Initialize(); m_arsenalSystem.Initialize(); //第一次打开才进行加载以下界面 if (m_player == null) { m_mainPanel = new MainPanel(this); m_mainMenuPanel = new MainMenuPanel(this); m_mainMenuRightPanel = new MainMenuRightPanel(this); m_readAssetPanel = new ReadAssetPanel(this); m_readAssetRightPanel = new ReadAssetRightPanel(this); m_ChooseRolePanel = new ChooseRolePanel(this); m_gameMenuRightPanel = new GameMenuRightPanel(this); //界面状态系统初始化 m_SwitchSystem.Initialize(); //注册界面状态 AddUIState(); //主界面初始化 m_mainPanel.Begin(); } else { //进入游戏后加载兵营系统 以及 UI m_campSystem = new CampSystem(this); m_statePanel = new GameStatePanel(this); //初始化 m_campSystem.Initialize(); m_statePanel.Begin(); } }
public void WriteFrom(Player player) { //Get health health = player.healthManager.health; //Get arsenal info ArsenalSystem gunController = player.GetComponentInChildren <ArsenalSystem>(); ammo = new int[gunController.arsenal.Length]; inArse = new bool[gunController.arsenal.Length]; equip = gunController.equippedGunIndex; for (int i = 0; i < ammo.Length; ++i) { ammo[i] = gunController.arsenal[i]._gun.ammo; inArse[i] = gunController.arsenal[i].isInArsenal; } ////Get inventory //foreach(Box box in player.myPickup.carriedObjects) //{ // inventory.Push(box.resourcePath); //} }