Пример #1
0
def animate_model(model, position, duration, callback=None, callback_args=None):
    interval = LerpPosInterval(
        model, duration, position, model.getPos())
    interval.start()

    if callback:
        if not callback_args:
            callback_args = []
        callback(*callback_args)
Пример #2
0
class LegendaryFishFSM(FishFSM):

    def __init__(self, fish):
        FishFSM.__init__(self, fish)
        self.defaultTransitions = {'Offscreen': ['FinalBackToSea', 'Swimming', 'TurnAround', 'HookedFighting', 'AboutToBiteLure'],'Swimming': ['TurnAround', 'Biting', 'AboutToBiteLure', 'Offscreen'],'AboutToBiteLure': ['Swimming', 'Biting', 'Offscreen'],'TurnAround': ['AboutToBiteLure', 'Swimming', 'Offscreen'],'Biting': ['Swimming', 'PullingLure', 'Hooked', 'Flee', 'Offscreen'],'Hooked': ['HookedFighting', 'PullingLure', 'Offscreen'],'PullingLure': ['Hooked', 'HookedFighting', 'Flee', 'Offscreen'],'HookedFighting': ['PullingLure', 'Hooked', 'Flee', 'Offscreen'],'Flee': ['Swimming', 'TurnAround', 'Offscreen'],'FinalBackToSea': ['Offscreen']}

    def enterAboutToBiteLure(self):
        self.fish.initVariables()
        self.fish.showStaminaBar()
        self.fish.actor.clearControlEffectWeights()
        self.fish.reparentTo(self.fish.fishManager.objectsWithCaustics)
        self.fish.setPos(FishingGlobals.rightFishBarrier + FishingGlobals.fullyOffscreenXOffset, 0.0, max(-63.0, self.fish.fishManager.gameObject.lure.getZ()))
        self.fish.actor.changeAnimationTo('swimIdleOpposite')
        self.lfChaseLureSequence = Sequence(self.fish.posInterval(self.fish.myData['swimLeftDuration'], Point3(self.fish.myData['fishTurnX'], 0.0, self.fish.getZ())), Func(self.fish.actor.changeAnimationTo, 'turnOpposite', False), Wait(self.fish.actor.getDuration('turnOpposite') / 4.0), Func(self.fish.actor.changeAnimationTo, 'swimIdle'), self.fish.posInterval(self.fish.myData['swimRightDuration'], Point3(self.fish.fishManager.gameObject.lure.getX() - self.fish.myData['biteXOffset'], 0.0, self.fish.getZ())), Func(self.request, 'Biting'), name=self.fish.fishManager.gameObject.distributedFishingSpot.uniqueName('lfChaseLureSequence'))
        self.lfChaseLureSequence.start()

    def exitAboutToBiteLure(self):
        self.lfChaseLureSequence.pause()
        self.lfChaseLureSequence.clearToInitial()

    def checkForBite(self):
        pass

    def enterHooked(self):
        self.fish.fishMoveSequence.pause()
        self.fish.actor.changeAnimationTo('reelIdle')

    def exitHooked(self):
        taskName = '%s_StartFighting' % self.fish.getName()
        taskMgr.remove(self.fish.fishManager.gameObject.distributedFishingSpot.uniqueName(taskName))
        self.fish.lfStruggleSequence.pause()
        self.fish.lfStruggleSequence.clearToInitial()

    def enterHookedFighting(self):
        self.fish.actor.changeAnimationTo('fightIdle')

    def exitHookedFighting(self):
        pass

    def enterPullingLure(self):
        self.fish.actor.changeAnimationTo('fightIdle')

    def exitPullingLure(self):
        self.fish.setY(0.0)

    def enterFinalBackToSea(self):
        self.fish.setPosHpr(self.fish.myData['goodbyePosHpr'][0], self.fish.myData['goodbyePosHpr'][1])
        self.fish.actor.changeAnimationTo('swimIdle')
        self.farewellInterval = LerpPosInterval(self.fish, FishingGlobals.waveToLegendaryFishDuration, pos=self.fish.myData['swimmingDistance'], startPos=self.fish.getPos(), name='%s_farewellInterval' % self.fish.getName())
        self.farewellInterval.start()

    def exitFinalBackToSea(self):
        self.farewellInterval.pause()
        self.farewellInterval.clearToInitial()
Пример #3
0
class WeaponGfxNetwork(WeaponGfx):
    def __init__(self, mediator, car, cars):
        WeaponGfx.__init__(self, mediator, car, cars)
        self.ipos = None
        self.ifwd = None

    def update_props(self, pos, fwd):
        if pos == (0, 0, 0) and fwd == (0, 0, 0): return
        wpn_np = self.gfx_np.node
        old_pos = wpn_np.get_pos(render)
        self.gfx_np.node.reparent_to(render)
        wpn_np.set_pos(old_pos)
        self.ipos = LerpPosInterval(wpn_np, self.eng.client.rate, pos)
        self.ipos.start()
        fwd_start = render.get_relative_vector(wpn_np, Vec3(0, 1, 0))
        if self.ifwd: self.ifwd.finish()
        self.ifwd = LerpFunc(self._rotate_wpn,
                             fromData=0,
                             toData=1,
                             duration=self.eng.client.rate,
                             extraArgs=[wpn_np, fwd_start, fwd])
        self.ifwd.start()

    def update_fired_props(self, pos, fwd):
        if pos == (0, 0, 0) and fwd == (0, 0, 0): return
        wpn_np = self.gfx_np.node
        old_pos = wpn_np.get_pos(render)
        self.gfx_np.node.reparent_to(render)
        wpn_np.set_pos(old_pos)
        self.ipos = LerpPosInterval(wpn_np, self.eng.client.rate, pos)
        self.ipos.start()
        fwd_start = render.get_relative_vector(wpn_np, Vec3(0, 1, 0))
        if self.ifwd: self.ifwd.finish()
        self.ifwd = LerpFunc(self._rotate_wpn,
                             fromData=0,
                             toData=1,
                             duration=self.eng.client.rate,
                             extraArgs=[wpn_np, fwd_start, fwd])
        self.ifwd.start()

    @staticmethod
    def _rotate_wpn(t, node, start_vec, end_vec):
        interp_vec = Vec3(
            float(start_vec[0]) * (1 - t) + float(end_vec[0]) * t,
            float(start_vec[1]) * (1 - t) + float(end_vec[1]) * t,
            float(start_vec[2]) * (1 - t) + float(end_vec[2]) * t)
        node.look_at(node.get_pos() + interp_vec)

    def destroy(self):
        if self.ipos: self.ipos.finish()
        if self.ifwd: self.ifwd.finish()
        self.ipos = self.ifwd = None
        WeaponGfx.destroy(self)
Пример #4
0
 def stopChase(self):
     
     #self.AIbehaviors.pauseAi("pursue")
     if not self._is_dead:
         self.AIbehaviors.removeAi("pursue")
         p1 = LerpHprInterval(self.npc, 4, Point3(180,0,0))
         p2 = LerpPosInterval(self.npc, 4, Point3(self.anchorx, self.anchory, self.anchorz))
         animInterval = self.npc.actorInterval("walk", loop = 1, duration=4)
         p2.start()
         p1.start()
         animInterval.start()
         self.isMoving = False
         self.target = None
         self.isCurrentUser = False
Пример #5
0
    def stopChase(self):

        #self.AIbehaviors.pauseAi("pursue")
        if not self._is_dead:
            self.AIbehaviors.removeAi("pursue")
            p1 = LerpHprInterval(self.npc, 4, Point3(180, 0, 0))
            p2 = LerpPosInterval(
                self.npc, 4, Point3(self.anchorx, self.anchory, self.anchorz))
            animInterval = self.npc.actorInterval("walk", loop=1, duration=4)
            p2.start()
            p1.start()
            animInterval.start()
            self.isMoving = False
            self.target = None
            self.isCurrentUser = False
Пример #6
0
    def init_game(self):
        configs.IN_MENU = False
        interval = LerpHprInterval(self.cameraPivot, 1, (0,10,0), (0,0,0))
        interval2 = LerpPosInterval(self.cameraPivot, 1, (0,0,-0.05), (0,0,0))
        interval.start()
        interval2.start()
        for entity_id, entity in configs.ENTITIES.items():
            if entity['CATEGORY'] == 'button':
                entity['BUTTON'].destroy()
                try:
                    entity['R_NODE'].removeNode()
                except: 
                    print "nothing to remove"
                try:
                    entity['L_NODE'].removeNode()
                except: 
                    print "nothing to remove"
            del(configs.ENTITIES[entity_id])
        used_positions = []
        for p in range(25):
            position = (random.uniform(-1.6, 1.6), 0, random.uniform(-0.8, 0.8))
            heading = random.randint(0,360)
            empty_space = False
            while empty_space == False:
                empty_space = True
                for other_position in used_positions:
                    distance = pow(pow((other_position[0] - position[0]),2) + pow((other_position[2] - position[2]),2),0.5)
                    if distance < 0.25:
                        empty_space = False
                        position = (random.uniform(-1.6, 1.6), 0, random.uniform(-0.8, 0.8))

            btn_left = configs.BUTTONS_MAP[p][0]
            btn_right = configs.BUTTONS_MAP[p][1]
            if (btn_right == '' or btn_left == '') and configs.ARDUINO_PLAYER_ON[p] == 0:
                continue
            used_positions += [position]
            init_player(self, btn_left, btn_right, p, pos=position, heading=heading)
        
        configs.BONUS_START_TIME[2] = globalClock.getFrameTime()

        if used_positions == []:
            self.init_menu()
        else:
            self.countDown = taskMgr.add(countDown, "countDown", extraArgs=[self, 5], appendTask=True) 
            self.gameTask = taskMgr.add(self.gameLoop, "gameLoop") 
Пример #7
0
 def enemy_shoot_task(self, task):
     for t in tanks_list:
         ShootAt = tanks_dict[t]["tank"].getRelativePoint(
             self.camera, (0 + random(), 0 + random(), 0 + random()))
         ShootAt = LVecBase2d(ShootAt[0], ShootAt[1]).normalized()
         if ShootAt[0] > 0.99999 and not tanks_dict[t]["shooting"]:
             print('Tank {} shooting'.format(t))
             tanks_dict[t]["shooting"] = True
             tanks_dict[t]["round"].wrtReparentTo(render)
             ShootAt = render.getRelativeVector(tanks_dict[t]["tank"],
                                                (1, 0, 0))
             i = LerpPosInterval(tanks_dict[t]["round"],
                                 1,
                                 pos=(tanks_dict[t]["round"].getPos() +
                                      ShootAt * 300))
             i.setDoneEvent('shot{}-done'.format(t))
             i.start()
             self.enemyShot_snd.play()
     return Task.cont
Пример #8
0
    def shoot(self):

        self.tank_round[0].setPos(0, 20, -0.2)
        self.sight_engaged_np.show()
        self.sight_clear_np.hide()

        self.tank_round[0].wrtReparentTo(render)
        # print(self.tank_round[0].getPos(), self.tank_round[0].getHpr())
        ShootAt = render.getRelativeVector(base.camera, (0, 1, 0))
        # self.tank_round[0].setPos(self.tank_round[0].getPos() + ShootAt)

        self.tank_round[0].show()
        self.mainShot_snd.play()
        i = LerpPosInterval(self.tank_round[0],
                            1.1,
                            pos=(self.tank_round[0].getPos() + ShootAt * 200))
        i.setDoneEvent('shot-done')
        i.start()
        # print(ShootAt)
        return
Пример #9
0
 def changePosColorScale(self,key,pos = None,color = None, scale = None,time = 0):
     '''Change an item's position, color, and/or scale. 
     params should be lists having a length of 3 (pos, scale) or 4 (color) floats
     '''
     if pos:
         self.itemEntries[key].pos = pos
         if not time:
             self._sceneItems[key].setPos(pos)
         else:
             ival = LerpPosInterval(self._sceneItems[key],time,pos,self._sceneItems[key].getPos())
             self._intervals.append(ival)
             ival.start()
     if color:
         self.itemEntries[key].color = color
         if not time:
             self._sceneItems[key].setColor(color)
         else:
             ival = LerpColorInterval(self._sceneItems[key],time,color,self._sceneItems[key].getColor())
             self._intervals.append(ival)
             ival.start()
     if scale:
         self.itemEntries[key].scale = scale
         if not time:
             self._sceneItems[key].setScale(self._sceneItems[key].getSx()*scale[0],
                                            self._sceneItems[key].getSy()*scale[1],
                                            self._sceneItems[key].getSz()*scale[2])
         else:
             targetscale = (self._sceneItems[key].getSx()*scale[0],
                            self._sceneItems[key].getSy()*scale[1],
                            self._sceneItems[key].getSz()*scale[2])
             ival = LerpScaleInterval(self._sceneItems[key],time,targetscale,self._sceneItems[key].getScale())
             self._intervals.append(ival)
             ival.start()
Пример #10
0
class CreditsState(FSMState):
    '''
    Controls the state of the game while displaying the credits page.
    '''
    def __init__(self, gameRef=None):
        FSMState.__init__(self, gameRef, PanoConstants.STATE_CREDITS)

        self.log = logging.getLogger('pano.creditsState')
        self.alphaMask = None
        self.tex = None

        # scene root
        self.scene = None

        # parent node of self.creditsOST
        self.textParent = None

        # filename of the background image
        self.background = None

        # OnscreenImage used for background rendering
        self.backgroundOSI = None

        # name of the font definition to use
        self.fontName = None

        self.fontColor = None

        # scroll speed in pixels / s
        self.scrollSpeed = 1.0

        # the duration of credits
        self.scrollTime = 0.0

        self.credits = None

        # OnscreenText object for rendering the credits
        self.creditsOST = None

        # positional interval used to scroll the texts
        self.scrollInterval = None

        self.camera = None
        self.camNP = None

        self.displayRegion = None

        self.playlist = None

    def _configure(self):
        cfg = self.game.getConfig()
        self.background = cfg.get(PanoConstants.CVAR_CREDITS_BACKGROUND)
        self.fontName = cfg.get(PanoConstants.CVAR_CREDITS_FONT)
        self.fontColor = cfg.getVec4(PanoConstants.CVAR_CREDITS_FONT_COLOR)
        self.fontScale = cfg.getFloat(PanoConstants.CVAR_CREDITS_FONT_SCALE)
        self.scrollSpeed = cfg.getFloat(
            PanoConstants.CVAR_CREDITS_SCROLL_SPEED)
        self.playlist = cfg.get(PanoConstants.CVAR_CREDITS_MUSIC)

        creditsFile = cfg.get(PanoConstants.CVAR_CREDITS_TEXT_FILE)
        self.credits = self.game.getResources().loadText(creditsFile)

    def enter(self):

        FSMState.enter(self)

        self.game.getView().fadeOut(1.0)

        self._configure()

        globalClock.setMode(ClockObject.MSlave)

        # create alpha mask that fades the top and bottom
        img = PNMImage(8, 8)
        img.addAlpha()
        img.fill(1)
        img.alphaFill(1)
        for x in range(img.getXSize()):
            for y in range(img.getYSize()):
                img.setAlpha(
                    x, y, -.2 + 2.5 * math.sin(math.pi * y / img.getYSize()))
        self.alphaMask = img

        # create texture for applying the alpha mask
        self.tex = Texture()
        self.tex.load(self.alphaMask)
        self.tex.setWrapU(Texture.WMClamp)
        self.tex.setWrapV(Texture.WMClamp)

        # create scenegraph
        self.scene = NodePath('credits_scene_root')
        self.scene.setDepthTest(False)
        self.scene.setDepthWrite(False)

        self.textParent = self.scene.attachNewNode('text_parent')

        ts = TextureStage('')
        self.textParent.setTexGen(ts, TexGenAttrib.MWorldPosition)
        self.textParent.setTexScale(ts, .5, .5)
        self.textParent.setTexOffset(ts, .5, .5)
        self.textParent.setTexture(ts, self.tex)

        # background
        self.backgroundOSI = OnscreenImage(
            self.game.getResources().getResourceFullPath(
                PanoConstants.RES_TYPE_TEXTURES, self.background),
            parent=render2d)

        #  create credits text
        i18n = self.game.getI18n()
        localizedFont = i18n.getLocalizedFont(self.fontName)
        fontPath = self.game.getResources().getResourceFullPath(
            PanoConstants.RES_TYPE_FONTS, localizedFont)
        fontRes = loader.loadFont(fontPath)

        self.creditsOST = TextNode('creditsTextNode')
        crNP = self.textParent.attachNewNode(self.creditsOST)
        crNP.setScale(self.fontScale *
                      PandaUtil.getFontPixelPerfectScale(fontRes))
        self.creditsOST.setFont(fontRes)
        self.creditsOST.setEncoding(TextEncoder.EUtf8)
        self.creditsOST.setText(self.credits)
        self.creditsOST.setTextColor(
            Vec4(self.fontColor[0], self.fontColor[1], self.fontColor[2],
                 self.fontColor[3]))
        self.creditsOST.setAlign(TextNode.ACenter)
        crNP.setP(-90)
        crNP.flattenLight()

        b3 = self.textParent.getTightBounds()
        dims = b3[1] - b3[0]

        pixels = PandaUtil.unitsToPixelsY(dims[1] + 2.0 - 1.05)
        self.scrollTime = pixels / self.scrollSpeed
        self.log.debug('time to scroll: %f' % self.scrollTime)
        self.scrollInterval = LerpPosInterval(self.textParent, self.scrollTime,
                                              Point3(0, dims[1] + 2, 0),
                                              Point3(0, -1.05, 0))

        # render scene through an orthographic camera
        self.camera = Camera('credits_camera')
        lens = OrthographicLens()
        lens.setFilmSize(2, 2)
        lens.setNearFar(-1000, 1000)
        self.camera.setLens(lens)

        self.camNP = NodePath(self.camera)
        self.camNP.reparentTo(self.scene)
        self.camNP.setP(-90)

        self.displayRegion = self.game.getView().getWindow().makeDisplayRegion(
        )
        self.displayRegion.setClearColor(Vec4(0, 0, 0, 1))
        self.displayRegion.setCamera(self.camNP)
        self.displayRegion.setSort(20)

        self.game.getInput().addMappings('credits')

        self.game.getView().fadeIn(.5)

        self.scrollInterval.start()

        globalClock.setMode(ClockObject.MNormal)

        if self.playlist is not None:
            self.game.getMusic().setPlaylist(
                self.game.getResources().loadPlaylist(self.playlist))
            self.game.getMusic().play()

    def update(self, millis):

        self.scrollTime -= (millis / 1000.0)

        if self.scrollInterval is not None and not self.scrollInterval.isPlaying(
        ):
            self.log.debug('starting scroll interval')
            self.scrollInterval.start()

        if self.scrollInterval is None or self.scrollTime < 0:  #self.scrollInterval.isStopped():
            self.log.debug(self.scrollInterval)
            self.log.debug('stopping scrollInterval')
            self.game.quit()
#            self.game.getState().scheduleStateChange(PanoConstants.STATE_EXIT)

    def exit(self):

        FSMState.exit(self)

        if self.playlist is not None:
            self.game.getMusic().stop()

        self.game.getInput().removeMappings('credits')

        if self.displayRegion is not None:
            base.win.removeDisplayRegion(self.displayRegion)
            self.displayRegion = None

        self.camera = None

        if self.scrollInterval is not None:
            self.scrollInterval.finish()
        self.scrollInterval = None

        self.backgroundOSI.destroy()
        self.backgroundOSI = None

        self.creditsOST = None

        self.scene.removeNode()
        self.scene = None

        self.tex = None
        self.alphaMask = None

    def onInputAction(self, action):
        if action == "interrupt":
            self.log.debug('credits display interrupted')
            if self.scrollInterval is not None:
                self.scrollInterval.finish()
                self.scrollTime = -1.0
            return True
        else:
            return False

    def allowPausing(self):
        return False
Пример #11
0
class Camera(object):
    """Uses mouse controls to orbit the camera around a parent."""

    def __init__(self, game, parent):
        self.game = game

        # class properties for camera rotation
        self.heading = 0
        self.pitch = 0

        # class properties for camera zoom
        self.targetY = -6
        self.interval = None

        # find screen center
        props = base.win.getProperties()
        self.centerX = props.getXSize() / 2
        self.centerY = props.getYSize() / 2

        # constrain mouse
        base.disableMouse()  # disable default mouse camera control
        self.hideMouse()

        # set up floater
        self.floater = render.attachNewNode("floater")
        self.floater.reparentTo(parent)  # inherit position from parent, but rotation and scale from render
        self.floater.setEffect(CompassEffect.make(render, CompassEffect.P_rot | CompassEffect.P_scale))
        self.floater.setZ(1)  # distance above model

        # set up camera
        base.camera.reparentTo(self.floater)
        base.camera.setY(self.targetY)  # original distance from model
        base.camera.lookAt(self.floater)

        # camera zooming
        # TODO move into method, clamp Y value?
        base.accept("wheel_up", lambda: self.zoom(2))
        base.accept("shift-wheel_up", lambda: self.zoom(2))
        base.accept("wheel_down", lambda: self.zoom(-2))
        base.accept("shift-wheel_down", lambda: self.zoom(-2))

        # start task
        taskMgr.add(self.mouseControl, "Camera.mouseControl")

    def hideMouse(self):
        props = WindowProperties()
        props.setCursorHidden(True)
        props.setMouseMode(WindowProperties.M_relative)
        base.win.requestProperties(props)

    def showMouse(self):
        props = WindowProperties()
        props.setCursorHidden(False)
        props.setMouseMode(WindowProperties.M_absolute)
        base.win.requestProperties(props)

    def mouseControl(self, task):
        if self.game.isChatting:
            return task.cont

        md = base.win.getPointer(0)
        x = md.getX()
        y = md.getY()

        # update heading & pitch based on mouse movement from screen center
        if base.win.movePointer(0, self.centerX, self.centerY):
            self.heading -= (x - self.centerX) * 0.5
            self.pitch -= (y - self.centerY) * 0.5

        # constrain pitch
        if self.pitch < 280:
            self.pitch = 280
        if self.pitch > 360:
            self.pitch = 360

        # update floater
        self.floater.setHpr(self.heading, self.pitch, 0)

        return task.cont

    def zoom(self, amount):
        if self.game.isChatting:
            return

        self.targetY = clampScalar(self.targetY + amount, -2, -15)

        if self.interval is not None:
            self.interval.pause()
        self.interval = LerpPosInterval(
            base.camera,
            duration=0.6,
            pos=Vec3(base.camera.getX(), self.targetY, base.camera.getZ()),
            blendType="easeOut",
            name="Camera.zoom",
        )
        self.interval.start()
class LegendaryFishFSM(FishFSM):
    
    def __init__(self, fish):
        FishFSM.__init__(self, fish)
        self.defaultTransitions = {
            'Offscreen': [
                'FinalBackToSea',
                'Swimming',
                'TurnAround',
                'HookedFighting',
                'AboutToBiteLure'],
            'Swimming': [
                'TurnAround',
                'Biting',
                'AboutToBiteLure',
                'Offscreen'],
            'AboutToBiteLure': [
                'Swimming',
                'Biting',
                'Offscreen'],
            'TurnAround': [
                'AboutToBiteLure',
                'Swimming',
                'Offscreen'],
            'Biting': [
                'Swimming',
                'PullingLure',
                'Hooked',
                'Flee',
                'Offscreen'],
            'Hooked': [
                'HookedFighting',
                'PullingLure',
                'Offscreen'],
            'PullingLure': [
                'Hooked',
                'HookedFighting',
                'Flee',
                'Offscreen'],
            'HookedFighting': [
                'PullingLure',
                'Hooked',
                'Flee',
                'Offscreen'],
            'Flee': [
                'Swimming',
                'TurnAround',
                'Offscreen'],
            'FinalBackToSea': [
                'Offscreen'] }

    
    def enterAboutToBiteLure(self):
        self.fish.initVariables()
        self.fish.showStaminaBar()
        self.fish.actor.clearControlEffectWeights()
        self.fish.reparentTo(self.fish.fishManager.objectsWithCaustics)
        self.fish.setPos(FishingGlobals.rightFishBarrier + FishingGlobals.fullyOffscreenXOffset, 0.0, max(-63.0, self.fish.fishManager.gameObject.lure.getZ()))
        self.fish.actor.changeAnimationTo('swimIdleOpposite')
        self.lfChaseLureSequence = Sequence(self.fish.posInterval(self.fish.myData['swimLeftDuration'], Point3(self.fish.myData['fishTurnX'], 0.0, self.fish.getZ())), Func(self.fish.actor.changeAnimationTo, 'turnOpposite', False), Wait(self.fish.actor.getDuration('turnOpposite') / 4.0), Func(self.fish.actor.changeAnimationTo, 'swimIdle'), self.fish.posInterval(self.fish.myData['swimRightDuration'], Point3(self.fish.fishManager.gameObject.lure.getX() - self.fish.myData['biteXOffset'], 0.0, self.fish.getZ())), Func(self.request, 'Biting'), name = self.fish.fishManager.gameObject.distributedFishingSpot.uniqueName('lfChaseLureSequence'))
        self.lfChaseLureSequence.start()

    
    def exitAboutToBiteLure(self):
        self.lfChaseLureSequence.pause()
        self.lfChaseLureSequence.clearToInitial()

    
    def checkForBite(self):
        pass

    
    def enterHooked(self):
        self.fish.fishMoveSequence.pause()
        self.fish.actor.changeAnimationTo('reelIdle')

    
    def exitHooked(self):
        taskName = '%s_StartFighting' % self.fish.getName()
        taskMgr.remove(self.fish.fishManager.gameObject.distributedFishingSpot.uniqueName(taskName))
        self.fish.lfStruggleSequence.pause()
        self.fish.lfStruggleSequence.clearToInitial()

    
    def enterHookedFighting(self):
        self.fish.actor.changeAnimationTo('fightIdle')

    
    def exitHookedFighting(self):
        pass

    
    def enterPullingLure(self):
        self.fish.actor.changeAnimationTo('fightIdle')

    
    def exitPullingLure(self):
        self.fish.setY(0.0)

    
    def enterFinalBackToSea(self):
        self.fish.setPosHpr(self.fish.myData['goodbyePosHpr'][0], self.fish.myData['goodbyePosHpr'][1])
        self.fish.actor.changeAnimationTo('swimIdle')
        self.farewellInterval = LerpPosInterval(self.fish, FishingGlobals.waveToLegendaryFishDuration, pos = self.fish.myData['swimmingDistance'], startPos = self.fish.getPos(), name = '%s_farewellInterval' % self.fish.getName())
        self.farewellInterval.start()

    
    def exitFinalBackToSea(self):
        self.farewellInterval.pause()
        self.farewellInterval.clearToInitial()
Пример #13
0
 def init_menu(self):
     interval = LerpHprInterval(self.cameraPivot, 1, (0,0,0), (0,10,0))
     interval2 = LerpPosInterval(self.cameraPivot, 1, (0,0,0), (0,0,-0.05))
     interval.start()
     interval2.start()
     taskMgr.doMethodLater(1, spawnButton, "spawnButton")