public void EnterScene(User newUser) { Msg_LR_RoomUserInfo lobbyUserData = newUser.LobbyUserData; if (null == lobbyUserData) { return; } TableConfig.Actor cfg = TableConfig.ActorProvider.Instance.GetActor(lobbyUserData.Hero); EntityInfo info = m_EntityMgr.AddEntity(0, lobbyUserData.Camp, cfg, string.Empty); info.SetUnitId(EntityInfo.c_StartUserUnitId + info.GetId()); info.GetMovementStateInfo().FormationIndex = 0; if (null != m_SceneConfig) { info.GetMovementStateInfo().SetPosition2D(m_SceneConfig.EnterX + (Helper.Random.NextFloat() - 0.5f) * m_SceneConfig.EnterRadius, m_SceneConfig.EnterY + (Helper.Random.NextFloat() - 0.5f) * m_SceneConfig.EnterRadius); } newUser.Info = info; AttrCalculator.Calc(info); if (newUser.HaveHpArmor) { info.Hp = newUser.Hp; info.Energy = newUser.Energy; } else { info.Hp = newUser.Info.HpMax; info.Energy = newUser.Info.EnergyMax; } info.SceneContext = m_SceneContext; AddCareList(info); if (newUser.IsEntered) { var args = m_StorySystem.NewBoxedValueList(); args.Add(info.GetId()); args.Add(info.GetUnitId()); args.Add(info.GetCampId()); args.Add(info.GetMovementStateInfo().PositionX); args.Add(info.GetMovementStateInfo().PositionZ); m_StorySystem.SendMessage("user_enter_scene", args); } }
internal void EnterScene(User newUser) { Msg_LR_RoomUserInfo lobbyUserData = newUser.LobbyUserData; if (null == lobbyUserData) { return; } TableConfig.Actor cfg = TableConfig.ActorProvider.Instance.GetActor(lobbyUserData.Hero); EntityInfo info = m_EntityMgr.AddEntity(0, lobbyUserData.Camp, cfg, (int)AiStateLogicId.Entity_Leader); info.SetUnitId(EntityInfo.c_StartUserUnitId + info.GetId()); info.GetMovementStateInfo().FormationIndex = 0; if (null != m_SceneConfig) { info.GetMovementStateInfo().SetPosition2D(m_SceneConfig.EnterX + (Helper.Random.NextFloat() - 0.5f) * m_SceneConfig.EnterRadius, m_SceneConfig.EnterY + (Helper.Random.NextFloat() - 0.5f) * m_SceneConfig.EnterRadius); } newUser.Info = info; AttrCalculator.Calc(info); if (newUser.HaveHpArmor) { info.SetHp(Operate_Type.OT_Absolute, newUser.Hp); info.SetEnergy(Operate_Type.OT_Absolute, newUser.Energy); } else { info.SetHp(Operate_Type.OT_Absolute, newUser.Info.GetActualProperty().HpMax); info.SetEnergy(Operate_Type.OT_Absolute, newUser.Info.GetActualProperty().EnergyMax); } info.SceneContext = m_SceneContext; AddCareList(info); if (newUser.IsEntered) { m_StorySystem.SendMessage("user_enter_scene", info.GetId(), info.GetUnitId(), info.GetCampId(), info.GetMovementStateInfo().PositionX, info.GetMovementStateInfo().PositionZ); } }