public static void SyncSingleUnit(UnitRuntimeInfo unitInfo) { byte lifeState = unitInfo.baseUnitInfo.lifeState; if (lifeState == 2 || lifeState == 3) { int unitId = unitInfo.baseUnitInfo.unitId; PvpManager.On_KillHero(unitId, 0f, (float)TimeSpan.FromTicks(unitInfo.reliveLeftTime).TotalSeconds); } PvpProtocolTools.TryRecoverUnit(unitInfo); }
public static void ToDie(Units deadUnit, Units attacker, long spawnInterval) { if (deadUnit == null) { return; } float num = (float)TimeSpan.FromTicks(spawnInterval).TotalSeconds; PvpManager.On_KillHero(deadUnit.unique_id, 0f, num); if (deadUnit.IsMaster && deadUnit.isPlayer) { BattleAttrManager.Instance.SetPlayerDeathTimer(deadUnit.unique_id, num); Singleton <TriggerManager> .Instance.SendUnitStateEvent(UnitEvent.HeroDeathTimer, deadUnit, null, null); MobaMessageManager.ExecuteMsg(ClientC2C.UnitDeathTime, new ParamUnitDeathTime { reliveTime = num, uniqueId = deadUnit.unique_id }, 0f); } else if (deadUnit.isHero) { BattleAttrManager.Instance.SetPlayerDeathTimer(deadUnit.unique_id, num); MobaMessageManager.ExecuteMsg(ClientC2C.UnitDeathTime, new ParamUnitDeathTime { reliveTime = num, uniqueId = deadUnit.unique_id }, 0f); } if (deadUnit.isLive) { deadUnit.isLive = false; deadUnit.PreDeath(attacker); deadUnit.RealDeath(attacker); } }