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),
                new ProneCharacterController(kcc,
                                             new ProneController()),
                new DiveCharacterController(kcc,
                                            new DiveController()),
                new SwimCharacterController(kcc,
                                            new SwimController())
                );


            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 <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.AddPlayerGameState(PlayerLifeStateEnum.NullState);
            player.AddPlayerResource(character);
        }
예제 #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);
                }
            }
예제 #3
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);
                AddThirdModelOffsetObject(character);
                CharacterController        cc  = PlayerEntityUtility.InitCharacterController(character);
                KinematicCharacterMotor    kcc = PlayerEntityUtility.InitKinematicCharacterMotor(character);
                CharacterControllerContext characterControllerContext = new CharacterControllerContext(
                    new UnityCharacterController(cc, InitActionWithOffset(), !player.isFlagSelf),
                    new Core.CharacterController.ConcreteController.ProneCharacterController(kcc,
                                                                                             new ProneController(),
                                                                                             InitActionWithNoOffset()),
                    new Core.CharacterController.ConcreteController.DiveCharacterController(kcc,
                                                                                            new DiveController(), InitActionWithNoOffset()),
                    new Core.CharacterController.ConcreteController.SwimCharacterController(kcc,
                                                                                            new SwimController(), InitActionWithNoOffset())
                    );


                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 = (WeaponController)appearanceManager.GetController <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);
            }
        }