86 lines
		
	
	
		
			999 B
		
	
	
	
		
			C++
		
	
	
	
		
		
			
		
	
	
			86 lines
		
	
	
		
			999 B
		
	
	
	
		
			C++
		
	
	
	
|  | #include "..\easy2d.h"
 | |||
|  | #include <assert.h>
 | |||
|  | 
 | |||
|  | Action::Action() : | |||
|  | 	m_bRunning(true), | |||
|  | 	m_bWaiting(false), | |||
|  | 	m_bEnding(false), | |||
|  | 	m_bInit(false), | |||
|  | 	m_pTargetSprite(nullptr), | |||
|  | 	m_pParentScene(nullptr) | |||
|  | { | |||
|  | 	// Ĭ<>϶<EFBFBD><CFB6><EFBFBD> 15ms <20><><EFBFBD><EFBFBD>һ<EFBFBD><D2BB>
 | |||
|  | 	setInterval(15); | |||
|  | } | |||
|  | 
 | |||
|  | Action::~Action() | |||
|  | { | |||
|  | } | |||
|  | 
 | |||
|  | bool Action::isRunning() | |||
|  | { | |||
|  | 	return m_bRunning && !m_bWaiting; | |||
|  | } | |||
|  | 
 | |||
|  | bool Action::isEnding() | |||
|  | { | |||
|  | 	return m_bEnding; | |||
|  | } | |||
|  | 
 | |||
|  | void Action::start() | |||
|  | { | |||
|  | 	m_bRunning = true; | |||
|  | } | |||
|  | 
 | |||
|  | void Action::resume() | |||
|  | { | |||
|  | 	m_bRunning = true; | |||
|  | } | |||
|  | 
 | |||
|  | void Action::pause() | |||
|  | { | |||
|  | 	m_bRunning = false; | |||
|  | } | |||
|  | 
 | |||
|  | void Action::stop() | |||
|  | { | |||
|  | 	m_bEnding = true; | |||
|  | } | |||
|  | void Action::wait() | |||
|  | { | |||
|  | 	m_bWaiting = true; | |||
|  | } | |||
|  | 
 | |||
|  | void Action::notify() | |||
|  | { | |||
|  | 	m_bWaiting = false; | |||
|  | } | |||
|  | 
 | |||
|  | void Action::setInterval(LONGLONG milliSeconds) | |||
|  | { | |||
|  | 	// <20><><EFBFBD>ö<EFBFBD><C3B6><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
 | |||
|  | 	m_nAnimationInterval = milliSeconds; | |||
|  | } | |||
|  | 
 | |||
|  | Action * Action::reverse() const | |||
|  | { | |||
|  | 	assert(0); | |||
|  | 	return nullptr; | |||
|  | } | |||
|  | 
 | |||
|  | Sprite * Action::getTarget() | |||
|  | { | |||
|  | 	return m_pTargetSprite; | |||
|  | } | |||
|  | 
 | |||
|  | void Action::_init() | |||
|  | { | |||
|  | 	m_bInit = true; | |||
|  | } | |||
|  | 
 | |||
|  | void Action::_reset() | |||
|  | { | |||
|  | 	m_bInit = false; | |||
|  | 	m_bEnding = false; | |||
|  | } |