public bool IsCanPutHero(int hero_index) { if (IsHeroAlreadyPut(hero_index)) { // 已经放置了这个将军 return(false); } BLPlayerHeroData hero_data = GetHeroData(hero_index); int unit_id = BLUnitManager.Instance().GetHeroUnitID(player_id, hero_index); // 检查资源 // 检查复活状态 BLUnitBase unit = BLUnitManager.Instance().GetUnit(hero_data.build_site_id); Debug.Assert(unit.unit_type == UnitType.Building); BLUnitBuilding build_unit = unit as BLUnitBuilding; return(build_unit.IsUnitCanRevive(unit_id)); }
public void UpdateUI() { BL.BLPlayerData player_data = BL.BLPlayerDataManager.Instance().GetPlayerData(BattleField.battle_field.my_player_id); for (int i = 0; i < BattleField.MAX_HERO_COUNT; ++i) { BL.BLPlayerHeroData hero_data = player_data.GetHeroData(i); all_hero_names[i].text = hero_data.hero_gds_name; if (player_data.IsHeroAlreadyPut(i)) { all_hero_states[i].text = "已上场"; } else { int unit_id = BL.BLUnitManager.Instance().GetHeroUnitID(player_data.player_id, i); BL.BLUnitBase unit_base = BL.BLUnitManager.Instance().GetUnit(hero_data.build_site_id); Debug.Assert(unit_base.unit_type == UnitType.Building); BL.BLUnitBuilding unit_building = unit_base as BL.BLUnitBuilding; if (unit_building.IsUnitCanRevive(unit_id)) { all_hero_states[i].text = "就绪"; } else { int time_remain = (int)(unit_building.GetUnitReviveRemainFrames(unit_id) * BL.BLTimelineController.SECOND_PER_FRAME); all_hero_states[i].text = time_remain.ToString() + "秒"; } } } }