예제 #1
0
파일: launcher.cpp 프로젝트: sorokin/btanks
void Launcher::tick(const float dt) {
	Object::tick(dt);
	if (!playing_sound("vehicle-sound")) {
		play_sound("vehicle-sound", true, 0.4f);
	}

	bool fire_possible = _fire.tick(dt);
	
	if (get_state().empty()) {
		play("hold", true);
		group_emit("mod", "hold");
	}

	if (_velocity.is0()) {	
		cancel_repeatable();
		play("hold", true);
		group_emit("mod", "hold");
	} else {
		if (get_state() == "hold") {
			cancel_all();
			//play("start", false);
			play("move", true);
			group_emit("mod", "move");
		}
	}

	if (_state.fire && fire_possible) {
		_fire.reset();
		group_emit("mod", "launch");
	}
	if (_state.alt_fire && fire_possible) {
		_fire.reset();
		group_emit("alt-mod", "launch");
	}
}
예제 #2
0
void CUITalkWnd::Update()
{
	//остановить разговор, если нужно
	if (g_actor && m_pActor && !m_pActor->IsTalking() )
	{
		StopTalk();
	}else{
		CGameObject* pOurGO = smart_cast<CGameObject*>(m_pOurInvOwner);
		CGameObject* pOtherGO = smart_cast<CGameObject*>(m_pOthersInvOwner);
	
		if(	NULL==pOurGO || NULL==pOtherGO )
			Game().StartStopMenu(this,true);
	}

	if(m_bNeedToUpdateQuestions)
	{
		UpdateQuestions			();
	}
	inherited::Update			();
	UpdateCameraDirection		(smart_cast<CGameObject*>(m_pOthersInvOwner));

	UITalkDialogWnd->UpdateButtonsLayout(b_disable_break, m_pOthersInvOwner->IsTradeEnabled());

	if(playing_sound())
	{
		CGameObject* pOtherGO	= smart_cast<CGameObject*>(m_pOthersInvOwner);
		Fvector P				= pOtherGO->Position();
		P.y						+= 1.8f;
		m_sound.set_position	(P);
	}
}
예제 #3
0
void Submarine::tick(const float dt) {
	Object::tick(dt);

	if (!playing_sound("submarine")) {
		play_sound("submarine", true);
	}

	if (get_state().empty()) {
		_wakeup.set(mrt::random(5) + 5);
		play("hold", true);
	}
	if (_wakeup.tick(dt)) {
		//LOG_DEBUG(("waking up..."));
		spawnBallistic();
		_wakeup.set(3600);
		
		cancel_all();
		play("fade-in", false);
		int n = mrt::random(3) + 3;
		for(int i = 0; i < n; ++i) {
			play("main", false);
		}

		play("fade-out", false);
	}
}