37 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			C#
		
	
	
	
	
	
			
		
		
	
	
			37 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			C#
		
	
	
	
	
	
| // local LevelRabbitRole = {}
 | |
| 
 | |
| // function LevelRabbitRole:ctor()
 | |
| //     self.last_animation = "back/move"
 | |
| // end
 | |
| 
 | |
| // function LevelRabbitRole:ReceiveBeginPlay()
 | |
| // 	self["SpineAnimationComponent"]:SetSkin("back/move")
 | |
| // 	self["SpineAnimationComponent"]:SetAnimation(0, "animation", true)
 | |
| // end
 | |
| 
 | |
| 
 | |
| // function LevelRabbitRole:OnMove(location)
 | |
| //     -- 控制器移动相应函数
 | |
| //     self["MovementComponent"]:MoveTo(location)
 | |
| // end
 | |
| 
 | |
| 
 | |
| // function LevelRabbitRole:OnMoveDirectionChanged(InDirection)
 | |
| //     -- 运动组件更新方向响应函数
 | |
| //     local cur_animation
 | |
| //     if(InDirection.Y >= 0) then
 | |
| //         cur_animation = "front/move"
 | |
| //     else
 | |
| //         cur_animation = "back/move"
 | |
| //     end
 | |
| //     print("LevelRabbitRole:OnMoveDirectionChanged", cur_animation)
 | |
| //     if cur_animation ~= self.last_animation then
 | |
| //         self["SpineAnimationComponent"]:SetSkin(cur_animation)
 | |
| //         self["SpineAnimationComponent"]:SetSlotsToSetupPose()
 | |
| //         self.last_animation = cur_animation
 | |
| //     end
 | |
| // end
 | |
| 
 | |
| 
 | |
| // return Class(nil, nil, LevelRabbitRole)
 |