Exemplo n.º 1
0
  def updateEntity(self, entity, components, currentTime):

    assert SystemManager.assertSystemInputParameters(entity,  components, self)

    rtsCameraComponent    = components[0]
    cameraComponent       = components[1]
    
    # assert cameraComponent != null;
    
    if rtsCameraComponent.isActive():
      rtsCamera = rtsCameraComponent.getCamera();
      
      if INPUT_MANAGER.isActionActive(CONST_CAM_UP):
        rtsCamera.moveUp(self.speed * currentTime.dt)
      
      if INPUT_MANAGER.isActionActive(CONST_CAM_DOWN):
        rtsCamera.moveUp(-self.speed * currentTime.dt)
      
      if INPUT_MANAGER.isActionActive(CONST_CAM_RIGHT):
        rtsCamera.moveRight(self.speed * currentTime.dt)
      
      if INPUT_MANAGER.isActionActive(CONST_CAM_LEFT):
        rtsCamera.moveRight(-self.speed * currentTime.dt)
      
      if INPUT_MANAGER.isActionActive(CONST_CAM_DISTANCE):
        rtsCamera.addDistance( -self.speedZoom * INPUT_MANAGER.getActionValue(CONST_CAM_DISTANCE) )
      
      
      cameraComponent.setActive(True)
    else:
      cameraComponent.setActive(False)
Exemplo n.º 2
0
  def addEntity(self, entity, components, currentTime):
    
    assert SystemManager.assertSystemInputParameters(entity,  components, self)

    camera = components[0]
    
    cc = ENTITY_MANAGER.createComponent(entity, CameraComponent.getComponentStaticType())
    
    cc.init(camera.getCamera())