public void Init(int player_id_, int team_id_) { team_id = team_id_; player_id = player_id_; for (int i = 0; i < hero_config.Length; ++i) { int hero_index = i; BLPlayerHeroData hero_data = new BLPlayerHeroData(); hero_data.hero_gds_name = hero_config[hero_index]; hero_data.build_site_id = BLUnitManager.Instance().GetBaseID(player_id); BLUnitBase unit = BLUnitManager.Instance().GetUnit(hero_data.build_site_id); if (unit != null) { Debug.Assert(unit.unit_type == UnitType.Building); BLUnitBuilding build_unit = unit as BLUnitBuilding; int unit_id = BLUnitManager.Instance().GetHeroUnitID(player_id, hero_index); build_unit.AddReviveUnit(hero_data.hero_gds_name, unit_id, 0); } all_hero_data.Add(hero_data); } }
public override void OnDead() { base.OnDead(); // 处理复活的逻辑 BLUnitBuilding revive_building = FindNeareatReviveBuilding(); if (revive_building != null) { int revive_need_frames = (int)(revive_cool_down / BLTimelineController.MS_PER_FRAME); revive_building.AddReviveUnit(gds_name, unit_id, revive_need_frames); } }