Пример #1
0
void Thief::Update(float dt)
{
	if(!_canUpdate)
	{
		return;
	}
	if(_currentAnimation && !_currentAnimation->IsLastFrame())
	{
		if(_timer < 0.f) {
			//Пауза для проигрыша текущей установленной анимации
			_timer += dt;
		} else {
			_timer = math::clamp(0.f, 1.f, _timer + dt/0.5f);
			FPoint offset = math::lerp(_offset0, _offset1, math::clamp(0.f, 1.f, (_timer- 0.2f)/0.6f));
			_currentAnimation->SetHotSpot(-offset.x, -offset.y);
			_currentAnimation->Update(dt);
		}
	}else{
		if(_anim_name == "thief_turnback") {
			_turned = false; //Вор полностью повернулся
		} else if(_anim_name == "thief_turn") {
			_turned = true; //Вор полностью повернулся
		}
		if(_anim_name.substr(0, 10) == "thief_jump")
		{
			_countNear = 0;
		}
		if(_anim_name == "thief_hide")
		{
			_timer = 0.f;
			_isKilled = true;
			_currentAnimation = NULL;
			_queueAnim.clear();
		}
		else if(!_queueAnim.empty())
		{
			AnimInfo &info(_queueAnim.front());
			Game::AnimRes &res = Game::ANIM_RESOURCES[info.name];
			if(!res.can_turn && res.mirror != _turned)
			{
				//Нужно проиграть анимацию поворотаf 
				if(_turned){
					RunAnimation("thief_turnback", 0.f, info.offset );
				}else{
					RunAnimation("thief_turn", 0.f, info.offset);
				}
			}
			else
			{
				RunAnimation(info.name, info.pause, info.offset);
				_queueAnim.pop_front();
			}
		}
		else
		{
			RunAnimation("thief_stay", math::random(0.f, 5.f));
		}
	}
}
Пример #2
0
static void ApplyAnimation(clientInfo_t &ci, animState_t &as, entity_t &ent)
{
	RunAnimation(ci, as);

	ent.oldframe = as.oldFrame;
	ent.frame    = as.frame;
	ent.backlerp = (as.time > as.oldTime) ? 1.0f - (float)(curTime - as.oldTime) / (as.time - as.oldTime) : 0;
//	RE_DrawTextLeft(va("frm: %d -> %d %g\nold:%d new:%d curr:%d",ent.oldframe, ent.frame, ent.backlerp,as.oldTime,as.time,curTime));
}
Пример #3
0
void Thief::Appear()
{
	_queueAnim.clear();
	RunAnimation("thief_appear");
	_canUpdate = true;
	if(EditorUtils::editor && _currentAnimation)
	{
		_currentAnimation->Update(4.f);
	}
}
Пример #4
0
// Ready
void Ready::ReadyRun()
{
	RunAnimation();

	x -= READY::MOVE_SPEED;
	if( x <= READY::END_X ){
		state = STATE::GO_BIGGER;
		se->Stop("ドン", 0);
		m_animeGO->Action();

		// ピー
		se->Play("GO");
	}
}