コード例 #1
0
def afterOpenDoorState(self):
	"""
	Documentation
	"""
	pathFollow = False

	if (self.tester.detectPath()):
		start_pathFollowState(self)
		pathFollow = True

	if ( self.playStateTime(3.0) or pathFollow ):
		# close the door
		self.targetObject['open'] = False
		self.targetObject['close'] = True
		# If not detected path follow
		if (not pathFollow):
			self.rig.playWait()
			self.stopMovement()
			self.camManager.setCameraAfterDoorClose()
			self.switchState(PlayerState.IDLE_STATE)
	else:
		# play run and move of player
		moveAfterDoor(self)
コード例 #2
0
def afterOpenDoorState(self):
    """
	Documentation
	"""
    pathFollow = False

    if (self.tester.detectPath()):
        start_pathFollowState(self)
        pathFollow = True

    if (self.playStateTime(3.0) or pathFollow):
        # close the door
        self.targetObject['open'] = False
        self.targetObject['close'] = True
        # If not detected path follow
        if (not pathFollow):
            self.rig.playWait()
            self.stopMovement()
            self.camManager.setCameraAfterDoorClose()
            self.switchState(PlayerState.IDLE_STATE)
    else:
        # play run and move of player
        moveAfterDoor(self)
コード例 #3
0
def runState(self):
	#playerHUD = logic.playerHUD
	# get forward force
	forward_force = self.getForwardForce()

	# If detect enemy damage
	if (self.tester.detectEnemyDamage()):
		start_hitState(self)
		return

	# If detect water
	if (self.tester.detectWater()):
		# stop orientation
		self.orientManager.stopOrientation(self)
		# start swim state
		start_swimState(self)
		# cancel method
	else:
		# if touch the ground ( else callback )
		if ( self.respectGroundRule(end_runState) ):
			# if arrow key is pressed
			if ( forward_force != 0.0 ):
				# set action hud text
				#logic.playerHUD.changeActionText('Roll')
				if (self.tester.detectPath()):
				 	start_pathFollowState(self)
				# if push to action key
				elif (self.gamepad.isActionPressed()):
				# NEXT STATE : ROLL
					# stop orientation
					self.orientManager.stopOrientation(self)
					# start roll
					start_rollState(self)
					# switch roll state
					self.switchState(PlayerState.ROLL_STATE)
				else:
					# run force
					if ( runForce(self, forward_force) ):
						# play run animation
						self.rig.playRun()
						frame = self.rig.getActionFrame(1)
						#if (frame <= 1):
							# PlayerEffect.addEffectFrame(frame, [4, 11], PlayerEffect.addGrassEffect())
						# play with step sounds
						self.audio.playStepSound(frame, [4, 11])
					else:
						# go to walk
						self.switchState(PlayerState.WALK_STATE)
					# active orientation movement
					self.orientManager.orient_player(self)
			# else not movement go idle state
			else:
				# reset hud action text
				#logic.playerHUD.resetActionText()
				# stop orientation
				self.rig.stopArmLayer()
				self.orientManager.stopOrientation(self)
				# go to idle state
				self.switchState(PlayerState.IDLE_STATE)
		# if dont touch the ground go to jump state
		else:
			# reset hud action text
			#logic.playerHUD.resetActionText()
			# stop orientation
			self.orientManager.stopOrientation(self)
			# go to idle state
			self.switchState(PlayerState.JUMP_STATE)
コード例 #4
0
def runState(self):
    #playerHUD = logic.playerHUD
    # get forward force
    forward_force = self.getForwardForce()

    # If detect enemy damage
    if (self.tester.detectEnemyDamage()):
        start_hitState(self)
        return

    # If detect water
    if (self.tester.detectWater()):
        # stop orientation
        self.orientManager.stopOrientation(self)
        # start swim state
        start_swimState(self)
        # cancel method
    else:
        # if touch the ground ( else callback )
        if (self.respectGroundRule(end_runState)):
            # if arrow key is pressed
            if (forward_force != 0.0):
                # set action hud text
                #logic.playerHUD.changeActionText('Roll')
                if (self.tester.detectPath()):
                    start_pathFollowState(self)
                # if push to action key
                elif (self.gamepad.isActionPressed()):
                    # NEXT STATE : ROLL
                    # stop orientation
                    self.orientManager.stopOrientation(self)
                    # start roll
                    start_rollState(self)
                    # switch roll state
                    self.switchState(PlayerState.ROLL_STATE)
                else:
                    # run force
                    if (runForce(self, forward_force)):
                        # play run animation
                        self.rig.playRun()
                        frame = self.rig.getActionFrame(1)
                        #if (frame <= 1):
                        # PlayerEffect.addEffectFrame(frame, [4, 11], PlayerEffect.addGrassEffect())
                        # play with step sounds
                        self.audio.playStepSound(frame, [4, 11])
                    else:
                        # go to walk
                        self.switchState(PlayerState.WALK_STATE)
                    # active orientation movement
                    self.orientManager.orient_player(self)
            # else not movement go idle state
            else:
                # reset hud action text
                #logic.playerHUD.resetActionText()
                # stop orientation
                self.rig.stopArmLayer()
                self.orientManager.stopOrientation(self)
                # go to idle state
                self.switchState(PlayerState.IDLE_STATE)
        # if dont touch the ground go to jump state
        else:
            # reset hud action text
            #logic.playerHUD.resetActionText()
            # stop orientation
            self.orientManager.stopOrientation(self)
            # go to idle state
            self.switchState(PlayerState.JUMP_STATE)