int CActionSkillToAlias::Run(CMachine& machine) const { CActionSkill actionSkill( machine.GetObjectIndex(mAlias.c_str()), mSkillIndex); actionSkill.Run( machine); return 1; }
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); } }