private void OnEnable() { var useGunId = PlayerDataMgr.singleton.GetUseWeaponID(); var useGunData = TableMgr.singleton.GunCardTable.GetItemByID(useGunId); m_role.ChangeGun(useGunData); m_role.SetFight(); }
private void Refresh() { if (m_state == CampsitePointState.Invalid) { return; } //var pointData = CampsiteMgr.singleton.GetPointByIndex(m_PointDataIndex); //if (pointData == null) // return; //if (!pointData.isUnlock) //{ // m_IconNode.gameObject.SetActive(true); // m_RoleNode.gameObject.SetActive(false); // m_state = CampsitePointState.Valid_Locked; //} //else { m_IconNode.gameObject.SetActive(false); m_RoleNode.gameObject.SetActive(true); if (m_role == null) { var roleObj = Global.gApp.gResMgr.InstantiateObj("Prefabs/Campsite/Role/NpcRole1"); //var roleObj = Global.gApp.gResMgr.InstantiateObj(pointData.buildingRes.prefab); roleObj.transform.SetParent(m_RoleNode, false); m_role = roleObj.GetComponent <CampsitePerformer>(); //m_role = m_RoleNode.Find("MainRole").GetComponent<CampsitePerformer>(); m_role.SetMonsterList(m_Monsters); } var gunData = equipGunId > 0 ? TableMgr.singleton.GunCardTable.GetItemByID(equipGunId) : null; //var gunData = pointData.equipGunId > 0 ? TableMgr.singleton.GunCardTable.GetItemByID(pointData.equipGunId) : null; //if (pointData.isFight) { m_role.ChangeGun(gunData); m_role.SetFight(); } //else //{ // m_role.ChangeGun(gunData); // m_role.SetIdle(); //} m_state = CampsitePointState.Valid_Opened; } }