コード例 #1
0
def fallState(self):
    # If detect water
    if (self.tester.detectWater()):
        # reset
        self.fallTime = 0.0
        # stop orientation
        self.orientManager.stopOrientation(self)
        # start water
        start_swimState(self)
        # cancel method
        return

    # if touch the ground
    ground, point, normal = self.tester.groundRay()
    if (ground and self.fallTime > 0.3):
        # set grounded
        self.grounded = True
        # reset fall time
        self.fallTime = 0.0
        # go to land state
        # play land
        self.rig.playLowLand()
        self.switchState(PlayerState.LAND_STATE)
    else:
        # if detect the ledge and ledgeCanceled not true
        if (self.tester.detectLedge() and not self.ledgeCanceled):
            # do ledge
            self.fallTime = 0.0
            # go to ledge state
            start_beginGrapLedgeState(self)
        else:
            if (self.linearVelocity[2] < 0.0):
                # play fall anim
                self.rig.playFallDown()
            # fall control
            fallControl(self)
            # incrmeent tim
            self.fallTime += 0.1
コード例 #2
0
def fallState(self):
	# If detect water
	if (self.tester.detectWater()):
		# reset
		self.fallTime = 0.0
		# stop orientation
		self.orientManager.stopOrientation(self)
		# start water
		start_swimState(self)
		# cancel method
		return

	# if touch the ground
	ground, point, normal = self.tester.groundRay()
	if (ground and self.fallTime > 0.3):
		# set grounded
		self.grounded = True
		# reset fall time
		self.fallTime = 0.0
		# go to land state
		# play land
		self.rig.playLowLand()
		self.switchState(PlayerState.LAND_STATE)
	else:
		# if detect the ledge and ledgeCanceled not true
		if (self.tester.detectLedge() and not self.ledgeCanceled):
			# do ledge
			self.fallTime = 0.0
			# go to ledge state
			start_beginGrapLedgeState(self)
		else:
			if (self.linearVelocity[2] < 0.0):
				# play fall anim
				self.rig.playFallDown()
			# fall control
			fallControl(self)
			# incrmeent tim
			self.fallTime += 0.1
コード例 #3
0
def waitSwimState(self):
	# stop move
	self.stopMovement()
	# get forward force
	forward_force = self.getForwardForce()

	# past player to water
	toWaterPos(self)

	# if move go to forward swim state
	if (forward_force != 0):
		self.switchState(PlayerState.FORWARD_SWIM_STATE)
	else:
		# if detect ground ledge
		if ( self.tester.detectLedgeGround() and self.tester.detectLedge() ):
			if ( self.gamepad.isActionPressed() ):
				# deactivate water
				self.onWater = False
				# start climlb ledge
				start_beginGrapLedgeState(self)
				# cancel this method
				return
		# play animation
		self.rig.playSwimIdle()