bool TouchInputHandler::handleImpl(GdkEvent* event) { XOJ_CHECK_TYPE(TouchInputHandler); GdkEventSequence* sequence = gdk_event_get_event_sequence(event); // Disallow multitouch if (this->currentSequence && this->currentSequence != sequence) { return false; } if (event->type == GDK_TOUCH_BEGIN && this->currentSequence == nullptr) { this->currentSequence = sequence; actionStart(event); } if (event->type == GDK_TOUCH_UPDATE) { actionMotion(event); } if (event->type == GDK_TOUCH_END || event->type == GDK_TOUCH_CANCEL) { actionEnd(event); this->currentSequence = nullptr; } return false; }
QList < QVariantHash > yandexnarodPlugin::getContactMenuParam() { QList < QVariantHash > list; QVariantHash hash; hash["icon"] = QVariant(QString("yandexnarod/logo")); hash["name"] = QVariant(tr("Send file via Yandex Narod")); hash["reciver"] = qVariantFromValue(qobject_cast<QObject *>(this)); hash["slot"] = QVariant(SLOT(actionStart())); list.append(hash); return list; }
void PNPActionServer::goalCallback(PNPAS::GoalHandle gh){ boost::mutex::scoped_lock lock(state_mutex); current_gh = gh; goal = *current_gh.getGoal(); // Run action (wait until it finishes) //ROS_INFO_STREAM("### Received Goal: " << goal.id << " " << goal.name << " " << // goal.params << " " << goal.function); if (goal.function=="start") { ROS_DEBUG_STREAM("Starting action " << goal.robotname << " " << goal.name << " " << goal.params); current_gh.setAccepted(); actionStart(goal.robotname, goal.name, goal.params); boost::thread t( boost::bind(&PNPActionServer::ActionExecutionThread, this, _1), current_gh); } else if (goal.function=="end") { ROS_DEBUG_STREAM("Terminating action " << goal.robotname << " " << goal.name << " " << goal.params); actionEnd(goal.robotname, goal.name, goal.params); CancelAction(goal.robotname,goal.name,goal.params); current_gh.setAccepted(); for (int k=0; k<3; k++) { ros::spinOnce(); } // boost::this_thread::sleep(boost::posix_time::milliseconds(200)); current_gh.setSucceeded(); } else if (goal.function=="interrupt") { ROS_DEBUG_STREAM("Interrupting action " << goal.robotname << " " << goal.name << " " << goal.params); actionInterrupt(goal.robotname, goal.name, goal.params); CancelAction(goal.robotname,goal.name,goal.params); current_gh.setAccepted(); for (int k=0; k<3; k++) { ros::spinOnce(); } //boost::this_thread::sleep(boost::posix_time::milliseconds(200)); current_gh.setSucceeded(); } // wait for actual delivery... for (int k=0; k<5; k++) { ros::spinOnce(); } // boost::this_thread::sleep(boost::posix_time::milliseconds(1000)); }
void Karillin::changeState(artemis::Entity &e){ StateComponent* state = (StateComponent*)e.getComponent<StateComponent>(); CharacterInfoComponent* characterInfo = (CharacterInfoComponent*)e.getComponent<CharacterInfoComponent>(); SkeletonComponent* characterSkeleton = (SkeletonComponent*)e.getComponent<SkeletonComponent>(); if (state->state == R::CharacterState::ATTACK){ PosComponent* position = (PosComponent*)e.getComponent<PosComponent>(); AttackComponent* attackComponent = new AttackComponent(); attackComponent->whoAttack = ((CharacterTypeComponent*)e.getComponent<CharacterTypeComponent>())->type; attackComponent->type = state->attack; attackComponent->powerOfAttack = characterInfo->NORMAL_SKILL_POWER; if (state->attack == R::Attack::KARILLIN_BEAT1){ actionBeat1(e, state->direction); attackComponent->minX = position->x - 40; attackComponent->maxX = position->x + 40; attackComponent->minY = position->y - 80; attackComponent->maxY = position->y + 80; } else if (state->attack == R::Attack::KARILLIN_BEAT2){ actionBeat2(e, state->direction); attackComponent->minX = position->x - 60; attackComponent->maxX = position->x + 60; attackComponent->minY = position->y - 80; attackComponent->maxY = position->y + 80; } else if (state->attack == R::Attack::KARILLIN_BEAT3){ actionBeat3(e, state->direction); attackComponent->minX = position->x - 60; attackComponent->maxX = position->x + 60; attackComponent->minY = position->y - 40; attackComponent->maxY = position->y + 140; } else if (state->attack == R::Attack::KARILLIN_PUNCH1){ actionPunch1(e, state->direction); Node* node = RenderLayer::getInstance()->createGameNode(); node->setPosition(Vec2(position->x, position->y)); node->setScale(.2f); KameKameHa* kame = new KameKameHa(node,R::CharacterType::KARILLIN); kame->setTarget("goku"); kame->powerOfAttack = characterInfo->SPECIAL_SKILL_POWER; kame->direction = (characterSkeleton->node->getScaleX() < 0) ? -1 : 1; artemis::Entity &entity = EntityUtils::getInstance()->getWorld()->createEntity(); entity.addComponent(new SkillComponent(kame)); entity.refresh(); entity.setGroup("enemyattack"); characterInfo->power -= 40; return; } else if (state->attack == R::Attack::KARILLIN_PUNCH2){ actionPunch2(e, state->direction); attackComponent->minX = position->x - 80; attackComponent->maxX = position->x + 80; attackComponent->minY = position->y - 120; attackComponent->maxY = position->y + 120; } else if (state->attack == R::Attack::KARILLIN_KICK1){ actionKick1(e, state->direction); attackComponent->minX = position->x - 30; attackComponent->maxX = position->x + 30; attackComponent->minY = position->y - 30; attackComponent->maxY = position->y + 30; } else if (state->attack == R::Attack::KARILLIN_KICK2){ actionKick2(e, state->direction); attackComponent->minX = position->x - 30; attackComponent->maxX = position->x + 30; attackComponent->minY = position->y - 40; attackComponent->maxY = position->y + 60; } else if (state->attack == R::Attack::KARILLIN_KICK3){ actionKick3(e, state->direction); attackComponent->minX = position->x - 30; attackComponent->maxX = position->x + 30; attackComponent->minY = position->y - 40; attackComponent->maxY = position->y + 60; } if (R::Constants::soundEnable){ CocosDenshion::SimpleAudioEngine::getInstance()->setEffectsVolume(R::Constants::soundVolumn); CocosDenshion::SimpleAudioEngine::getInstance()->playEffect(R::Constants::ENEMY_ATTACK, false, 1, 0, 1); } EntityUtils::getInstance()->createAttackEntity(e, attackComponent); state->state == R::CharacterState::STAND; } else if (state->state == R::CharacterState::DEFENSE){ EntityUtils::getInstance()->removeGroup("enemyattack"); if (R::Constants::soundEnable){ CocosDenshion::SimpleAudioEngine::getInstance()->setEffectsVolume(R::Constants::soundVolumn); CocosDenshion::SimpleAudioEngine::getInstance()->playEffect(R::Constants::PUNCH, false, 1, 0, 1); } if (state->defense == R::Defense::TRUNG_DON) actionTrungDon(e, state->direction); if (state->defense == R::Defense::TRUNG_DON_NGA) actionTrungDonNga(e, state->direction); } else if (state->state == R::CharacterState::WIN){ actionVictory(e); } else if (state->state == R::CharacterState::DIE){ EntityUtils::getInstance()->removeGroup("enemyattack"); if (R::Constants::soundEnable){ CocosDenshion::SimpleAudioEngine::getInstance()->setEffectsVolume(R::Constants::soundVolumn); CocosDenshion::SimpleAudioEngine::getInstance()->playEffect(R::Constants::ENEMY_DEATH, false, 1, 0, 1); } actionDie(e, state->direction); } else if (state->state == R::CharacterState::START){ actionStart(e, state->direction); } else if (state->state == R::CharacterState::STAND){ actionStand(e); } else if (state->state == R::CharacterState::STAND_UP){ actionStandUp(e); } else if (state->state == R::CharacterState::LEFT){ actionMove(e, R::Direction::LEFT); } else if (state->state == R::CharacterState::RIGHT){ actionMove(e, R::Direction::RIGHT); } else if (state->state == R::CharacterState::WALK_RIGHT){ actionMoveOn(e, R::Direction::RIGHT); } else if (state->state == R::CharacterState::WALK_LEFT){ actionMoveOn(e, R::Direction::LEFT); } else if (state->state == R::CharacterState::JUMP){ actionJump1(e, R::Direction::AUTO); } }
PropertiesPalette_XYZ::PropertiesPalette_XYZ( QWidget* parent) : QWidget(parent) { m_ScMW=0; m_doc=0; m_haveDoc = false; m_haveItem = false; m_lineMode = false; m_oldRotation = 0; m_unitRatio = 1.0; setupUi(this); setSizePolicy( QSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum)); _userActionOn = false; userActionSniffer = new UserActionSniffer(this); connect(userActionSniffer, SIGNAL(actionStart()), this, SLOT(spinboxStartUserAction())); connect(userActionSniffer, SIGNAL(actionEnd()), this, SLOT(spinboxFinishUserAction())); nameEdit->setFocusPolicy(Qt::ClickFocus); installSniffer(xposSpin); installSniffer(yposSpin); installSniffer(widthSpin); installSniffer(heightSpin); xposLabel->setBuddy(xposSpin); yposLabel->setBuddy(yposSpin); widthLabel->setBuddy(widthSpin); heightLabel->setBuddy(heightSpin); keepFrameWHRatioButton->setCheckable( true ); keepFrameWHRatioButton->setAutoRaise( true ); keepFrameWHRatioButton->setMaximumSize( QSize( 15, 32767 ) ); keepFrameWHRatioButton->setChecked(false); rotationSpin->setWrapping( true ); installSniffer(rotationSpin); rotationSpin->setNewUnit(6); rotationLabel->setBuddy(rotationSpin); levelUp->setIcon(QIcon(loadIcon("16/go-up.png"))); levelDown->setIcon(QIcon(loadIcon("16/go-down.png"))); levelTop->setIcon(QIcon(loadIcon("16/go-top.png"))); levelBottom->setIcon(QIcon(loadIcon("16/go-bottom.png"))); levelLabel->setAlignment( Qt::AlignCenter ); doGroup->setIcon(QIcon(loadIcon("group.png"))); doUnGroup->setIcon(QIcon(loadIcon("ungroup.png"))); flipH->setIcon(QIcon(loadIcon("16/flip-object-horizontal.png"))); flipH->setCheckable( true ); flipV->setIcon(QIcon(loadIcon("16/flip-object-vertical.png"))); flipV->setCheckable( true ); doLock->setCheckable( true ); QIcon a = QIcon(); a.addPixmap(loadIcon("16/lock.png"), QIcon::Normal, QIcon::On); a.addPixmap(loadIcon("16/lock-unlocked.png"), QIcon::Normal, QIcon::Off); doLock->setIcon(a); noPrint->setCheckable( true ); QIcon a2 = QIcon(); a2.addPixmap(loadIcon("NoPrint.png"), QIcon::Normal, QIcon::On); a2.addPixmap(loadIcon("16/document-print.png"), QIcon::Normal, QIcon::Off); noPrint->setIcon(a2); noResize->setCheckable( true ); QIcon a3 = QIcon(); a3.addPixmap(loadIcon("framenoresize.png"), QIcon::Normal, QIcon::On); a3.addPixmap(loadIcon("frameresize.png"), QIcon::Normal, QIcon::Off); noResize->setIcon(a3); m_lineMode = false; languageChange(); connect(xposSpin, SIGNAL(valueChanged(double)), this, SLOT(handleNewX())); connect(yposSpin, SIGNAL(valueChanged(double)), this, SLOT(handleNewY())); connect(widthSpin, SIGNAL(valueChanged(double)), this, SLOT(handleNewW())); connect(heightSpin, SIGNAL(valueChanged(double)), this, SLOT(handleNewH())); connect(rotationSpin, SIGNAL(valueChanged(double)), this, SLOT(handleRotation())); connect(flipH, SIGNAL(clicked()), this, SLOT(handleFlipH())); connect(flipV, SIGNAL(clicked()), this, SLOT(handleFlipV())); connect(levelUp, SIGNAL(clicked()), this, SLOT(handleRaise())); connect(levelDown, SIGNAL(clicked()), this, SLOT(handleLower())); connect(levelTop, SIGNAL(clicked()), this, SLOT(handleFront())); connect(levelBottom, SIGNAL(clicked()), this, SLOT(handleBack())); connect(basePointWidget, SIGNAL(buttonClicked(int)), this, SLOT(handleBasePoint(int))); connect(nameEdit , SIGNAL(Leaved()) , this, SLOT(handleNewName())); connect(doLock , SIGNAL(clicked()), this, SLOT(handleLock())); connect(noPrint , SIGNAL(clicked()), this, SLOT(handlePrint())); connect(noResize , SIGNAL(clicked()), this, SLOT(handleLockSize())); connect(doGroup , SIGNAL(clicked()), this, SLOT(handleGrouping()) ); connect(doUnGroup, SIGNAL(clicked()), this, SLOT(handleUngrouping()) ); m_haveItem = false; xposSpin->showValue(0); yposSpin->showValue(0); widthSpin->showValue(0); heightSpin->showValue(0); rotationSpin->showValue(0); }
void GameScene::endReady() { actionStart(); }
//*************************************************************************** Kwave::RecordDialog::RecordDialog(QWidget *parent, QStringList ¶ms, Kwave::RecordController *controller, Kwave::RecordDialog::Mode mode) :QDialog(parent), Ui::RecordDlg(), m_methods_map(), m_file_filter(), m_devices_list_map(), m_state(Kwave::REC_EMPTY), m_params(), m_supported_resolutions(), m_buffer_progress_count(0), m_buffer_progress_total(0), m_buffer_progress_timer(this), m_record_enabled(true), m_samples_recorded(0), m_enable_setDevice(true), m_state_icon_widget(0) { m_status_bar.m_state = 0; m_status_bar.m_time = 0; m_status_bar.m_sample_rate = 0; m_status_bar.m_bits_per_sample = 0; m_status_bar.m_tracks = 0; setupUi(this); /* get initial parameters */ m_params.fromList(params); /* set the icons of the record control buttons */ KIconLoader icon_loader; btNew->setIcon( QIcon(icon_loader.loadIcon(_("document-new"), KIconLoader::Toolbar))); btStop->setIcon( QIcon(QPixmap(xpm_stop))); btPause->setIcon( QIcon(QPixmap(xpm_pause))); btRecord->setIcon(QIcon(QPixmap(xpm_krec_record))); // fill the combo box with playback methods unsigned int index=0; for (index = 0; index < m_methods_map.count(); ++index) { cbMethod->addItem(m_methods_map.description(index, true)); } cbMethod->setEnabled(cbMethod->count() > 1); /* --- set up all controls with their default/startup values --- */ // pre-record STD_SETUP_SLIDER(pre_record_enabled, pre_record_time, RecordPre); connect(chkRecordPre, SIGNAL(toggled(bool)), this, SLOT(preRecordingChecked(bool))); connect(sbRecordPre, SIGNAL(valueChanged(int)), this, SLOT(preRecordingTimeChanged(int))); // record time (duration) STD_SETUP(record_time_limited, record_time, RecordTime); // start time (date & time) chkRecordStartTime->setChecked(m_params.start_time_enabled); startTime->setDateTime(m_params.start_time); // record trigger STD_SETUP_SLIDER(record_trigger_enabled, record_trigger, RecordTrigger); // amplification STD_SETUP_SLIDER(amplification_enabled, amplification, LevelAmplify); // AGC STD_SETUP_SLIDER(agc_enabled, agc_decay, LevelAGC); // fade in STD_SETUP(fade_in_enabled, fade_in_time, LevelFadeIn); // fade out STD_SETUP(fade_out_enabled, fade_out_time, LevelFadeOut); // sample rate, bits per sample, track // -> will be initialized later, by the plugin // number of buffers slSourceBufferCount->setValue(m_params.buffer_count); // power of buffer size slSourceBufferSize->setValue(m_params.buffer_size); sourceBufferSizeChanged(m_params.buffer_size); // after this point all controls have their initial values /* --- connect some missing low level GUI functionality --- */ connect(cbMethod, SIGNAL(activated(int)), this, SLOT(methodSelected(int))); // record buffer size and count slSourceBufferCount->setValue(m_params.buffer_count); slSourceBufferSize->setValue(m_params.buffer_size); connect(slSourceBufferSize, SIGNAL(valueChanged(int)), this, SLOT(sourceBufferSizeChanged(int))); connect(slSourceBufferCount, SIGNAL(valueChanged(int)), this, SLOT(sourceBufferCountChanged(int))); // device treeview connect(listDevices, SIGNAL(currentItemChanged(QTreeWidgetItem*,QTreeWidgetItem*)), SLOT(listEntrySelected(QTreeWidgetItem*,QTreeWidgetItem*))); connect(listDevices, SIGNAL(itemExpanded(QTreeWidgetItem*)), SLOT(listItemExpanded(QTreeWidgetItem*))); connect(listDevices, SIGNAL(focusLost()), SLOT(updateListSelection())); // "select device..." button connect(btSourceSelect, SIGNAL(clicked()), this, SLOT(selectRecordDevice())); connect(cbDevice, SIGNAL(activated(QString)), this, SLOT(setDevice(QString))); // setup controls connect(chkRecordTime, SIGNAL(toggled(bool)), this, SLOT(recordTimeChecked(bool))); connect(sbRecordTime, SIGNAL(valueChanged(int)), this, SLOT(recordTimeChanged(int))); connect(chkRecordStartTime, SIGNAL(toggled(bool)), this, SLOT(startTimeChecked(bool))); connect(startTime, SIGNAL(dateTimeChanged(QDateTime)), this, SLOT(startTimeChanged(QDateTime))); connect(chkRecordTrigger, SIGNAL(toggled(bool)), this, SLOT(triggerChecked(bool))); connect(sbRecordTrigger, SIGNAL(valueChanged(int)), this, SLOT(triggerChanged(int))); connect(cbFormatSampleRate, SIGNAL(editTextChanged(QString)), this, SLOT(sampleRateChanged(QString))); connect(cbFormatSampleRate, SIGNAL(activated(QString)), this, SLOT(sampleRateChanged(QString))); connect(sbFormatTracks, SIGNAL(valueChanged(int)), this, SLOT(tracksChanged(int))); connect(cbFormatCompression, SIGNAL(activated(int)), this, SLOT(compressionChanged(int))); connect(sbFormatResolution, SIGNAL(valueChanged(int)), this, SLOT(bitsPerSampleChanged(int))); connect(cbFormatSampleFormat, SIGNAL(activated(int)), this, SLOT(sampleFormatChanged(int))); // connect the buttons to the record controller connect(btNew, SIGNAL(clicked()), controller, SLOT(actionReset())); connect(btStop, SIGNAL(clicked()), controller, SLOT(actionStop())); connect(btPause, SIGNAL(clicked()), controller, SLOT(actionPause())); connect(btRecord, SIGNAL(clicked()), controller, SLOT(actionStart())); // stop recording when the window gets closed connect(this, SIGNAL(rejected()), controller, SLOT(actionStop())); connect(this, SIGNAL(accepted()), controller, SLOT(actionStop())); // connect the notifications/commands of the record controller connect(controller, SIGNAL(stateChanged(Kwave::RecordState)), this, SLOT(setState(Kwave::RecordState))); // timer for updating the buffer progress bar connect(&m_buffer_progress_timer, SIGNAL(timeout()), this, SLOT(updateBufferProgressBar())); // help button connect(buttonBox->button(QDialogButtonBox::Help), SIGNAL(clicked()), this, SLOT(invokeHelp())); // status bar m_state_icon_widget = new Kwave::StatusWidget(this); Q_ASSERT(m_state_icon_widget); if (!m_state_icon_widget) return; m_state_icon_widget->setFixedSize(16, 16); lbl_state->addWidget(m_state_icon_widget); m_status_bar.m_state = new (std::nothrow) QLabel(_(" ")); Q_ASSERT(m_status_bar.m_state); if (!m_status_bar.m_state) return; m_status_bar.m_state->setAlignment(Qt::AlignLeft | Qt::AlignVCenter); lbl_state->addWidget(m_status_bar.m_state); m_status_bar.m_time = new (std::nothrow) QLabel(_(" ")); Q_ASSERT(m_status_bar.m_time); if (!m_status_bar.m_time) return; m_status_bar.m_time->setAlignment(Qt::AlignLeft | Qt::AlignVCenter); lbl_state->addWidget(m_status_bar.m_time); m_status_bar.m_sample_rate = new (std::nothrow) QLabel(_(" ")); Q_ASSERT(m_status_bar.m_sample_rate); if (!m_status_bar.m_sample_rate) return; m_status_bar.m_sample_rate->setAlignment(Qt::AlignRight | Qt::AlignVCenter); lbl_state->addWidget(m_status_bar.m_sample_rate); m_status_bar.m_bits_per_sample = new (std::nothrow) QLabel(_(" ")); Q_ASSERT(m_status_bar.m_bits_per_sample); if (!m_status_bar.m_bits_per_sample) return; m_status_bar.m_bits_per_sample->setAlignment(Qt::AlignRight | Qt::AlignVCenter); lbl_state->addWidget(m_status_bar.m_bits_per_sample); m_status_bar.m_tracks = new (std::nothrow) QLabel(_(" ")); Q_ASSERT(m_status_bar.m_tracks); if (!m_status_bar.m_tracks) return; m_status_bar.m_tracks->setAlignment(Qt::AlignRight | Qt::AlignVCenter); lbl_state->addWidget(m_status_bar.m_tracks); m_state_icon_widget->setFixedSize(16, lbl_state->childrenRect().height()); // set the initial state of the dialog to "Reset/Empty" setState(Kwave::REC_EMPTY); // disable the "level" tab, it is not implemented yet tabRecord->setCurrentIndex(1); QWidget *page = tabRecord->currentWidget(); tabRecord->setCurrentIndex(0); if (page) delete page; // add the "Done" button manually, otherwise it would have "Cancel" semantic QPushButton *bt_done = buttonBox->addButton(i18n("&Done"), QDialogButtonBox::AcceptRole); Q_ASSERT(bt_done); if (!bt_done) return; connect(bt_done, SIGNAL(clicked(bool)), this, SLOT(accept())); switch (mode) { case Kwave::RecordDialog::SETTINGS_FORMAT: tabRecord->setCurrentIndex(1); break; case Kwave::RecordDialog::SETTINGS_SOURCE: tabRecord->setCurrentIndex(2); break; case Kwave::RecordDialog::START_RECORDING: /* FALLTHROUGH */ case Kwave::RecordDialog::SETTINGS_DEFAULT: /* FALLTHROUGH */ default: tabRecord->setCurrentIndex(0); // set the focus onto the "Record" button btRecord->setFocus(); break; } }
void Tegiac::changeState(artemis::Entity &e){ StateComponent* state = (StateComponent*)e.getComponent<StateComponent>(); PosComponent* position = (PosComponent*)e.getComponent<PosComponent>(); CharacterInfoComponent* characterInfo = (CharacterInfoComponent*)e.getComponent<CharacterInfoComponent>(); if (state->state == R::CharacterState::ATTACK){ AttackComponent* attackComponent = new AttackComponent(); attackComponent->whoAttack = ((CharacterTypeComponent*)e.getComponent<CharacterTypeComponent>())->type; attackComponent->type = state->attack; attackComponent->powerOfAttack = characterInfo->NORMAL_SKILL_POWER; if (state->attack == R::Attack::TEGIAC_BEAT3){ actionBeat3(e, state->direction); attackComponent->minX = position->x - 60; attackComponent->maxX = position->x + 60; attackComponent->minY = position->y - 100; attackComponent->maxY = position->y + 100; } else if (state->attack == R::Attack::TEGIAC_KICK2){ actionKick2(e, state->direction); attackComponent->minX = position->x - 60; attackComponent->maxX = position->x + 60; attackComponent->minY = position->y - 70; attackComponent->maxY = position->y + 70; } else if (state->attack == R::Attack::TEGIAC_KICK3){ actionKick3(e, state->direction); attackComponent->minX = position->x - 130; attackComponent->maxX = position->x + 130; attackComponent->minY = position->y - 100; attackComponent->maxY = position->y + 100; attackComponent->manaOfAttack = 40; } else if (state->attack == R::Attack::TEGIAC_PUNCH1){ actionPunch1(e, state->direction); attackComponent->minX = position->x - 60; attackComponent->maxX = position->x + 60; attackComponent->minY = position->y - 140; attackComponent->maxY = position->y + 140; } else if (state->attack == R::Attack::TEGIAC_PUNCH2){ actionPunch2(e, state->direction); attackComponent->minX = position->x - 60; attackComponent->maxX = position->x + 60; attackComponent->minY = position->y - 140; attackComponent->maxY = position->y + 140; } else if (state->attack == R::Attack::TEGIAC_PUNCH3){ actionPunch3(e, state->direction); attackComponent->minX = position->x - 80; attackComponent->maxX = position->x + 80; attackComponent->minY = position->y - 140; attackComponent->maxY = position->y + 140; attackComponent->powerOfAttack = characterInfo->SPECIAL_SKILL_POWER; attackComponent->isSpecialSkill = true; return; } else if (state->attack == R::Attack::TEGIAC_PUNCH_AIR){ actionPunchAir(e, state->direction); attackComponent->minX = position->x - 140; attackComponent->maxX = position->x + 140; attackComponent->minY = position->y - 140; attackComponent->maxY = position->y + 140; attackComponent->manaOfAttack = 40; attackComponent->powerOfAttack = characterInfo->SPECIAL_SKILL_POWER; attackComponent->isSpecialSkill = true; } if (R::Constants::soundEnable){ CocosDenshion::SimpleAudioEngine::getInstance()->setEffectsVolume(R::Constants::soundVolumn); CocosDenshion::SimpleAudioEngine::getInstance()->playEffect(R::Constants::ENEMY_ATTACK, false, 1, 0, 1); } EntityUtils::getInstance()->createAttackEntity(e, attackComponent); } else if (state->state == R::CharacterState::DIE){ if (R::Constants::soundEnable){ CocosDenshion::SimpleAudioEngine::getInstance()->setEffectsVolume(R::Constants::soundVolumn); CocosDenshion::SimpleAudioEngine::getInstance()->playEffect(R::Constants::ENEMY_DEATH, false, 1, 0, 1); } actionDie(e, state->direction); } else if (state->state == R::CharacterState::DEFENSE){ if (R::Constants::soundEnable){ CocosDenshion::SimpleAudioEngine::getInstance()->setEffectsVolume(R::Constants::soundVolumn); CocosDenshion::SimpleAudioEngine::getInstance()->playEffect(R::Constants::ENEMY_HIT3,false,1,0,1); } if (state->defense == R::Defense::TRUNG_DON) actionTrungDon(e, state->direction); if (state->defense == R::Defense::TRUNG_DON_NGA) actionTrungDonNga(e, state->direction); } else if (state->state == R::CharacterState::START){ actionStart(e, state->direction); } else if (state->state == R::CharacterState::BACK){ actionBack(e, state->direction); } else if (state->state == R::CharacterState::STAND){ actionStand(e); } else if (state->state == R::CharacterState::STAND_UP){ actionStandUp(e); } else if (state->state == R::CharacterState::LEFT){ actionMove(e, R::Direction::LEFT); } else if (state->state == R::CharacterState::RIGHT){ actionMove(e, R::Direction::RIGHT); } else if (state->state == R::CharacterState::WALK_LEFT){ actionRun(e, R::Direction::LEFT); } else if (state->state == R::CharacterState::WALK_RIGHT){ actionRun(e, R::Direction::RIGHT); } else if (state->state == R::CharacterState::JUMP){ actionJump(e, R::Direction::AUTO); } }
void CaMap::changeState(artemis::Entity &e){ StateComponent* state = (StateComponent*)e.getComponent<StateComponent>(); PosComponent* position = (PosComponent*)e.getComponent<PosComponent>(); CharacterInfoComponent* characterInfo = (CharacterInfoComponent*)e.getComponent<CharacterInfoComponent>(); if (state->state == R::CharacterState::ATTACK){ AttackComponent* attackComponent = new AttackComponent(); attackComponent->whoAttack = ((CharacterTypeComponent*)e.getComponent<CharacterTypeComponent>())->type; attackComponent->type = state->attack; attackComponent->powerOfAttack = characterInfo->NORMAL_SKILL_POWER; if (state->attack == R::Attack::CAMAP_PUNCH_AIR){ actionPunchAir(e, state->direction); characterInfo->power -= 40; return; } else if (state->attack == R::Attack::CAMAP_SKILL){ actionSkill(e, state->direction); characterInfo->power -= 40; return; } else if (state->attack == R::Attack::CAMAP_PUNCH1){ actionPunch1(e, state->direction); return; } else if (state->attack == R::Attack::CAMAP_PUNCH2){ actionPunch2(e, state->direction); return; } else if (state->attack == R::Attack::CAMAP_PUNCH3){ actionPunch3(e, state->direction); return; } else if (state->attack == R::Attack::CAMAP_KICK2){ actionKick2(e, state->direction); return; } if (R::Constants::soundEnable){ CocosDenshion::SimpleAudioEngine::getInstance()->setEffectsVolume(R::Constants::soundVolumn); CocosDenshion::SimpleAudioEngine::getInstance()->playEffect(R::Constants::ENEMY_ATTACK, false, 1, 0, 1); } EntityUtils::getInstance()->createAttackEntity(e, attackComponent); } else if (state->state == R::CharacterState::DIE){ actionDie(e, state->direction); if (R::Constants::soundEnable){ CocosDenshion::SimpleAudioEngine::getInstance()->setEffectsVolume(R::Constants::soundVolumn); CocosDenshion::SimpleAudioEngine::getInstance()->playEffect(R::Constants::ENEMY_DEATH, false, 1, 0, 1); } } else if (state->state == R::CharacterState::DEFENSE){ if (R::Constants::soundEnable){ CocosDenshion::SimpleAudioEngine::getInstance()->setEffectsVolume(R::Constants::soundVolumn); CocosDenshion::SimpleAudioEngine::getInstance()->playEffect(R::Constants::PUNCH, false, 1, 0, 1); } if (state->defense == R::Defense::TRUNG_DON) actionTrungDon(e, state->direction); if (state->defense == R::Defense::TRUNG_DON_NGA) actionTrungDonNga(e, state->direction); } else if (state->state == R::CharacterState::START){ actionStart(e, state->direction); } else if (state->state == R::CharacterState::BACK){ actionBack(e, state->direction); } else if (state->state == R::CharacterState::STAND){ actionStand(e); } else if (state->state == R::CharacterState::STAND_UP){ actionStandUp(e); } else if (state->state == R::CharacterState::LEFT){ actionMove(e, R::Direction::LEFT); } else if (state->state == R::CharacterState::RIGHT){ actionMove(e, R::Direction::RIGHT); } else if (state->state == R::CharacterState::WALK_LEFT){ actionMove(e, R::Direction::LEFT); } else if (state->state == R::CharacterState::WALK_RIGHT){ actionMove(e, R::Direction::RIGHT); } else if (state->state == R::CharacterState::JUMP){ actionJump(e, R::Direction::RIGHT); } }