Beispiel #1
0
            // 构造对象
            public ArmorPartObject(PlayerArmorCmpt character, ArmorPartData data, ItemObject item)
            {
                _character  = character;
                _data       = data;
                _item       = item;
                _armorID[0] = item.instanceId;

                _boneGroup = -1;
                _boneIndex = -1;

                if (data.type == ArmorType.Decoration)
                {
                    _character._decorationCount++;
                }
                _durability = _item.GetCmpt <Durability>();

                SyncAttachedBone();

                // 添加防御效果
                AddDefence();

                if (_character.hasModelLayer)
                {
                    CreateModel();
                }

                _character.TriggerAddOrRemoveEvent();
            }
 void GetEntityCmpt()
 {
     if (player != GameUI.Instance.mMainPlayer)
     {
         player        = GameUI.Instance.mMainPlayer;
         viewCmpt      = player.biologyViewCmpt;
         commonCmpt    = player.commonCmpt;
         equipmentCmpt = player.equipmentCmpt;
         //packageCmpt = player.GetCmpt<PlayerPackageCmpt>();
         entityInfoCmpt  = player.enityInfoCmpt;
         playerArmorCmpt = player.GetCmpt <WhiteCat.PlayerArmorCmpt>();
     }
 }
Beispiel #3
0
        /// <summary>
        /// 初始化
        /// </summary>
        public void Init(PeViewController viewController, GameObject viewModel, PlayerArmorCmpt armorCmpt)
        {
            if (_vc != viewController)
            {
                _vc = viewController;

                _vc.moveHandle.OnTargetMove     += OnMoveHandle;
                _vc.rotateHandle.OnTargetRotate += OnRotateHandle;
                _vc.scaleHandle.OnTargetScale   += OnScaleHandle;

                _vc.moveHandle.OnBeginTargetMove     += value => dragWindowEnabled = false;
                _vc.rotateHandle.OnBeginTargetRotate += value => dragWindowEnabled = false;
                _vc.scaleHandle.OnBeginTargetScale   += value => dragWindowEnabled = false;

                _vc.moveHandle.OnEndTargetMove     += value => dragWindowEnabled = true;
                _vc.rotateHandle.OnEndTargetRotate += value => dragWindowEnabled = true;
                _vc.scaleHandle.OnEndTargetScale   += value => dragWindowEnabled = true;

                // 在线模式需要同步服务器数据
                if (PeGameMgr.IsMulti)
                {
                    _vc.moveHandle.OnEndTargetMove += value =>
                    {
                        if (_target && _highlightIndex >= 0 && !_armorCmpt.hasRequest)
                        {
                            _armorCmpt.C2S_SyncArmorPartPosition(
                                arrayIndexToBoneGroup[_highlightIndex],
                                arrayIndexToBoneIndex[_highlightIndex],
                                _isDecoration,
                                _target.localPosition);
                        }
                    };

                    _vc.rotateHandle.OnEndTargetRotate += value =>
                    {
                        if (_target && _highlightIndex >= 0 && !_armorCmpt.hasRequest)
                        {
                            _armorCmpt.C2S_SyncArmorPartRotation(
                                arrayIndexToBoneGroup[_highlightIndex],
                                arrayIndexToBoneIndex[_highlightIndex],
                                _isDecoration,
                                _target.localRotation);
                        }
                    };

                    _vc.scaleHandle.OnEndTargetScale += value =>
                    {
                        if (_target && _highlightIndex >= 0 && !_armorCmpt.hasRequest)
                        {
                            _armorCmpt.C2S_SyncArmorPartScale(
                                arrayIndexToBoneGroup[_highlightIndex],
                                arrayIndexToBoneIndex[_highlightIndex],
                                _isDecoration,
                                _target.localScale);
                        }
                    };
                }
            }

            _viewCamera = viewController.viewCam;
            _light      = _viewCamera.GetComponentInParent <Light>();
            _armorBones = viewModel.GetComponent <ArmorBones>();
            _armorCmpt  = armorCmpt;
        }