示例#1
0
 def __init__(self, entityID, position, ev, dmgType = None, enemyID = None):
     dmgRamming = [DAMAGE_REASON.RAMMING]
     self.__isPlayer = ev in ('Play_hit_LOGIC_Avatar', 'Play_hit_EFFECT_damage_Avatar')
     if dmgType == DAMAGE_REASON.TREES:
         ev = HitSFXFactory.OTHER_DAMAGE + 'Threes'
     elif dmgType in dmgRamming:
         ev = HitSFXFactory.OTHER_DAMAGE + 'Ram'
     ctx = node = 0
     if not position:
         entity = BigWorld.entities.get(entityID, None)
         if entity:
             soundController = entity.controllers.get('soundController', None)
             if soundController:
                 so = soundController.soundObjects.get(SOUND_OBJECT_TYPES.ENGINE, None)
                 if so:
                     ctx = so.context.cidProxy.handle
                     node = so.node.id
     WwiseGameObject.__init__(self, 'HitSound-{0}'.format(ev), ctx, node, position)
     cam = GameEnvironment.getCamera()
     if self.__isPlayer and cam:
         cam.eZoomStateChanged += self.__onZoomStateChanged
         cam.eDistanceChanged += self.__onDistanceChanged
         self.__onZoomStateChanged(RTPC_Zoomstate_MAX if cam.isSniperMode else Settings.g_instance.camZoomIndex)
     if hasattr(BigWorld.player(), 'eLeaveWorldEvent'):
         BigWorld.player().eLeaveWorldEvent += self.__onLeaveWorld
     if self.__isPlayer and enemyID:
         self.__setHitDirectionRTPC(enemyID)
     em = GS().hitSFXManager
     if em is not None:
         em.register(self)
         self.postEvent(ev, self.__onLeaveWorld)
     return
示例#2
0
 def __destroy(self):
     if hasattr(BigWorld.player(), 'eLeaveWorldEvent'):
         BigWorld.player().eLeaveWorldEvent -= self.__destroy
     em = GS().explosionSFXManager
     if em is not None:
         em.unregister(self)
     self.destroy()
     return
示例#3
0
 def __init__(self, ev, pos):
     WwiseGameObject.__init__(self, 'ExplosionSound-{0}'.format(ev), 0, 0, pos)
     if hasattr(BigWorld.player(), 'eLeaveWorldEvent'):
         BigWorld.player().eLeaveWorldEvent += self.__destroy
     em = GS().explosionSFXManager
     if em is not None:
         em.register(self)
         self.postEvent(ev, self.__destroy)
     return
示例#4
0
 def __onLeaveWorld(self):
     player = BigWorld.player()
     if hasattr(player, 'eLeaveWorldEvent'):
         player.eLeaveWorldEvent -= self.__onLeaveWorld
     cam = GameEnvironment.getCamera()
     if self.__isPlayer and cam:
         cam.eZoomStateChanged -= self.__onZoomStateChanged
         cam.eDistanceChanged -= self.__onDistanceChanged
     self.stopAll(500, True)
     em = GS().hitSFXManager
     if em is not None:
         em.unregister(self)
     self.destroy()
     return
示例#5
0
 def play(self):
     if GS().isReplayMute:
         return
     if self.__looped and self.__started and not self.__isTL:
         return
     self.postEvent(self.__shootEvent)
     self.__started = True
示例#6
0
 def __onBattleEnd(self):
     self.__cleanQueue()
     if GS().isWinner:
         self.play(VOICE.TEAM_WIN)
     else:
         self.play(VOICE.TEAM_LOSE)
     self.__lockQueue()
示例#7
0
    def getSoundObjectSettings(data):
        partByNames = data['partByNames']
        isPlayer = data['isPlayer']
        turretSoundIDByTurretID = data['turretSoundIDByTurretID']
        soundObjects = data['soundObjects']
        context = data['context']
        if turretSoundIDByTurretID is not None:
            for turretId, snd in turretSoundIDByTurretID.iteritems():
                isAA = str(snd).find('AA') != -1
                isTL = isPlayer and str(snd).find('TL') != -1
                hp = 'HP_mass'
                for p in partByNames:
                    if str(p).find('gun') != -1 and hasattr(
                            partByNames[p], 'mountPoint'):
                        hp = partByNames[p].mountPoint
                        break

                so = SoundObjectSettings()
                so.context = context
                so.mountPoint = hp
                so.weaponID = snd
                so.soundSet = GS().findLoadSet(
                    db.DBLogic.g_instance.getWeaponSoundSet(so.weaponID),
                    isPlayer, isAA, isTL)
                so.factory = TurretSoundFactory.instance()
                so.turretID = turretId
                soundObjects[SOUND_OBJECT_TYPES.TURRET(turretId)] = so

        return
示例#8
0
 def getSoundObjectSettings(data):
     info = data['info']
     isPlayer = data['isPlayer']
     weaponSoundID = data['weaponSoundID']
     soundObjects = data['soundObjects']
     context = data['context']
     alreadyLoadedWeaponsID = set()
     slot = -1
     for w in info.weapons:
         slot += 1
         if len(weaponSoundID) == slot:
             break
         if not isPlayer and weaponSoundID[slot] in alreadyLoadedWeaponsID:
             continue
         for hp in w:
             so = SoundObjectSettings()
             so.context = context
             so.mountPoint = hp
             so.weaponID = weaponSoundID[slot] if slot < len(
                 weaponSoundID) else 'weapon_default'
             so.soundSet = GS().findLoadSet(
                 db.DBLogic.g_instance.getWeaponSoundSet(so.weaponID),
                 isPlayer)
             so.factory = WeaponSoundFactory.instance()
             soundObjects[SOUND_OBJECT_TYPES.WEAPONS[slot]] = so
             if not isPlayer:
                 alreadyLoadedWeaponsID.add(so.weaponID)
                 break
示例#9
0
 def canPlayEffect(name):
     entityID = None
     player = BigWorld.player()
     if name == HitSFXFactory.AVATAR_EFFECT_HIT:
         entityID = BigWorld.player().id
     elif hasattr(player, 'curVehicleID'):
         entityID = player.curVehicleID
     return entityID and not GS().isBurning(entityID, 5.0)
示例#10
0
 def __init__(self, name, cid, node, position=None):
     if GS().isReplayMute:
         return
     ev = db.DBLogic.g_instance.getEffectSound(name)
     if not ev:
         return
     WwiseGameObject.__init__(self, 'Effect-{0}'.format(name), cid, node,
                              position)
     self.postEvent(ev, self.destroy)
示例#11
0
 def _clearEvents(self):
     BigWorld.player().eUpdateForce -= self.__onForce
     BigWorld.player().onStateChanged -= self.__onPlayerStateChanged
     BigWorld.player().eUpdateSpectator -= self.__onSpectator
     BigWorld.player().eArenaLoaded -= self.__onArenaLoaded
     cam = GameEnvironment.getCamera()
     cam.eZoomStateChanged -= self.__onZoomStateChanged
     cam.eDistanceChanged -= self.__onDistanceChanged
     GS().eLoadingScreenClosed -= self.play
示例#12
0
 def getSoundObjectSettings(data):
     isPlayer = data['isPlayer']
     soundObjects = data['soundObjects']
     context = data['context']
     info = data['info']
     so = SoundObjectSettings()
     so.mountPoint = info.mointPoint
     engineSet = db.DBLogic.g_instance.getAircraftEngineSet('Default')
     engineSet.update(
         db.DBLogic.g_instance.getAircraftEngineSet(info.engineSet))
     so.soundSet = GS().findLoadSet(engineSet, isPlayer, False, False, [
         'OverheatRelativeStart', 'RtpcEngineBoostAttack',
         'RtpcEngineBoostRelease', 'PlainType', 'SoundBank', 'SoundBankNPC'
     ])
     so.factory = AircraftEngineSoundFactory.instance()
     so.context = context
     soundObjects[SOUND_OBJECT_TYPES.ENGINE] = so
示例#13
0
 def canPlay(entityID, health, oldHealth, damagerID, dmgType):
     player = BigWorld.player()
     isNPC = entityID != player.id
     dmgRamming = [DAMAGE_REASON.TREES,
      DAMAGE_REASON.RAMMING,
      DAMAGE_REASON.OBSTACLE,
      DAMAGE_REASON.TERRAIN,
      DAMAGE_REASON.WATER]
     dmgExplosion = [DAMAGE_REASON.FIRING, DAMAGE_REASON.ROCKET_EXPLOSION, DAMAGE_REASON.BOMB_EXPLOSION]
     currentBattleMode = GameEnvironment.getInput().inputAxis.currentBattleMode
     DELTA_HEALTH = 0
     if GS().isReplayMute:
         return False
     if isNPC and (damagerID != player.id or dmgType == DAMAGE_REASON.AA_EXPLOSION or not BigWorld.entities.get(entityID).damagedByGunID and currentBattleMode != BATTLE_MODE.GUNNER_MODE):
         return False
     if oldHealth - health < DELTA_HEALTH:
         return False
     if dmgType in dmgExplosion:
         return False
     if isNPC and dmgType in dmgRamming:
         return False
     return True
示例#14
0
 def __unregisterEvents(self):
     GS().eOnBattleStart -= self.__onBattleStart
     GS().eOnBattleEnd -= self.__onBattleEnd
     SoundEventDispatcher.eVoiceoverRequest -= self.play
示例#15
0
 def _clearEventsBase(self):
     GS().eOnBattleEnd -= self.stop
     self._clearEvents()
示例#16
0
 def _registerEventsBase(self):
     GS().eOnBattleEnd += self.stop
     self._registerEvents()
示例#17
0
 def play(self):
     if GS().isReplayMute:
         return
     self.postEvent(self.__ev)
示例#18
0
 def __registerEvents(self):
     GS().eOnBattleStart += self.__onBattleStart
     GS().eOnBattleEnd += self.__onBattleEnd
     self.__player.eArenaLoaded += self.__onArenaLoaded
     SoundEventDispatcher.eVoiceoverRequest += self.play