/// <summary> /// ����Ҫ��Դ���صij�ʼ�� /// </summary> /// <param name="player"></param> /// <param name="vehicleContext"></param> public static void PostCreateNewPlayerEntity( PlayerEntity player, Contexts contexts) { var sessionObjects = contexts.session.commonSession; var sceneObjectFactory = contexts.session.entityFactoryObject.SceneObjectEntityFactory; player.AddModeLogic(); player.modeLogic.ModeLogic = sessionObjects.WeaponModeLogic; var stateManager = new CharacterStateManager(); var playerWeaponStateAdapter = new PlayerWeaponStateAdapter(player, stateManager, stateManager, contexts.ui); if (!player.hasStatisticsData) { player.AddStatisticsData(false, new BattleData(), new StatisticsData()); } player.AddWeaponFactory(new WeaponLogic.WeaponFactory(playerWeaponStateAdapter, stateManager, contexts.session.entityFactoryObject.WeaponLogicFactory, contexts.session.commonSession.FreeArgs)); var speed = new SpeedManager(player, stateManager, stateManager, stateManager.GetIPostureInConfig(), stateManager.GetIMovementInConfig(), playerWeaponStateAdapter); stateManager.SetSpeedInterface(speed); player.AddStateInterface(stateManager); var oxygen = new OxygenEnergy(100, 0); player.AddOxygenEnergyInterface(oxygen); var genericAction = new GenericAction(); player.AddGenericActionInterface(genericAction); var clipManager = new AnimatorClipManager(); player.AddAnimatorClip(clipManager); player.RefreshPlayerWeaponLogic(-1); if (!player.hasPlayerRotateLimit) { player.AddPlayerRotateLimit(false); } if (!player.hasFirePosition) { player.AddFirePosition(); } if (!player.hasState) { player.AddState(); } if (!player.hasStateInterVar) { player.AddStateInterVar(new StateInterCommands(), new StateInterCommands(), new StateInterCommands(), new StateInterCommands()); } if (!player.hasStateBefore) { player.AddStateBefore(); } if (!player.hasStateInterVarBefore) { player.AddStateInterVarBefore(); } ComponentSynchronizer.SyncToStateComponent(player.state, player.stateInterface.State); if (!player.hasVehicleCmdSeq) { player.AddVehicleCmdSeq(0); } if (!player.hasUserCmd) { player.AddUserCmd(); } if (!player.hasControlledVehicle) { player.AddControlledVehicle(); } if (!player.hasPlayerSkyMove) { player.AddPlayerSkyMove(true, -1); } if (!player.hasPlayerSkyMoveInterVar) { player.AddPlayerSkyMoveInterVar(); } if (!player.hasCharacterBone) { player.AddCharacterBone(0); } if (!player.hasNetworkWeaponAnimation) { player.AddNetworkWeaponAnimation(string.Empty, 0, string.Empty, 0); } AddCameraStateNew(player); var bagLogic = new WeaponBagLogic( player, SingletonManager.Get <WeaponConfigManager>()); player.AddBag(bagLogic); var grenadeInventory = new GrenadeBagCacheAgent(player.grenadeInventoryData); player.AddGrenadeInventoryHolder(grenadeInventory); player.AddLocalEvents(new PlayerEvents()); InitFiltedInput(player, sessionObjects.GameStateProcessorFactory); /* * player.AddSoundManager(new PlayerSoundManager(player, * soundContext, * PlayerSoundConfigManager.Instance, * SoundConfigManager.Instance, * sessionObjects.SoundEntityFactory, * SingletonManager.Get<TerrainManager>(), * SingletonManager.Get<MapConfigManager>())); */ player.AddSoundManager(new DummyPlayerSoundManager()); player.AddPlayerAction(new PlayerWeaponActionLogic(player, bagLogic, sceneObjectFactory, player.modeLogic.ModeLogic, grenadeInventory, player.modeLogic.ModeLogic, player.modeLogic.ModeLogic)); if (!player.hasPingStatistics) { player.AddPingStatistics(); } if (!player.hasFreeData) { FreeData fd = new FreeData(player); if (player.hasStatisticsData) { fd.AddFields(new ObjectFields(player.statisticsData.Statistics)); } player.AddFreeData(fd); } player.AddPlayerHitMaskController(new CommonHitMaskController(contexts.player, player)); player.AddTip(); player.AddThrowingUpdate(false); }