void BhvGoalie::Clear(){ // OSYSPRINT(("clear: theta = %1.f\n",state.self.position.tt.val)); if(state.self.position.tt.val < -80){ SetMotion(HEADING_LEFT); }else if(state.self.position.tt.val > 80){ SetMotion(HEADING_RIGHT); }else{ SetMotion(SHOOT_FRONT); } mode = CHASE; }
void CPlayerM :: Restart(D3DXVECTOR3 pos,D3DXVECTOR3 rot) { m_Pos = pos; m_PosOld = pos; m_Rot = rot; m_rotDestModel = rot; m_Move = D3DXVECTOR3(0.0f, 0.0f, 0.0f); m_nNumKey = 0; m_pKeyInfo = NULL; m_nKey = 0; m_nCountMotion = 0; m_bLoopMotion = false; m_bMotion = false; m_bFinishMotion = false; m_bPause = false; m_bDispDebug = true; // アニメーション設定 SetMotion(MOTIONTYPE_NEUTRAL); }
/************************************************************************* * AM-PITCH-BEND-TEXT-VIEW *************************************************************************/ AmPitchBendView::AmPitchBendView( BRect frame, AmSongRef songRef, AmTrackRef trackRef) : inherited(frame, "AmPitchBendView", NULL, NULL, B_FOLLOW_TOP | B_FOLLOW_LEFT, B_WILL_DRAW), AmSongObserver(songRef), mContainer(0), mPitchBend(0), mTrackRef(trackRef) { SetLimits(AM_PITCH_MIN, AM_PITCH_MAX); SetMotion( new ArpIntControlMediumMotion() ); }
/*void BhvGoalie::MoveToPosition(){ int walk = 0; static bool final_state = false; double dest_x = -2650; double dest_y = 0; double dest_tt = 0; if(final_state){ static int count_fs = 0; SetPresetWalk(0); if(count_fs == 100){ final_state = false; count_fs = 0; } count_fs++; return; } static int cnt_swing = 0; cnt_swing++; if(state.ball.visible){ cnt_swing++; if(cnt_swing > 100){ SetHeadMode(HEAD_WATCHING);//HEAD_SWING_LOCALIZATION); if(cnt_swing == 130) cnt_swing = 0; } else SetHeadMode(HEAD_TRACK); } else{ SetHeadMode(HEAD_SWING_LOCALIZATION); cnt_swing = 0; } double tx = dest_x - state.self.position.x.val; double ty = dest_y - state.self.position.y.val; double tt = -state.self.position.tt.val; double dx = tx*cos(tt*3.14/180) - ty*sin(tt*3.14/180); //AIBOのx軸方向への移動量 double dy = tx*sin(tt*3.14/180) + ty*cos(tt*3.14/180); //AIBOのy軸方向への移動量 double dtt = dest_tt - state.self.position.tt.val; //AIBOの回転量 if(dtt < -180.0) dtt += 360.0; if(dtt >= 180.0) dtt -= 360.0; //目標値に十分接近しているとき if( (fabs(dx) < 200.0) && (fabs(dy) < 200.0) ){ if(dtt < -130) walk = WALK_ROTATE_RIGHT180; else if(dtt < -80) walk = WALK_ROTATE_RIGHT90; else if(dtt < -20) walk = WALK_ROTATE_RIGHT90; else if(dtt < 20){ walk = WALK_STOP; final_state = true;} //終端状態 else if(dtt < 80 ) walk = WALK_ROTATE_LEFT90; else if(dtt < 130) walk = WALK_ROTATE_LEFT90; else walk = WALK_ROTATE_LEFT180; } else{//目標値にまだまだ接近 double goto_tt = atan2(dy, dx)*180.0/PI; if(goto_tt < -180.0) goto_tt += 360.0; if(goto_tt >= 180.0) goto_tt -= 360.0; if(goto_tt < -165) walk = WALK_BACK; else if(goto_tt < -135) walk = WALK_RIGHT150; else if(goto_tt < -105) walk = WALK_RIGHT120; else if(goto_tt < -75) walk = WALK_RIGHT90; else if(goto_tt < -45) walk = WALK_RIGHT60; else if(goto_tt < -15) walk = WALK_RIGHT30; else if(goto_tt < 15) walk = WALK_FORWARD; else if(goto_tt < 45) walk = WALK_LEFT30; else if(goto_tt < 75) walk = WALK_LEFT60; else if(goto_tt < 105) walk = WALK_LEFT90; else if(goto_tt < 135) walk = WALK_LEFT120; else if(goto_tt < 165) walk = WALK_LEFT150; else walk = WALK_BACK; } SetPresetWalk(walk, true); SetTailMode(TAIL_SWING); } */ void BhvGoalie::SaveMotion(){ static bool startmotion = false; if(!startmotion && GaitMaker::IsStop()){ // savingflag = false; // return; startmotion = true; SetMotion("GOALIE_BLOCK"); } if(startmotion && MotionMaker::IsFinished()){ startmotion = false; savingflag = false; } }
// 初期化 bool Player::Initialize( void ) { // 読み込み bool loadSuccess = Load( "DATA/CHR/Y2009/Y2009.IEM" ); if ( loadSuccess ) { SetMotion( 1 ); // 仮 SetPos( INIT_POS ); SetAngle( INIT_ANGLE ); SetScale( INIT_SCALE ); UpdateInfo(); return true; } return false; }
/************************************************************************* * ARP-INT-CONTROL *************************************************************************/ ArpIntControl::ArpIntControl( BRect frame, const char* name, const BString16* label, BMessage* message, uint32 rmask, uint32 flags) : inherited(frame, name, label, message, rmask, flags), mMotion(0), mFlags(0), mDivider(0), mMin(-99), mMax(99), mMap(NULL), mFormatter(NULL), mKeyStep(1), mKeyCount(0), mTextCtrl(NULL), mEditRunner(NULL) { if (label) { mLabel = label; mDivider = StringWidth(label); if ( mDivider > frame.Width() ) mDivider = frame.Width(); } SetMotion( new ArpIntControlSmallMotion() ); // if (!bgImage && HasImageManager()) bgImage = ImageManager().FindBitmap("BG"); // SetBodyFill(ArpWest); }
void CMechBone::MotionMofing() { //----------------------------------------------------- //モーフィング制御 //----------------------------------------------------- Sint32 n = 0; Sint32 sIndex = 0; m_bMofingNow = gxFalse; if( m_CMofingMan.IsMofing() ) { m_bMofingNow = gxTrue; m_sMotionWalk = 0; for(Sint32 jj=0; jj<8; jj++) { if( m_CMofingMan.GetMofingData(jj)->sOption == -1 ) { continue; } SetMotion( m_CMofingMan.GetMofingData(jj)->sIndex , m_CMofingMan.GetMofingData(jj)->sRotation , m_CMofingMan.GetMofingData(jj)->sOffsetX , m_CMofingMan.GetMofingData(jj)->sOffsetY ); } m_CMofingMan.Action(); if( !m_CMofingMan.IsMofing() ) { //アニメーション終了 m_sArmRotation = m_CMofingMan.GetMofingData(3)->sRotation; //腕のポジションをアニメにあわせる } } }
// パワーアーツ bool Thief::PowerArts(void) { if ( !initflag ) { artsTimer = 0; sound->PlaySE( SE::KAITO_POWER ); initflag = true; } SetMotion(THIEF::MOTION_DATA::POWERARTS); //if (obj->GetFrame() >= 277) obj->SetFrame(277); // 行列から情報取得 Vector3 front = GetFront(); Vector3 p_pos = GetPos(); SetMove(Vector3(0.0f, move.y, 0.0f)); // 情報設定 p_pos.y += 1.0f; Vector3 vec = front * 1.0f; float bulletSpeed = 0.8f; int playerNum = GetPlayerNum(); if (artsTimer == 0/* obj->GetFrame() == ○○ */) { m_BulletManager->Set(BULLET_TYPE::THIEF_02, new ThiefBullet02, p_pos, vec, bulletSpeed, playerNum); } artsTimer++; if (obj->GetFrame() == THIEF::MOTION_FRAME::POWERARTS_END) { artsTimer = 0; initflag = false; return true; } return false; }
//------------------------------------------------------ // モーション //------------------------------------------------------ void iex3DObj::Animation() { int param; u32 work; work = dwFrame; param = dwFrameFlag[dwFrame]; if( param & 0x4000 ) param = 0xFFFF; if( param != 0xFFFF ){ // アニメーションジャンプ if( param & 0x8000 ){ SetMotion( param&0xFF ); } else dwFrame = param; } else { dwFrame ++; if( dwFrame >= NumFrame ) dwFrame = 0; } if( dwFrame != work ) bChanged = TRUE; param = dwFrameFlag[dwFrame]; if( (param!=0xFFFF) && (param&0x4000) ) Param[(param&0x0F00)>>8] = (u8)(param&0x00FF); }
void Player::Move() { static float MAX_SPEED = 1; static float MINI_SPEED = 0.01; static float ACCELATION = 0.05f; static float ブレーキ = 0.8f; //カメラの前方向 Vector3 c_front(matView._13,0,matView._33); c_front.Normalize(); //カメラの右方向 Vector3 c_right(matView._11, 0, matView._31); c_right.Normalize(); Vector3 temp = Vector3(0, 0, 0); bool is_move = false; if (KEY_Get(KEY_UP) && IsCanControl()) { SetMotion(1); temp += c_front; is_move = true; //if (velocity.Length() > MAX_SPEED) //{ // velocity.Normalize(); // velocity *= MAX_SPEED; //} } if (KEY_Get(KEY_DOWN) && IsCanControl()) { SetMotion(1); temp -= c_front; is_move = true; ////if (velocity.Length() > MAX_SPEED) ////{ //// velocity.Normalize(); //// velocity *= MAX_SPEED; ////} } if (KEY_Get(KEY_RIGHT) && IsCanControl()) { SetMotion(1); temp += c_right; is_move = true; //if (velocity.Length() > MAX_SPEED) //{ // velocity.Normalize(); // velocity *= MAX_SPEED; //} } if (KEY_Get(KEY_LEFT) && IsCanControl()) { is_move = true; SetMotion(1); temp -= c_right; if (velocity.Length() > MAX_SPEED) { velocity.Normalize(); velocity *= MAX_SPEED; } } temp.Normalize(); temp *= ACCELATION; velocity += temp; if (velocity.Length() > MAX_SPEED) { velocity.Normalize(); velocity *= MAX_SPEED; } if (!is_move) { velocity *= ブレーキ; if (velocity.Length() < MINI_SPEED) { velocity.Normalize(); velocity =Vector3(0,0,0); } SetMotion(0); }
void PlayMotion(void) { int i; for(i =0; i < 6; i++) { switch(LEGFRAME[i]) { case -1: if(timer_nowtime() - PLAYTIMER[i] > STARTTIME[i]) { LEGFRAME[i] = 0; SetMotion(i); rcservo_SetAction(POSITION, PLAYTIME); LEGFRAME[i]++; LEGTIMER[i] = timer_nowtime(); } break; case 11: if(timer_nowtime() - LEGTIMER[i] > PLAYTIME) { SetMotion(i); rcservo_SetAction(POSITION, PLAYTIME); LEGFRAME[i] = 0; LEGTIMER[i] = timer_nowtime(); } break; case 0: if(timer_nowtime() - LEGTIMER[i] > PLAYTIME) { SetMotion(i); rcservo_SetAction(POSITION, PLAYTIME); LEGFRAME[i]++; LEGTIMER[i] = timer_nowtime(); } break; case 9: case 1: if(timer_nowtime() - LEGTIMER[i] > PLAYTIME) { SetMotion(i); rcservo_SetAction(POSITION, PLAYTIME); LEGFRAME[i] = LEGFRAME[i] + STEP_1; LEGTIMER[i] = timer_nowtime(); } break; case 3: case 6: if(timer_nowtime() - LEGTIMER[i] > PLAYTIME) { SetMotion(i); rcservo_SetAction(POSITION, PLAYTIME); LEGFRAME[i] = LEGFRAME[i] + STEP_2; LEGTIMER[i] = timer_nowtime(); } break; default: if(timer_nowtime() - LEGTIMER[i] > PLAYTIME) { SetMotion(i); rcservo_SetAction(POSITION, PLAYTIME); LEGFRAME[i] = LEGFRAME[i]++; LEGTIMER[i] = timer_nowtime(); } break; } } rcservo_PlayAction(); }
//***************************************************************************** // 更新 //***************************************************************************** void CPlayer::Update() { //キー変数と取得 CInputKeyboard *pKeyBoard; pKeyBoard = CManager::GetInputKeyboard();//入力処理へのポインタ取得 //カメラ変数と取得 D3DXVECTOR3 CameraRot = CCamera::GetCameraRot(); //地面の高さの取得変数 CScene3d *pScene3d; pScene3d = CManager::GetScene3D(); //過去の座標を記録 D3DXVECTOR3 oldVtx = m_Vertex_3d.vtx; //ギミックの影響を反映させる if(m_pSceneLink) { //ギミック情報取得 VERTEX_3D pVtx; m_pSceneLink->GetVtx(&pVtx); m_Vertex_3d.vtx += pVtx.Speed_vtx; //m_Vertex_3d.Rot_vtx.y += 0.005f; //プレイヤーの角度の修正 while(m_Vertex_3d.Rot_vtx.y >= 1) { m_Vertex_3d.Rot_vtx.y -= 1 * 2; } while(m_Vertex_3d.Rot_vtx.y <= -1) { m_Vertex_3d.Rot_vtx.y += 1 * 2; } } //プレイヤーの今回の角度 //死亡した場合 if(m_bDeath) { //死亡エフェクト処理 m_Vertex_3d.Scail_vtx -= D3DXVECTOR3(0.02f,0.02f,0.02f); m_Vertex_3d.Rot_vtx.y += 0.2f; m_Vertex_3d.vtx.y += 0.1f; //プレイヤーが消滅したらゲーム終了 if(m_Vertex_3d.Scail_vtx.x < 0.0f) { CScene::Release(); CManager::ChangeMode(CManager::MODE_REZULT_GAMEOVER); } //以下の処理を行わずに終了 return; } //移動処理 //奥移動 if(pKeyBoard->GetkeyboardPress(DIK_W)) { //角度指定 if(pKeyBoard->GetkeyboardPress(DIK_D)) { PurposeRot = 0.25f + CameraRot.y; } else if(pKeyBoard->GetkeyboardPress(DIK_A)) { PurposeRot = -0.25f + CameraRot.y; } else { PurposeRot = 0.0f + CameraRot.y; } ResultRot = PurposeRot - m_Vertex_3d.Rot_vtx.y; m_Vertex_3d.MoveFlag = true; } //手前移動 else if(pKeyBoard->GetkeyboardPress(DIK_S)) { if(pKeyBoard->GetkeyboardPress(DIK_D)) { PurposeRot = 0.75f + CameraRot.y; } else if(pKeyBoard->GetkeyboardPress(DIK_A)) { PurposeRot = -0.75f + CameraRot.y; } else { PurposeRot = 1.0f + CameraRot.y; } ResultRot = PurposeRot - m_Vertex_3d.Rot_vtx.y; m_Vertex_3d.MoveFlag = true; } //左移動 else if(pKeyBoard->GetkeyboardPress(DIK_A)) { PurposeRot = -0.5f + CameraRot.y ; ResultRot = PurposeRot - m_Vertex_3d.Rot_vtx.y; m_Vertex_3d.MoveFlag = true; } //右移動 else if(pKeyBoard->GetkeyboardPress(DIK_D)) { //目的の角度の指定 PurposeRot = 0.5f + CameraRot.y; //角度の結果を計算 ResultRot = PurposeRot - m_Vertex_3d.Rot_vtx.y; m_Vertex_3d.MoveFlag = true; } else { m_Vertex_3d.MoveFlag = false; } //移動処理 if(m_Vertex_3d.MoveFlag) { while(ResultRot >= 1) { ResultRot -= 1 * 2; } while(ResultRot <= -1) { ResultRot += 1 * 2; } m_Vertex_3d.Rot_vtx.y += ResultRot * PLAYER_ROT; m_Vertex_3d.Speed_vtx.x += sin(D3DX_PI * PurposeRot) * MOVE; m_Vertex_3d.Speed_vtx.z += cos(D3DX_PI * PurposeRot) * MOVE; if(!jump && !m_bMotion) { if(m_bBlendMotion) { m_bBlendMotion = false; } SetMotion(MOTIONTYPE_WALK,10,m_bMotion); } } else { if(GetMotion() == MOTIONTYPE_WALK) { m_bFinishMotion = true; } } //ジャンプ if(pKeyBoard->GetkeyboardTrigger(DIK_SPACE) && !jump) { m_Vertex_3d.Speed_vtx.y = 1.0f; SetMotion(MOTIONTYPE_JUMP,10,false); } else if(pKeyBoard->GetkeyboardTrigger(DIK_1)) { SetMotion(MOTIONTYPE_PUNCH,10,m_bMotion); } //重力 m_Vertex_3d.Speed_vtx.y -= 0.03f; //空気抵抗 m_Vertex_3d.Speed_vtx.y -= m_Vertex_3d.Speed_vtx.y * 0.05f; //抵抗摩擦 m_Vertex_3d.Speed_vtx.x -= m_Vertex_3d.Speed_vtx.x * 0.2f; m_Vertex_3d.Speed_vtx.z -= m_Vertex_3d.Speed_vtx.z * 0.2f; //移動 m_Vertex_3d.vtx.x += m_Vertex_3d.Speed_vtx.x; m_Vertex_3d.vtx.y += m_Vertex_3d.Speed_vtx.y; m_Vertex_3d.vtx.z += m_Vertex_3d.Speed_vtx.z; //コインを全て取得したら if(CScore::GetScore() >= 500 && !clear) { CSter::Create(CRenderer::GetDevice(),D3DXVECTOR3(-48.0f,0.0f,48.0f),YEROWW_TEXTURE); clear = true; } //一定以上落下で死亡 if(m_Vertex_3d.vtx.y < -5.0f) { m_bDeath = true; PlaySound(SE_00,false); } //時間終了でもアウト if(CTime::TimeUp()) { m_bDeath = true; PlaySound(SE_00,false); } //地面にいるかの判定 if(m_Vertex_3d.vtx.y < pScene3d->GetHeight(m_Vertex_3d.vtx)) { //高さの指定 m_Vertex_3d.vtx.y = pScene3d->GetHeight(m_Vertex_3d.vtx); jump = false; if(m_motionType == MOTIONTYPE_JUMP) { SetMotion(MOTIONTYPE_NEUTRAL,8,true); } } //宙に浮いている場合 else { jump = true; } //ギミック更新処理 HitGimmick(); //壁にぶつかったかの判定 if(HitWall()) { m_Vertex_3d.vtx = oldVtx; } //モーションの更新 UpdateMotion(); //単発モーションが終了した場合 if(m_bFinishMotion) { if(m_bBlendMotion) { m_bBlendMotion = false; } if(GetMotion() == MOTIONTYPE_WALK) { SetMotion(MOTIONTYPE_NEUTRAL,20,true); } else { SetMotion(MOTIONTYPE_NEUTRAL,10,false); } m_bMotion = false; m_bFinishMotion = false; } }
// ハイパーアーツ bool Thief::HyperArts(void) { //空中で発動しても停止する move = Vector3(0, -GRAVITY, 0); if ( !initflag ) { sound->PlaySE( SE::HYPER_ATTACK ); sound->PlaySE( SE::KAITO_HYPER ); initflag = true; } attackInfo.power = OFFENSIVE_POWER::HYPER; attackInfo.dropPower = DROP_POWER::HYPER; attackInfo.coinDropType = DROP_TYPE::SUCTION; SetParameterState(PARAMETER_STATE::UNRIVALED); move = Vector3(0, 0 - GRAVITY, 0); //撃ってる間は静止させる SetMotion(THIEF::MOTION_DATA::HYPERARTS); // 行列から情報取得 Vector3 front = GetFront(); Vector3 right = GetRight(); Vector3 p_pos = GetPos(); SetMove(Vector3(0.0f, move.y, 0.0f)); if (obj->GetFrame() >= THIEF::MOTION_FRAME::HYPERARTS_ATTACKSTART/* && obj->GetFrame() < THIEF::MOTION_FRAME::HYPERARTS_ATTACKEND*/) { float t = GetBezier(ePrm_t::eRapid_Lv5, ePrm_t::eSlow_Lv1, attackInfo.t); Vector3 f = front * (2.0f * sinf(D3DX_PI * t)); Vector3 r = -right * (2.0f * cosf(D3DX_PI * t)); attackInfo.bottom = p_pos + f + r; switch (HyperStep) { case 0: // あたり判定のパラメータを与える attackInfo.top = attackInfo.bottom + r * HyperRate; attackInfo.r = 2.5f; HyperRate += 1.0; if (HyperRate > 20.0f) HyperStep++; break; case 1: // パラメータ加算 attackInfo.top = attackInfo.bottom + f * HyperRate + r * HyperRate; attackInfo.t += 0.03f; if (attackInfo.t >= 1.0f) { HyperStep++; } break; case 2: //attackInfo.top = attackInfo.bottom + r * rate; attackInfo.t = 0.0f; HyperRate -= 1.0f; break; } armRenderflag = true; } Vector3 v1, v2; v1 = front; v2 = attackInfo.top - attackInfo.bottom; v1.Normalize(); v2.Normalize(); float armAngle = GetAngle(v1, v2); Vector3 cross; Vector3Cross(cross, v1, v2); if (cross.y < 0) armAngle = -armAngle; arm->SetPos(pos); arm->SetAngle(angle.y + armAngle); arm->SetScale(Vector3(0.03f, 0.03f, HyperRate * 0.01f)); arm->Update(); if (HyperRate < 0) { HyperStep = 0; HyperRate = 0; armRenderflag = false; initflag = false; return true; } return false; }
void BhvGoalie::Wait(){ double x = state.self.position.x.val; double y = state.self.position.y.val; double tt = state.self.position.tt.val; static bool moving = false; SetHeadMode(HEAD_TRACK_KP); // Saving(); if(state.ball.losttime > 100) mode = RETURN_GOALMOUTH; // mode = ADJUST_POSITION; if(state.ball.visible){ if(!moving){ if(state.ball.distance < CHASE_DISTANCE){ mode = CHASE; return; } }else{ if(state.ball.distance < 300){ mode = CHASE; return; } } } moving = false; static int wait_counter = 0; if(state.ball.visible || state.ball.losttime < 10){ wait_counter = 0; //test double ex,ey,xx,xv,yx,yv,py,t; int nx,ny; ex = DetectBall::pred_x.MakePredictor(12); ey = DetectBall::pred_y.MakePredictor(12); nx = DetectBall::pred_x.data.size(); ny = DetectBall::pred_y.data.size(); if(state.ball.visibletime > 10 && ny > 10 && nx > 10 && ex < 200 && ey < 200){ xx = DetectBall::pred_x.x - 100; xv = DetectBall::pred_x.v; yx = DetectBall::pred_y.x; yv = DetectBall::pred_y.v; if(xv < -8 && xx > 0 && xx < 900){ t = -xx / xv; int x = (int)(xx + t*xv); int y = (int)(yx + t*yv); if(t < 17 && abs(y) < 300 && abs(y) > 30){ if(y < 0) SetMotion("AYAYA_LEFT"); else SetMotion("AYAYA_RIGHT"); return; } } if(xv < -5 && xx > 0 && xx < 1700){ t = -xx / xv; int mini = WALK_STOP; int minv = 10000; double v; for(int j = 0;j < t+30;j+=1){ int x = (int)(xx + j*xv); int y = (int)(yx + j*yv); int movetime = dpmga.get_cost(x,y,0); // OSYSPRINT(("time:%d, x:%d, y:%d\n",movetime,x,y)); v = j * 33 - (movetime + 100); if( v < 0) v *= -0.25; if(minv > v){ minv = (int)v; mini = dpmga.get_action(x,y,0); } } // if(GaitMaker::IsStop()) SetPresetWalk(mini); if(mini != WALK_STOP) moving = true; else moving = false; return; } } moving = false; if(state.ball.direction < -20){ SetPresetWalk(WALK_ROTATE_RIGHT360);//270);//180); }else if(state.ball.direction < 20){ SetPresetWalk(WALK_STOP); }else{ SetPresetWalk(WALK_ROTATE_LEFT360);//270);//); } /* static int seecount = 0; if(seecount++ > 150){ if(seecount > 250){ seecount = 0; } SetHeadMode(HEAD_SWING_LOCALIZATION); }else{ SetHeadMode(HEAD_TRACK); } */ // SetPresetWalk(WALK_STOP); }else{ /* wait_counter++; if(wait_counter > 300){ static int turn_counter = 0; if(turn_counter++ > 35){ wait_counter = 0; turn_counter = 0; } SetPresetWalk(WALK_ROTATE_RIGHT180); }else{ SetPresetWalk(WALK_STOP); } */ // SetHeadMode(HEAD_SWING_BALL_SEARCH); /* static int wcnt = 0; if(GaitMaker::IsStop()){ wcnt++; int goalcolor = state.game.team_color == TEAM_COLOR_RED ? YELLOW : SKYBLUE; if(wcnt > 5 || state.self.cdt[goalcolor].value > GOALPIXEL_TH){ SetPresetWalk(WALK_ROTATE_LEFT90); wcnt = 0; } }else{ if(wcnt != 0){ SetPresetWalk(WALK_STOP); wcnt = 0; } } */ SetPresetWalk(WALK_STOP); } // if(state.ball.distance > 800 && !(x < -2350 && x > -3300 && y > - 400 && y < 400)){ // mode = RETURN_GOALAREA; // } }
// クイックアーツ bool Thief::QuickArts(void) { static int time = 0; if ( !initflag ) { sound->PlaySE( SE::KAITO_QUICK ); initflag = true; } Move(); // 行列から情報取得 Vector3 up = GetUp(); Vector3 right = GetRight(); Vector3 p_pos = GetPos(); SetMove(Vector3(0.0f, move.y, 0.0f)); SetMotion(THIEF::MOTION_DATA::QUICKARTS); //if (obj->GetFrame() >= 237) obj->SetMotion(237); // 情報設定 Vector3 vec[3] = { up * 5.0f + right * 3.0f, up * 5.0f, up * 5.0f + right * -3.0f }; p_pos.y += 3.0f; float bulletSpeed = 0.5f; int playerNum = GetPlayerNum(); { //撃った時に動きが一度止まるパターン // //モーションアトデナオス(ちょうどいい感じのフレームが来たら弾発射) //if (time == 0 /* obj->GetFrame() == ○○ */ ) //{ // for (int i = 0; i < 3; i++) // { // m_BulletManager->Set(BULLET_TYPE::THIEF_01 , new ThiefBullet01, p_pos, vec[i], bulletSpeed, playerNum); // } //} //time++; ////モーションアトデナオス(終わりのモーションが来たら終了) //if (obj->GetFrame() == 237) //{ // time = 0; // return true; //} } { //撃った時に動きが止まらないパターン for (int i = 0; i < 3; i++) { m_BulletManager->Set(BULLET_TYPE::THIEF_01 , new ThiefBullet01, p_pos, vec[i], bulletSpeed, playerNum); } attackInfo.Interval = 60; initflag = false; return true; } return false; }
//============================================================================= // 初期化 //============================================================================= HRESULT CPlayerM :: Init(LPDIRECT3DDEVICE9 pDevice,int nTypeModel,D3DXVECTOR3 pos, D3DXVECTOR3 rot,bool CPU) { //デバイスの取得 m_pDevice=pDevice; //タイプの保存 m_nType=nTypeModel; for(int nCntModel = 0; nCntModel < MODELPARTS_MAX; nCntModel++) { m_apModel[nCntModel] = CModel::Create(pDevice,nCntModel,nTypeModel*12, D3DXVECTOR3(g_aKeyDef[nCntModel][0], g_aKeyDef[nCntModel][1], g_aKeyDef[nCntModel][2]), D3DXVECTOR3(g_aKeyDef[nCntModel][3], g_aKeyDef[nCntModel][4], g_aKeyDef[nCntModel][5])); } // モデルパーツ階層構造設定 m_apModel[0]->SetParent(NULL); // [0]体 → (親)NULL m_apModel[1]->SetParent(m_apModel[0]); // [1]頭 → (親)[0]体 m_apModel[2]->SetParent(m_apModel[0]); // [2]右腕 → (親)[0]体 m_apModel[3]->SetParent(m_apModel[2]); // [3]右手 → (親)[2]右腕 m_apModel[4]->SetParent(m_apModel[3]); // [3]右手 → (親)[2]右腕 m_apModel[5]->SetParent(m_apModel[0]); // [4]左腕 → (親)[0]体 m_apModel[6]->SetParent(m_apModel[5]); // [5]左手 → (親)[4]左腕 m_apModel[7]->SetParent(m_apModel[6]); // [5]左手 → (親)[4]左腕 m_apModel[8]->SetParent(m_apModel[0]); // [6]右腿 → (親)[0]体 m_apModel[9]->SetParent(m_apModel[8]); // [7]右足 → (親)[6]右足 m_apModel[10]->SetParent(m_apModel[0]); // [8]左腿 → (親)[0]体 m_apModel[11]->SetParent(m_apModel[10]); // [9]左足 → (親)[8]左足 m_Pos = pos; m_PosOld = pos; m_Rot = rot; m_rotDestModel = rot; m_Move = D3DXVECTOR3(0.0f, 0.0f, 0.0f); //パーツ総数を格納 m_nNumModel = MODELPARTS_MAX; m_nNumKey = 0; m_pKeyInfo = NULL; m_nKey = 0; m_nCountMotion = 0; m_fShotMotionRatio = 0.0f; m_nShotMotionCntPlus = 0; m_bLoopMotion = false; m_bMotion = false; m_bFinishMotion = false; m_bPause = false; m_bDispDebug = true; m_Min=D3DXVECTOR3(-30.0f,-20.0f,-30.0f); m_Max=D3DXVECTOR3(30.0f,20.0f,30.0f); // アニメーション設定 SetMotion(MOTIONTYPE_NEUTRAL); //ピクセルシェーダー用に変換1 Create_PS("source/shader/basicPS.hlsl", "PS_CHARCTER", &shaderSet.ps, &shaderSet.psc,m_pDevice); //バーテックスシェーダー用に変換1 Create_VS("source/shader/basicVS.hlsl", "VS_CHARCTER", &shaderSet.vs, &shaderSet.vsc, m_pDevice); //テクスチャ作る m_texid = TEXTURE_CHARA; //D3DXCreateTextureFromFile(pDevice, "data/TEXTURE/chara.png", &m_pD3DTex); return S_OK; }
//============================================================================= // 更新 //============================================================================= void CPlayerM :: Update(void) { //サウンドの取得 CSound *pSound; pSound = CManager::GetSound(); //キーボードの取得 CInputKeyboard *pInputKeyboard; pInputKeyboard = CManager::GetInputKeyboard(); //法線(まだ未使用) D3DXVECTOR3 normal; //変数定義 float fDiffRotY=0; if (m_bPause == false) { //// 目的の角度までの差分 //fDiffRotY = Rotation_Normalizer(m_rotDestModel.y - m_Rot.y); //// 目的の角度まで慣性をかける //m_Rot.y +=fDiffRotY * RATE_ROTATE_PLAYER; //m_Rot.y = Rotation_Normalizer(m_Rot.y); //// 位置移動 //m_Pos.x += m_Move.x; //m_Pos.z += m_Move.z; //m_Move.x += (0.0f - m_Move.x) * REGIST_MOVE; //m_Move.z += (0.0f - m_Move.z) * REGIST_MOVE; if ((m_motionType == MOTIONTYPE_SELECT && IsFinishMotion() == true)) {// ショットモーション終了 // ニュートラルモーション再生 SetMotion(MOTIONTYPE_SELECT); } if((m_motionType == MOTIONTYPE_SHOT && IsFinishMotion() == true)) {// ショットモーション終了 // ニュートラルモーション再生 SetMotion(MOTIONTYPE_NEUTRAL); } CDebugProc::Print("現在のモーション:%d,Key数:%d\n", m_motionType,m_nKey); CDebugProc::Print("割合:%f\n", m_fShotMotionRatio); if (pInputKeyboard->GetKeyPress(DIK_U)) { m_fShotMotionRatio = 0.0f; m_nShotMotionCntPlus = 0; SetMotion(MOTIONTYPE_SHOT); } if (pInputKeyboard->GetKeyPress(DIK_I)) { m_fShotMotionRatio ++; } if (pInputKeyboard->GetKeyPress(DIK_O)) { m_fShotMotionRatio --; } // アニメーション更新 if (m_motionType == MOTIONTYPE_SHOT) { UpdateShotMotion(); } else { UpdateMotion(); } } }