54 lines
		
	
	
		
			1.6 KiB
		
	
	
	
		
			C#
		
	
	
	
	
	
		
		
			
		
	
	
			54 lines
		
	
	
		
			1.6 KiB
		
	
	
	
		
			C#
		
	
	
	
	
	
|  | // local LevelFoxRole = {} | ||
|  | // local Vector2D = require("Utils.Vector2D") | ||
|  | 
 | ||
|  | // function LevelFoxRole:ctor() | ||
|  | 
 | ||
|  | // end | ||
|  | 
 | ||
|  | // function LevelFoxRole:ReceiveBeginPlay() | ||
|  | // 	self["SpineAnimationComponent"]:SetAnimation(0, "Idle/Front", true) | ||
|  | //     self.last_animation = "Idle/Front" | ||
|  | 
 | ||
|  | //     self["SpineBoneFollower"].Target = self | ||
|  | //     self["SpineBoneFollower"].BoneName = "tail" | ||
|  | //     self["SpineBoneFollower"].UseComponentTransform = true | ||
|  | //     self["SpineBoneFollower"].UseScale = true | ||
|  | 
 | ||
|  | //     self["TailCollision"]:SetCollisionEnabled(0) | ||
|  | // end | ||
|  | 
 | ||
|  | 
 | ||
|  | // function LevelFoxRole:OnMoveDirectionChanged(InDirection) | ||
|  | //     -- 运动组件更新方向响应函数 | ||
|  | //     local cur_animation | ||
|  | //     if Vector2D.Equals(InDirection, Vector2D.Zero) then -- Idle的情况 | ||
|  | //         local forward_direction = self["MovementComponent"]:GetForwardDirection() | ||
|  | //         if(forward_direction.Y >= 0) then | ||
|  | //             cur_animation = "Idle/Front" | ||
|  | //         else | ||
|  | //             cur_animation = "Idle/Back" | ||
|  | //         end | ||
|  | //     else | ||
|  | //         if(InDirection.Y >= 0) then | ||
|  | //             cur_animation = "Move/Front" | ||
|  | //         else | ||
|  | //             cur_animation = "Move/Back" | ||
|  | //         end | ||
|  | //     end | ||
|  | //     if cur_animation ~= self.last_animation then | ||
|  | //         self["SpineAnimationComponent"]:SetAnimation(0, cur_animation, true) | ||
|  | //         self.last_animation = cur_animation | ||
|  | //     end | ||
|  | 
 | ||
|  | //     self["SpineAnimationComponent"]:SetTimeScale(1.0) | ||
|  | // end | ||
|  | 
 | ||
|  | 
 | ||
|  | // function LevelFoxRole:OnMove(location) | ||
|  | //     -- 控制器移动相应函数 | ||
|  | //     self["MovementComponent"]:MoveTo(location) | ||
|  | // end | ||
|  | 
 | ||
|  | 
 | ||
|  | 
 | ||
|  | // return Class(nil, nil, LevelFoxRole) |