def __initDeathZones(self, bottomLeft, upperRight):
        cmpSystem = self.sessionProvider.arenaVisitor.getComponentSystem()
        if cmpSystem:
            if hasattr(cmpSystem, 'deathZoneComponent'):
                deathZoneCmp = getattr(cmpSystem, 'deathZoneComponent')
                deathZonesCount = deathZoneCmp.getDeathZoneCount()[0]
                mapWidthPx, _ = minimap_utils.metersToMinimapPixels(
                    bottomLeft, upperRight)
                self._invoke(self.__deathZonesEntryID,
                             DeathZonesAs3Descr.AS_INIT_DEATH_ZONE_SIZE,
                             mapWidthPx / deathZonesCount)
                self.__lastCellIndex = deathZonesCount - 1
                deathZones = []
                for x, row in enumerate(deathZoneCmp.getZonesStates()):
                    for y, item in enumerate(row):
                        zoneState = item[0]
                        if zoneState != BRDeathZoneComponent.ZONE_FREE:
                            self.__updateZonesData(x, y, zoneState, deathZones)

                self.__sendDeathZonesUpdate(deathZones)
                deathZoneCmp.onDeathZoneUpdate += self.__onDeathZoneUpdated
            else:
                LOG_ERROR(
                    'Royal Battle Death zone component is not available!')
        else:
            LOG_ERROR('The component system is not available')
Exemplo n.º 2
0
 def _processMinimapSize(self, minSize, maxSize):
     mapWidthPx, mapHeightPx = minimap_utils.metersToMinimapPixels(
         minSize, maxSize)
     self.as_setMapDimensionsS(mapWidthPx, mapHeightPx)
     self._size = (mapWidthPx, mapHeightPx)
     self._bounds = (minSize, maxSize)
     self._hitAreaSize = mapWidthPx
 def __initDeathZones(self, bottomLeft, upperRight):
     mapWidthPx, _ = minimap_utils.metersToMinimapPixels(
         bottomLeft, upperRight)
     self._invoke(self.__deathZonesEntryID,
                  DeathZonesAs3Descr.AS_INIT_DEATH_ZONE_SIZE,
                  mapWidthPx / ZONES_X)
     g_eventBus.addListener(DeathZoneEvent.UPDATE_DEATH_ZONE,
                            self.__onDeathZoneUpdated,
                            scope=EVENT_BUS_SCOPE.BATTLE)
 def _populate(self):
     super(EpicBattleRespawn, self)._populate()
     ctrl = self.sessionProvider.dynamic.respawn
     if ctrl is not None:
         ctrl.onRespawnInfoUpdated += self.onRespawnInfoUpdated
     else:
         LOG_ERROR('Respawn Controller not available!')
     minSize, maxSize = self.sessionProvider.arenaVisitor.type.getBoundingBox()
     self.__mapDim = (abs(maxSize[0] - minSize[0]) * 1.0, abs(maxSize[1] - minSize[1]) * 1.0)
     mapWidthPx, mapHeightPx = minimap_utils.metersToMinimapPixels(*self.sessionProvider.arenaVisitor.type.getBoundingBox())
     self.as_setMapDimensionsS(mapWidthPx, mapHeightPx)
     self.__lastRespawnPositions = _DEFAULT_RESPAWN_POSITIONS
     return
 def _processMinimapSize(self, minSize, maxSize):
     self.__maxZoomMode = self._getMaxZoomMode(minSize, maxSize)
     mapWidthPx, mapHeightPx = minimap_utils.metersToMinimapPixels(minSize, maxSize)
     self.as_setMapDimensionsS(mapWidthPx, mapHeightPx)