예제 #1
0
            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);
                }
            }
예제 #2
0
            protected void HandleLoadedModel(PlayerEntity player, GameObject obj)
            {
                obj.layer = UnityLayers.PlayerLayer;
                PlayerEntityUtility.DisableCollider(obj.transform);

                if (!player.hasCharacterContoller)
                {
                    var character = DefaultGo.CreateGameObject(player.entityKey.ToString());
                    character.layer = UnityLayers.PlayerLayer;
                    CharacterController        cc  = PlayerEntityUtility.InitCharacterController(character);
                    KinematicCharacterMotor    kcc = PlayerEntityUtility.InitKinematicCharacterMotor(character);
                    CharacterControllerContext characterControllerContext = new CharacterControllerContext(
                        new UnityCharacterController(cc),
                        new Core.CharacterController.ConcreteController.ProneCharacterController(kcc,
                                                                                                 new ProneController()),
                        new Core.CharacterController.ConcreteController.DiveCharacterController(kcc,
                                                                                                new DiveController()),
                        new Core.CharacterController.ConcreteController.SwimCharacterController(kcc,
                                                                                                new SwimController())
                        );
                    player.AddCharacterContoller(characterControllerContext);

                    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.Context = _playerContext;

                    var appearanceManager = new AppearanceManager();
                    player.AddAppearanceInterface(appearanceManager);

                    var characterControllerManager = new CharacterControllerManager();
                    characterControllerManager.SetCharacterController(characterControllerContext);
                    player.AddCharacterControllerInterface(characterControllerManager);

                    var characterBone = new CharacterBoneManager();
                    characterBone.SetWardrobeController(player.appearanceInterface.Appearance.GetWardrobeController());
                    characterBone.SetWeaponController(player.appearanceInterface.Appearance.GetWeaponController());
                    player.appearanceInterface.Appearance.GetWeaponController().SetWeaponChangedCallBack(characterBone.CurrentWeaponChanged);
                    player.appearanceInterface.Appearance.GetWeaponController().SetCacheChangeAction(characterBone.CacheChangeCacheAction);
                    player.AddCharacterBoneInterface(characterBone);

                    player.AddRecycleableAsset(character);
                }
            }