void LevelEndEffect::Update(float dt) { local_time += time_scale * dt; float t = math::clamp(0.0f, 1.0f, local_time); //FPoint pos = _path.getGlobalFrame(t); float x = _pathX.getGlobalFrame(t); float y = _pathY.getGlobalFrame(t); _effect->SetPos(x, y); if( local_time > 1.0f ) { _effect->Finish(); _effect.reset(); ParticleEffect *fallEff = gameField->_effContUp.AddEffect("EndLevel_Fall"); fallEff->SetPos(320.0f, 900.0f); fallEff->Reset(); ParticleEffect *expEff = gameField->_effContUp.AddEffect("EndLevel_Explode"); expEff->SetPos(320.0f, 700.0f); expEff->Reset(); gameField->TriggerBonusesFromMoves(); } }
bool EnergyReceiver::AcceptMessage(const Message &message) { if(message.is("DestroyFinished")) { if(message.getData() == _uid) { if(_state == ER_ACTIVATED_BREAK) { _state = ER_ACTIVATED_BREAK_FINISHFLY; } else { Assert(false); } return true; }else{ //На остальных приемниках запускаем акцентирующий эффект реакции на прилет другого приемника в лут if(!IsOrdered() && !IsActivatedByEnergy()) { ParticleEffect *eff = 0; eff = _effContUp.AddEffect("RecOnLoot"); eff->SetPos(FPoint(0.0f, 0.0f)); eff->Reset(); } return false; } } else if(message.is("JumpFinished", _uid)) { ReleaseSquares(); Match3::RunFallColumn(GetIndex().x); } else if(message.is("Start")) { if(_order) { _order->InitAppear(100.f, 100.f); } ReleaseEffects(); if(message.getData() == "from_tutorial") { _localTime = -GameSettings::gamefield[_index]->_flySquarePauseStore; }else{ _localTime = -gameInfo.getConstFloat("CRISTAL_DELAY_APPEAR_ON_RECIVER", 0.f); } ParticleEffect *eff1 = _effContDown.AddEffect("RDown"); eff1->SetPos(FPoint(0.0f, 0.0f)); _partUp = _effContUpStatic.AddEffect("RUp"); _partUp->SetPos(FPoint(0.0f, 0.0f)); _partUp->Reset(); _firstShowed = false; _lockLiveEffectShowed = false; _timeAppear = -0.2f; _timerForAppearOrder = -1.f; _state = ER_APPEAR; _hideByThief = false; } return false; }
void LockBarrierBase::InitCell() { Game::Square *cell = Game::GetValidSquare(_pos.x, _pos.y); cell->Reset(); cell->SetStone(false); cell->ice = false; cell->SetFake(true); cell->SetWall(1); cell->GetChip().Reset(true); cell->barrierIndex = 1; _effectCont.KillAllEffects(); ParticleEffect* eff = _effectCont.AddEffect("LockLive"); eff->SetPos(FPoint(0.f, LockBarrierBase::YOffset_LOCK)); eff->Reset(); eff->Update(100.f); _effectCont.Update(0.f); }
void EnergyReceiver::Update(float dt) { if( _state == ER_INIT || !GameSettings::gamefield[_index]->IsFlyType(Game::Square::FLY_STAY)) { return; } _localTime += dt; if(_localTime < 0) { return; } _fly_offset_y = 6.0f * math::sin(_localTime * 1.2f); float t = math::clamp(0.f, 1.f, _timeAppear); float ampl = math::clamp(0.f, 1.f, (1.f - _timeAppear/4.f)); ampl = 60.0f * ampl * ampl; //Очень быстрое затухание _fly_offset_y += -40.f * (1.0f - t) + ampl * math::sin(_timeAppear*math::PI - math::PI*0.5f); _fly_offset_y *= GameSettings::SQUARE_SCALE; if(_hideByThief) { if(_hideByThiefTime < 0) { _hideByThiefTime += dt; } else if(_hideByThiefTime < 1) { _hideByThiefTime += dt*1.5f; if(_hideByThiefTime >= 1) { _hideByThiefTime = 1.F; } } } if(_firstShowed) { if(_timeAppear < 0) { _timeAppear += dt; } else { _timeAppear += dt*1.5f; } if(_timeAppear >= 1.f && _state == ER_APPEAR) { //_timeAppear = 1.f; _state = ER_STAND; } } if(!_firstShowed && Game::activeRect.Inflated(1).Contains(GetIndex())) { _firstShowed = true; //Акцентирующий эффект при первом появлении на экране ParticleEffect *eff2 = 0; if(IsOrdered()) { eff2 = _effectCellCont.AddEffect("RecStartAccentLock"); } else { eff2 = _effectCellCont.AddEffect("RecStartAccent"); } eff2->SetPos(FPoint(0.0f, 0.0f)); eff2->Reset(); MM::manager.PlaySample("ReceiverShow"); _timerForAppearOrder = gameInfo.getConstFloat("ShowOrderOnRecDelay", 3.f); } if(!IsOrdered()) { _timerForAppearOrder = 0.f; } else if(_timerForAppearOrder > -1) { if(_timerForAppearOrder > 0) { _timerForAppearOrder -= dt; }else{ _timerForAppearOrder -= dt*7.f; } if(_timerForAppearOrder <= 0.5f) { if(IsOrdered() && !_lockLiveEffectShowed) { ParticleEffect* eff = _effectCellCont.AddEffect("LockLive"); eff->SetPos(FPoint(0.f, LockBarrierBase::YOffset_LOCK)); eff->Reset(); _effectCellCont.Update(0.f); _order->InitAppear(0.8f, 0.7f); _lockLiveEffectShowed = true; MM::manager.PlaySample("ReceiverOrderAppear"); } } if(_timerForAppearOrder < -1) { _timerForAppearOrder = -1; } } if(_order) { _order->Update(dt); if(!IsOrdered()) //Все больше не залочены { SetOrder(Game::Order::HardPtr()); Energy::field.UpdateSquare(Game::FieldAddress(GetIndex())); _effectCellCont.KillAllEffects(); Game::AddController(new FlashAnimationPlayer(Game::ANIM_RESOURCES["LockBreak"], FPoint(GetIndex())*GameSettings::SQUARE_SIDEF + FPoint(0.f, LockBarrierBase::YOffset_LOCK), FlashAnimationPlayer::DRAW_UP)); MM::manager.PlaySample("ReceiverOrderComplete"); } } _effectCellCont.Update(dt); _effContUpStatic.Update(dt); _effContUp.Update(dt); _effContDown.Update(dt); if(_crystalAnim.get()) { if(_state == ER_STAND) { _crystalAnim->Update(dt*_crystalTimeScale); }else if(_state == ER_ACTIVATED_BREAK){ Receiver::ReceiverEffect::keep_camera = true; //_crystalTime += dt*_crystalTimeScale; //if(_crystalTime >= 1) //{ // _crystalTime = 1.f; // _crystalAnim.reset(); // Game::AddController(new Receiver::ReceiverEffect(FPoint(GetIndex())*GameSettings::SQUARE_SIDEF + FPoint(0.f, _fly_offset_y * GameSettings::SQUARE_SCALE), _uid)); // ParticleEffectPtr eff = Game::AddEffect(GameField::Get()->_effCont, "RecBreak"); // eff->SetPos(GetCenterPos()); // eff->Reset(); // ParticleEffectPtr eff2 = Game::AddEffect(GameField::Get()->_effTopCont, "RecBreak_2"); // eff2->SetPos(GetCenterPos()); // eff2->Reset(); //}else{ // int frames_count = _crystalAnim->GetLastPlayedFrame() - _crystalAnim->GetFirstPlayedFrame(); // float t = math::ease(_crystalTime, 0.f, 1.f); // int frame = _crystalAnim->GetFirstPlayedFrame() + (math::lerp(_frame1, _frame2, t) % frames_count); // _crystalAnim->SetCurrentFrame(frame); //} } } //if(!HasOrder() && _state <= ER_ACTIVATED_BREAK) //{ // if(_timerLight > 0) // { // _timerLight -= dt; // if(_timerLight < 0) // { // ParticleEffect *eff = _effContUp.AddEffect("RecLight"); // eff->SetPos(FPoint(0.0f, 0.0f)); // eff->Reset(); // _timerLight = math::random(10.f, 30.f); // } // } //} if(_timerForRunChipFall >= 0) { _timerForRunChipFall -= dt; if(_timerForRunChipFall <= 0) { Gadgets::receivers.AcceptMessage(Message("JumpFinished", _uid)); _timerForRunChipFall = -1.f; } } }