You cannot select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
	
	
		
			42 lines
		
	
	
		
			968 B
		
	
	
	
		
			C#
		
	
			
		
		
	
	
			42 lines
		
	
	
		
			968 B
		
	
	
	
		
			C#
		
	
| using Entitas;
 | |
| using UnityEngine;
 | |
| 
 | |
| [Game]
 | |
| public class PauseComponent : IComponent
 | |
| {
 | |
|     public bool _isPause;
 | |
| 
 | |
|     public bool IsPause
 | |
|     {
 | |
|         get => _isPause;
 | |
|         set => _isPause = value;
 | |
|     }
 | |
| 
 | |
|     public int PausePreFrame = 0; //暂停需要延迟
 | |
|     public float PauseTime = 0;
 | |
|     public Vector3 VelocityCache;
 | |
|     public float AnimeSpeedCache;
 | |
| }
 | |
| 
 | |
| namespace Game
 | |
| {
 | |
|     public abstract partial class Util
 | |
|     {
 | |
|         public static bool IsPause(GameEntity entity)
 | |
|         {
 | |
|             if (!entity.hasPause)
 | |
|             {
 | |
|                 return false;
 | |
|             }
 | |
| 
 | |
|             return entity.pause.IsPause || entity.pause.PausePreFrame > 0;
 | |
|         }
 | |
| 
 | |
|         public static void EntityPause(GameEntity entity, float pauseTime, bool isTarget = true)
 | |
|         {
 | |
|             entity.pause.PauseTime = pauseTime;
 | |
|             entity.pause.PausePreFrame = 1;
 | |
|             EntityStopMove(entity.ID());
 | |
|         }
 | |
|     }
 | |
| } |