protected void HandleLoadedModel(PlayerEntity player, GameObject obj) { obj.layer = UnityLayerManager.GetLayerIndex(EUnityLayerName.Player); PlayerEntityUtility.DisableCollider(obj.transform); if (!player.hasCharacterContoller) { var character = DefaultGo.CreateGameObject(player.entityKey.ToString()); character.layer = UnityLayerManager.GetLayerIndex(EUnityLayerName.Player); CharacterController cc = PlayerEntityUtility.InitCharacterController(character); KinematicCharacterMotor kcc = PlayerEntityUtility.InitKinematicCharacterMotor(character); CharacterControllerContext characterControllerContext = new CharacterControllerContext( new UnityCharacterController(cc, !player.isFlagSelf), new Core.CharacterController.ConcreteController.ProneCharacterController(kcc, new ProneController()), new Core.CharacterController.ConcreteController.DiveCharacterController(kcc, new DiveController()), new Core.CharacterController.ConcreteController.SwimCharacterController(kcc, new SwimController()) ); var curver = character.AddComponent <AirMoveCurve>(); curver.AireMoveCurve = SingletonManager.Get <CharacterStateConfigManager>().AirMoveCurve; curver.MovementCurve = SingletonManager.Get <CharacterStateConfigManager>().MovementCurve; curver.PostureCurve = SingletonManager.Get <CharacterStateConfigManager>().PostureCurve; if (character.GetComponent <EntityReference>() == null) { character.AddComponentUncheckRequireAndDisallowMulti <EntityReference>(); } character.GetComponent <EntityReference>().Init(player.entityAdapter); var comp = character.AddComponent <PlayerVehicleCollision>(); comp.AllContext = _contexts; var appearanceManager = new AppearanceManager(); var characterControllerManager = new CharacterControllerManager(); characterControllerManager.SetCharacterController(characterControllerContext); var characterBone = new CharacterBoneManager(); characterBone.SetWardrobeController(appearanceManager.GetWardrobeController()); characterBone.SetWeaponController(appearanceManager.GetController <WeaponController>()); var weaponController = appearanceManager.GetController <WeaponController>() as WeaponController; if (null != weaponController) { weaponController.SetWeaponChangedCallBack(characterBone.CurrentWeaponChanged); weaponController.SetCacheChangeAction(characterBone.CacheChangeCacheAction); } player.AddCharacterControllerInterface(characterControllerManager); player.AddAppearanceInterface(appearanceManager); player.AddCharacterContoller(characterControllerContext); player.AddCharacterBoneInterface(characterBone); player.AddRecycleableAsset(character); player.AddPlayerGameState(PlayerLifeStateEnum.NullState); } }
protected override void InitComponent(PlayerEntity player, IContexts contexts) { var character = DefaultGo.CreateGameObject(player.entityKey.ToString()); character.layer = UnityLayerManager.GetLayerIndex(EUnityLayerName.Player); var cc = PlayerEntityUtility.InitCharacterController(character); var kcc = PlayerEntityUtility.InitKinematicCharacterMotor(character); var characterControllerContext = new CharacterControllerContext( new UnityCharacterController(cc, ModelLoadHandler.InitActionWithOffset(), !player.isFlagSelf), new ProneCharacterController(kcc, new ProneController(), ModelLoadHandler.InitActionWithNoOffset()), new DiveCharacterController(kcc, new DiveController(), ModelLoadHandler.InitActionWithNoOffset()), new SwimCharacterController(kcc, new SwimController(), ModelLoadHandler.InitActionWithNoOffset()) ); var curver = character.AddComponent <AirMoveCurve>(); curver.AireMoveCurve = SingletonManager.Get <CharacterStateConfigManager>().AirMoveCurve; character.AddComponent <EntityReference>(); character.GetComponent <EntityReference>().Init(player.entityAdapter); var comp = character.AddComponent <PlayerVehicleCollision>(); comp.AllContext = contexts as Contexts; var appearanceManager = new AppearanceManager(); var characterControllerManager = new CharacterControllerManager(); characterControllerManager.SetCharacterController(characterControllerContext); var characterBone = new CharacterBoneManager(); characterBone.SetWardrobeController(appearanceManager.GetWardrobeController()); characterBone.SetWeaponController(appearanceManager.GetController <NewWeaponController>()); var weaponController = (NewWeaponController)appearanceManager.GetController <NewWeaponController>(); if (null != weaponController) { weaponController.SetWeaponChangedCallBack(characterBone.CurrentP1WeaponChanged, characterBone.CurrentP3WeaponChanged); weaponController.SetWeaponOrAttachmentDeleteCallBack(characterBone.WeaponOrAttachmentDel); weaponController.SetWeaponOrAttachementAddCallBack(characterBone.WeaponOrAttachmentAdd); weaponController.SetCacheChangeAction(characterBone.CacheChangeCacheAction); } player.AddCharacterControllerInterface(characterControllerManager); player.AddAppearanceInterface(appearanceManager); player.AddCharacterContoller(characterControllerContext); player.AddCharacterBoneInterface(characterBone); player.AddPlayerGameState(PlayerLifeStateEnum.NullState); player.AddPlayerResource(character); }