Example #1
0
 public void OnHpChange(SkillSystem.SkEntity caster, float hpChange)
 {
     m_Entity.CurrentDurability = _skEntity.GetAttribute(AttribType.Hp);
 }
Example #2
0
        // 处理非传输输入
        void HandleNormalInput()
        {
            if (_isAttackMode)
            {
                // 获取瞄准信息

                var hit           = Physics.RaycastAll(_ray = PeCamera.mouseRay, _rayMaxDistance, PEVCConfig.instance.attackRayLayerMask);
                int selectedIndex = -1;

                if (hit.Length > 0)
                {
                    float distance = float.MaxValue;

                    for (int i = 0; i < hit.Length; i++)
                    {
                        if (!hit[i].collider.isTrigger && hit[i].distance < distance && !hit[i].transform.IsChildOf(transform))
                        {
                            selectedIndex = i;
                            distance      = hit[i].distance;
                        }
                    }
                }

                if (selectedIndex >= 0)
                {
                    _aimPoint  = hit[selectedIndex].point;
                    _aimEntity = hit[selectedIndex].collider.GetComponentInParent <PESkEntity>();
                    if (_aimEntity != null)
                    {
                        // 排除友方和死亡目标
                        if (ForceSetting.Instance.AllyPlayer(
                                (int)_aimEntity.GetAttribute(AttribType.DefaultPlayerID),
                                (int)creationSkEntity.GetAttribute(AttribType.DefaultPlayerID)
                                ) || _aimEntity.isDead)
                        {
                            _aimEntity = null;
                        }
                    }
                }
                else
                {
                    _aimPoint  = _ray.direction * _rayMaxDistance + _ray.origin;
                    _aimEntity = null;
                }

                UpdateLockTarget();

                // 导弹发射
                SetWeaponControlEnabled(WeaponType.Missile, PeInput.Get(PeInput.LogicFunction.MissleLaunch));

                // 炮发射
                if (PeInput.Get(PeInput.LogicFunction.Vehicle_BegFixedShooting))
                {
                    SetWeaponControlEnabled(WeaponType.Cannon, true);
                }
                if (PeInput.Get(PeInput.LogicFunction.Vehicle_EndFixedShooting))
                {
                    SetWeaponControlEnabled(WeaponType.Cannon, false);
                }

                // 枪发射
                if (PeInput.Get(PeInput.LogicFunction.Vehicle_BegUnfixedShooting))
                {
                    SetWeaponControlEnabled(WeaponType.Gun, true);
                }
                if (PeInput.Get(PeInput.LogicFunction.Vehicle_EndUnfixedShooting))
                {
                    SetWeaponControlEnabled(WeaponType.Gun, false);
                }

                // 武器组开关
                for (int i = 0; i < _weaponGroupKey.Length; i++)
                {
                    if (PeInput.Get(_weaponGroupKey[i]))
                    {
                        ReverseWeaponGroupEnabled(i);
                        UIDrivingCtrl.Instance.SetWweaponGroupToggles(i, IsWeaponGroupEnabled(i));
                    }
                }
            }
            else
            {
                _timeToLock   = -1f;
                _targetToLock = null;
                _lockedTarget = null;
                DisableAllWeaponControl();
            }
        }