本文整理汇总了Python中AvatarInputHandler.AimingSystems.SniperAimingSystem.SniperAimingSystem.enable方法的典型用法代码示例。如果您正苦于以下问题:Python SniperAimingSystem.enable方法的具体用法?Python SniperAimingSystem.enable怎么用?Python SniperAimingSystem.enable使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AvatarInputHandler.AimingSystems.SniperAimingSystem.SniperAimingSystem
的用法示例。
在下文中一共展示了SniperAimingSystem.enable方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: SniperCamera
# 需要导入模块: from AvatarInputHandler.AimingSystems.SniperAimingSystem import SniperAimingSystem [as 别名]
# 或者: from AvatarInputHandler.AimingSystems.SniperAimingSystem.SniperAimingSystem import enable [as 别名]
class SniperCamera(ICamera, CallbackDelayer):
_DYNAMIC_ENABLED = True
@staticmethod
def enableDynamicCamera(enable):
SniperCamera._DYNAMIC_ENABLED = enable
@staticmethod
def isCameraDynamic():
return SniperCamera._DYNAMIC_ENABLED
_FILTER_LENGTH = 5
_DEFAULT_MAX_ACCELERATION_DURATION = 1.5
_MIN_REL_SPEED_ACC_SMOOTHING = 0.7
camera = property(lambda self: self.__cam)
aimingSystem = property(lambda self: self.__aimingSystem)
def __init__(self, dataSec, aim, binoculars):
CallbackDelayer.__init__(self)
self.__impulseOscillator = None
self.__movementOscillator = None
self.__noiseOscillator = None
self.__dynamicCfg = CameraDynamicConfig()
self.__accelerationSmoother = None
self.__readCfg(dataSec)
if aim is None or binoculars is None:
return
else:
self.__cam = BigWorld.FreeCamera()
self.__zoom = self.__cfg['zoom']
self.__curSense = 0
self.__curScrollSense = 0
self.__waitVehicleCallbackId = None
self.__onChangeControlMode = None
self.__aimingSystem = SniperAimingSystem(dataSec)
self.__aim = weakref.proxy(aim)
self.__binoculars = binoculars
self.__defaultAimOffset = self.__aim.offset()
self.__defaultAimOffset = (self.__defaultAimOffset[0], self.__defaultAimOffset[1])
self.__crosshairMatrix = createCrosshairMatrix(offsetFromNearPlane=self.__dynamicCfg['aimMarkerDistance'])
self.__prevTime = BigWorld.time()
self.__autoUpdateDxDyDz = Vector3(0, 0, 0)
return
def create(self, onChangeControlMode = None):
self.__onChangeControlMode = onChangeControlMode
def destroy(self):
self.disable()
self.__onChangeControlMode = None
self.__cam = None
self._writeUserPreferences()
self.__aimingSystem.destroy()
self.__aimingSystem = None
self.__aim = None
CallbackDelayer.destroy(self)
return
def enable(self, targetPos, saveZoom):
self.__prevTime = BigWorld.time()
player = BigWorld.player()
if saveZoom:
self.__zoom = self.__cfg['zoom']
else:
self.__cfg['zoom'] = self.__zoom = self.__cfg['zooms'][0]
self.__applyZoom(self.__zoom)
self.__setupCamera(targetPos)
vehicle = BigWorld.entity(player.playerVehicleID)
if self.__waitVehicleCallbackId is not None:
BigWorld.cancelCallback(self.__waitVehicleCallbackId)
if vehicle is None:
self.__whiteVehicleCallbackId = BigWorld.callback(0.1, self.__waitVehicle)
else:
self.__showVehicle(False)
BigWorld.camera(self.__cam)
if self.__cameraUpdate(False) >= 0.0:
self.delayCallback(0.0, self.__cameraUpdate)
return
def disable(self):
BigWorld.camera(None)
if self.__waitVehicleCallbackId is not None:
BigWorld.cancelCallback(self.__waitVehicleCallbackId)
self.__waitVehicleCallbackId = None
self.__showVehicle(True)
self.stopCallback(self.__cameraUpdate)
self.__aimingSystem.disable()
self.__movementOscillator.reset()
self.__impulseOscillator.reset()
self.__noiseOscillator.reset()
self.__accelerationSmoother.reset()
self.__autoUpdateDxDyDz.set(0)
FovExtended.instance().resetFov()
return
def getUserConfigValue(self, name):
return self.__userCfg.get(name)
def setUserConfigValue(self, name, value):
if name not in self.__userCfg:
#.........这里部分代码省略.........