//-------------------------------------------------------------- void testApp::update(){ if(getSub() > 0.58) { simpleEmitter.emit(); } if(getPlink() > 0.2 || getHiSynth() > 0.5) { plinkEmitter.emit(); } if(getBass() > 0.2) { cube.emit(); } cubeField.update(softMagnitude); simpleEmitter.update(); plinkEmitter.update(); cube.update(getSub()); cam.setPosition(0,0,cam.getPosition().z - 4); cam.setOrientation(ofVec3f(sin((double)ofGetElapsedTimeMillis()/1000)*10,cos((double)ofGetElapsedTimeMillis()/1200)*10,(double)ofGetElapsedTimeMillis()/500)); cube.position.z = cam.getPosition().z - 2000; cubeField.position.z = cam.getPosition().z; cubeField.offset += 4; simpleEmitter.emitterPosition = ofVec3f(sin((double)ofGetFrameNum()/50)*300,cos((double)ofGetFrameNum()/50)*300,cam.getPosition().z - 3000); plinkEmitter.emitterPosition = ofVec3f(sin((double)ofGetFrameNum()/50)*300,cos((double)ofGetFrameNum()/50)*300,cam.getPosition().z - 3000); }
void Player_shot::shot_regist() { substance* sub = player.getSub(); //char str[256]; if (keyboard.checkKey(KEY_INPUT_SPACE)==1) { substance* _sub = getSub(); for (int i = 0; i < getSize(); i++) { if (stage_count != 0 && _sub[i].flag == false){ /*OutputDebugStringW(L"Player_shotでメモリがfalse\n"); sprintf(str, "%d:フラグが%d\n", i, _sub[i].flag); OutputDebugString(str);*/ _sub[i].flag = true; _sub[i].x = sub[0].x; _sub[i].y = sub[0].y - 2.0f; _sub[i].z = sub[0].z; _sub[i].vx = 2.0f * sin((sub[0].angy - 180.0f) * DX_PI_F / 180.0f); _sub[i].vz = 2.0f * cos((sub[0].angy - 180.0f) * DX_PI_F / 180.0f); if (keyboard.checkKey(KEY_INPUT_C)) { _sub[i].vx *= 3; _sub[i].vz *= 3; } _sub[i].count = 0; //ショット音のフラグを立てる music.se_flag(SHOT_NO); return; } } } music.se_play(SHOT_NO); }
Player_shot::Player_shot() { mallocSub(PLAYER_SHOT_MAX); mallocEff(getSize()); /*if (getSub() == NULL) OutputDebugStringW(L"Player_shotでメモリが確保できてない\n"); else OutputDebugStringW(L"Player_shotでメモリが確保されている\n");*/ memset(getSub(), 0, sizeof(substance) * getSize()); memset(getEff(), 0, sizeof(effect) * getSize()); }
void testApp::drawDebug() { debugFbo.begin(); glDisable(GL_DEPTH_TEST); ofPushMatrix(); ofClear(0); ofSetCircleResolution(50); ofSetColor(200,0,0); ofCircle(ofPoint(ofGetWidth() - 350,350),getBass()*350); ofSetColor(255,0,200); ofCircle(ofPoint(ofGetWidth() - 350,350),getSub()*300); ofSetColor(0,200,200); ofCircle(ofPoint(ofGetWidth() - 350,750),getPlink()*200); ofSetColor(0,0,255); ofCircle(ofPoint(ofGetWidth() - 350,750),getHiSynth()*200); for(int i = 0; i < 512; i++) { if(i%2 == 0){ ofSetColor(255); }else{ ofSetColor(200); } ofRect(i*20,0,0,20,softMagnitude[i]*100); } stringstream bandNumber; bandNumber << "Band: " << floor((double) mouseX/20); ofDrawBitmapString(bandNumber.str(),mouseX,mouseY); ofPopMatrix(); debugFbo.end(); debugFbo.draw(0,0,ofGetWidth(),ofGetHeight()); glEnable(GL_DEPTH_TEST); }
void Player_shot::move() { substance *sub = getSub(); for (int i = 0; i < getSize(); i++){ if (sub[i].flag == true) { sub[i].x += sub[i].vx; sub[i].z += sub[i].vz; sub[i].count++; if (collision_detection(&enemy, enemy.getCha(), VGet(sub[i].x, sub[i].y, sub[i].z), ENEMY_MODEL_FRAMEINDEX, SHOT_POWER) == true) { sub[i].flag = false; effect_regist(VGet(sub[i].x, sub[i].y, sub[i].z)); //OutputDebugStringW(L"Player_shot Hit!!\n"); continue; } if (sub[i].count == 100) { sub[i].flag = false; //OutputDebugStringW(L"Player_shot Vanish!!\n"); } } } }
/** * Perform several algorithmic steps (or less) * @param steps on entry: requested number of steps, on exit: actual number of steps * -1 on exit means an error */ void solve(long long& steps) { int count = -1; while (true) { count++; if (count >= steps) break; if (mSubs.empty()) { steps = count; break; } Sub s = getSub(); mHandler(mIncumbent, s); int n = s.mBox.mDim; Box<FT> lb(n), rb(n); BoxUtils::divideByLongestEdge(s.mBox, lb, rb); Sub ls(lb); Sub rs(rb); putSub(ls); putSub(rs); } }
Player_shot::~Player_shot() { free(getSub()); }