2 #include "BattlerFacade.h"
3 #include "mof/DataRow.h"
4 #include "mof/DataBasedAnimation.h"
5 #include "mof/KeyFrameAnimation.h"
7 et::Action::Action(et::BattlerFacade* pBattler , et::BattlerFacade* pTarget , int cost)
10 if(pTarget != NULL)m_targetList.push_back(pTarget);
16 et::Action::Action(et::BattlerFacade* pBattler , std::vector<et::BattlerFacade*>& targetList , int cost)
18 m_pBattler = pBattler;
19 m_targetList = targetList;
24 et::Action::~Action(void)
28 void et::Action::setTargetList(std::vector<et::BattlerFacade*>& targetList){
29 m_targetList = targetList;
32 std::vector<int> et::Action::doAction(){
33 std::vector<int> result;
34 et::BattlerParameter parameter = m_pBattler->getParameter();
35 parameter.dActionPoint -= getAPCost();
36 m_pBattler->setParameter(parameter);
37 for(std::vector<BattlerFacade*>::iterator itr = m_targetList.begin() ; itr != m_targetList.end() ; ++itr){
38 result.push_back(doActionTo(*itr));
43 mof::GraphicsSchedule* et::Action::createEffect(et::Common& common){
44 mof::DataResource effectTable = common.m_pDataResourceManager->getResource(_T("data/effect/shock.csv"));
46 mof::GraphicsSchedule* pSchedule = new mof::GraphicsSchedule();
48 for(int i = 0 ; i < effectTable->getNumberOfRows() ; i++){
49 mof::DataRow effectRow = mof::DataRow(effectTable , i);
51 //---
\83\82\81[
\83V
\83\87\83\93\82Ì
\8d\
\90¬
52 mof::CascadeAnimation* pCascadeAnimation = new mof::CascadeAnimation();
54 mof::KeyFrameAnimation* pCommonAnimation = new mof::KeyFrameAnimation();
55 mof::Vector3D targetPosition = getTargetList().front()->getPosition();
56 mof::Vector3D basePosition = m_pBattler->getGraphicsObject()->getPosition();
57 //
\83X
\83P
\81[
\83\8b\82ð
\8cv
\8eZ
58 mof::Vector3D scale = targetPosition - basePosition;
59 //if(scale.x < 0)scale.x = -scale.x;
60 scale.y = scale.z = 1.0;
61 pCommonAnimation->setPosition(0 , basePosition);
62 mof::AnimationResource resource(pCommonAnimation);
64 mof::tstring motionName(effectRow.getData(_T("Motion")));
65 mof::DataBasedAnimation* pMotionAnimation = new mof::DataBasedAnimation(motionName.c_str() , scale);
66 pCascadeAnimation->setElement(0 , mof::AnimationResource(pMotionAnimation));
69 pCascadeAnimation->setElement(1 , resource);
70 mof::AnimationResource animation(pCascadeAnimation);
72 //---
\83I
\83u
\83W
\83F
\83N
\83g
\82Ì
\8d\
\90¬
73 mof::tstring className(effectRow.getData(_T("Class")));
75 mof::tstring textureName(effectRow.getData(_T("Texture")));
76 if(textureName == _T(""))textureName = _T("null");
77 mof::TextureResource texture = common.m_pTextureManager->getResource(textureName.c_str());
79 if(className == _T("Billboard")){
80 //
\83r
\83\8b\83{
\81[
\83h
81 mof::GraphicsObject* pModel = new mof::Billboard(mof::Billboard::Y_FIXED , texture);
82 pModel->setAnimation(0 , animation);
83 pSchedule->add(20 , mof::GraphicsModelPtr(pModel) , animation);
86 //
\83\81\83b
\83V
\83\85(className
\82ªPath)
87 mof::MeshResource pModel = common.m_pMeshManager->getResource(className.c_str());
88 pModel->setTexture(0 , texture);
89 pModel->setAnimation(0 , animation);
90 pSchedule->add(20 , mof::GraphicsModelPtr(pModel) , animation);