コード例 #1
0
ファイル: ChatWindow.cpp プロジェクト: Y2Z/qtalk
void ChatWindow::appendMessage(const QXmppMessage &o_message)
{
    XmppMessage message(o_message);
    changeState(message.state());
    if (!message.body().isEmpty()){
        //QString bareJid = jidToBareJid(message.from()); 
        ui.messageBrowser->append(QString("%1 %2").arg(message.from()).arg(QTime::currentTime().toString()));
        if (message.html().isEmpty()) {
            ui.messageBrowser->append(message.body());
        } else {
            ui.messageBrowser->append(message.html());
        }

        if (!isActiveWindow()) {
            // notice new message
            activateWindow();
        }
    }

}
コード例 #2
0
ファイル: BaseGameLogic.cpp プロジェクト: knuke/GEngine
  void BaseGameLogic::loadGameDelegate(StrongIEventPtr event)
  {
    LOGI << "Received a event to load the game." << endl;

    // Set the loading game state.
    changeState(State::LOADING_GAME);

    // Load the game.
    std::shared_ptr<LoadGameEvent> load_game_event =
        std::static_pointer_cast<LoadGameEvent>(event);
    if (!loadGame(load_game_event->getResourceName()))
    {
      LOGE << "Loading of game from resource '"
           << load_game_event->getResourceName() << "' failed." << endl;

      LOGI << "Fireing an exit game event." << endl;
      StrongIEventPtr exit_game_event(new ExitGameEvent);
      event_mgr_->fireEvent(exit_game_event);
    }
  }
コード例 #3
0
void SelectLevel::update(double dt)
{
	// Spot light in the looking direction.
	mLight->setPosition(gCamera->getPosition() + D3DXVECTOR3(0, 5, 0));
	D3DXVECTOR3 t;
	mLight->setDirection(-*D3DXVec3Normalize(&t, &(gCamera->getPosition() - gCamera->getTarget())));

	// Only update the other menu if the state havent changed.
	if(mMenu->update(gInput->mousePosition())) 
		mSideMenu->update(gInput->mousePosition());

	gCamera->rotate(0, 0.001);
	gCamera->updateView();

	// Go to main menu on ESC.
	if(gInput->keyPressed(VK_ESCAPE)) {
		changeState(MainMenu::Instance());
		ShowCursor(false);
	}
}
コード例 #4
0
ファイル: XMLHttpRequest.cpp プロジェクト: caiolima/webkit
void XMLHttpRequest::abort()
{
    // internalAbort() calls dropProtection(), which may release the last reference.
    Ref<XMLHttpRequest> protectedThis(*this);

    if (!internalAbort())
        return;

    clearResponseBuffers();

    // Clear headers as required by the spec
    m_requestHeaders.clear();
    if ((m_state == OPENED && m_sendFlag) || m_state == HEADERS_RECEIVED || m_state == LOADING) {
        ASSERT(!m_loader);
        m_sendFlag = false;
        changeState(DONE);
        dispatchErrorEvents(eventNames().abortEvent);
    }
    m_state = UNSENT;
}
コード例 #5
0
void OSCLoginWindow::onLoginMacOSCAction()
{
//    OSCMainWindow *oscMainWin = new OSCMainWindow;
//    this->close();
//    oscMainWin->show();
//    return;
    if (ui->loginname->text().length() == 0
            || ui->password->text().length() ==0){
        ui->prompt->setText(RICH_TEXT(RED_COLOR,EMPTY_TEXT));
        return;
    }
    QNetworkRequest request(OSC_HTTPS_LOGIN_URL);
    request.setHeader(QNetworkRequest::ContentTypeHeader,"application/x-www-form-urlencoded");
    QString params = QString("username="******"&pwd=")
                        .append(ui->password->text());
    manager->post(request,QByteArray(CONVERT_TO_C_CHAR(params)));
    changeState(false);
}
コード例 #6
0
ファイル: metronome.cpp プロジェクト: mamelon/GuitareTools
void Metronome::play()
{
    playing = true;
//    QFile::exists("sons/kick.wav") ? qDebug()<<"chemin ok" : qDebug()<<"chemin nok";
//    Lecture::instance()->play("sons/kick.ogg");
    ui->playAndStopPushButton->setIcon(QIcon(":/icones/images/stop.png"));
    leftLedOn = true;
    leftLed->setPixmap(QPixmap(":/icones/images/greenLedOn.png"));
    bpm = ui->tempoDial->value();

    timerLed->start(60000/bpm);
    qDebug() << "led interval " << timerLed->interval();
    timerNeedle->start(180/bpm*60000);
    qDebug() << "needle interval " << timerNeedle->interval();
    connect(timerLed,SIGNAL(timeout()),SLOT(changeState()));
    connect(timerNeedle,SIGNAL(timeout()),SLOT(animeNeedle()));



}
コード例 #7
0
ファイル: BrainState.cpp プロジェクト: Zitrax/brainblast
bool BrainGameOver::handleEvent(SDL_Event& event)
{
	switch(event.type)
	{
	case SDL_KEYDOWN:
		if( event.key.keysym.sym == SDLK_ESCAPE )
		{
			changeState(BrainMenu::instance());
			return true;
		}
		else if( !m_text_queue.empty() )
		{
			textInput(event.key.keysym.sym);
			return true;
		}
		break;
	}

	return false;
}
コード例 #8
0
ファイル: engine.cpp プロジェクト: MentatKhan/game
void GameEngine::gameloop(SDL_Window * window)
{
  try
    {
      screen = SDL_GetWindowSurface( window );
    }
  catch(...)
    {
      std::cout << "Screen error :" << SDL_GetError() << std::endl;
    }
  //Start cap timer
  int timer = SDL_GetTicks();
  int frameTicks;
  while(!quit)
    {
      timer = SDL_GetTicks();

      gameinput();
      gamelogic();

      if(transition)
	{
	  changeState();
	}
      gamedisplay( window );


		
      //bufferflush
      fflush(stdout);
		
      frameTicks = SDL_GetTicks() - timer;
      if( frameTicks < SCREEN_TICKS_PER_FRAME)
	{
	  //Wait remaining time
	  SDL_Delay( SCREEN_TICKS_PER_FRAME - frameTicks );

	}
    }

}
コード例 #9
0
ファイル: BlobGame.cpp プロジェクト: StevenBryar/BlobGame
void BlobGame::beginEditor(){
	m_Camera->moveTo(0,0);
	SafePtrRelease(m_Editor);
	if(!m_GameObjects){
		m_GameObjects = new std::vector<GameObject*>();
	}
	m_Editing = false;
	DIR* dir;
	struct stat fileStat;
	struct dirent* dirp;
	std::string levelName;
	std::string filePath;
	unsigned int width;
	unsigned int height;
	UiButton* selectLevel = new UiButton(510,380,64,128,"Finished.png","FinishedS.png",
											FIRE_ON_RELEASED,m_Camera,loadEditor,NULL);
	m_GameObjects->push_back(selectLevel);
	m_LevelSelect = new UiListMenu(200,50,m_Camera,NULL,NULL,"tfa_squaresans.ttf",10,6);
	m_LevelSelect->setHeight(300);
	m_LevelSelect->setWidth(700);
	m_LevelSelect->addEntry("New Level");
	selectLevel->setCallBackParam(m_LevelSelect);
	
	dir = opendir("levels");
	if(dir == NULL){
		std::cout << "Levels not found!" << std::endl;
		changeState(MainMenu);
		return;
	}
	while((dirp = readdir(dir))){
		filePath = "levels/" + std::string(dirp->d_name);

		if(stat(filePath.c_str(),&fileStat)){continue;}
		if(S_ISDIR(fileStat.st_mode)){continue;}

		if(loadPreview(&levelName,&width,&height,filePath)){
			m_LevelSelect->addEntry("Name :" + levelName + " Size : " + intToString(width) + " X " + intToString(height)); 
		}
	}
	SafePtrRelease(dir);
}
コード例 #10
0
ファイル: AState.cpp プロジェクト: robotology-legacy/yarp1
void ASRestingLowerGains:: handle(ArmThread *t)
{
/*	printf("DEBUG: ASRestingLowerGains ");
	
	t->_arm_status._state = _armThread::restingLowerGains;
		
	double max = t->_arm.getMaxTorque(0);
	double delta = max/30.0;

	bool done[4];
	done[0] = t->_arm.decMaxTorques(delta, 0.0, t->_nj);
	done[1] = t->_gravity1.reduce(30);
	done[2] = t->_gravity2.reduce(30);
	done[3] = t->_gravity3.reduce(30);

	printf("decMaxTorque: %d\n", done[0]);
	// reduce max torques to 0.0
	if (done[0]&&done[1]&&done[2]&&done[3])
	{
		// lower gains smoothly
		changeState(t, ASRestingWaitIdle::instance());
		t->_arm_status._pidStatus = 0;
		printf("DEBUG: ASRestingLowerGains: DONE\n");
	}*/

	double max = t->_arm.getMaxTorque(0);
	double delta = max/30.0;

	bool done[4];
	done[0] = t->_decMaxTorques(delta, 0.0, t->_nj);
	done[1] = t->_gravity1.reduce(30);
	done[2] = t->_gravity2.reduce(30);
	done[3] = t->_gravity3.reduce(30);

	if (done[0]&&done[1]&&done[2]&&done[3])
	{
		// lower gains smoothly
		changeState(t, ASRestingWaitIdle::instance());
		t->_arm_status._pidStatus = 0;
	}
}
コード例 #11
0
ファイル: Characters.cpp プロジェクト: jindaw/learn
void Characters::subBlood()
{
//    float lb = -30;
    m_fBloodChan = - 10;
//    if (isDeath())
//    {
//        m_fBloodCurr += m_fBloodChan;
//        CCLOG(" current HP:%f", m_fBloodCurr);
//        changeState(csComeOut);
//        //控制掉血,发送一个掉血的消息
//        CCNotificationCenter::sharedNotificationCenter()->postNotification("status", this);
//    }
//    else
    {
        m_fBloodCurr += m_fBloodChan;
        CCLOG(" current HP:%f", m_fBloodCurr);
        changeState(csHurt);
        //控制掉血,发送一个掉血的消息
        CCNotificationCenter::sharedNotificationCenter()->postNotification("status", this);
    }
}
コード例 #12
0
Application::Application()
{
	getRenderWindow()->SetTitle("Set");

	Gaza::FrameSheet frameSheet(&imageManager);
	bool success = frameSheet.loadFromFile("cardFrames.xml");
	if(!success)
	{
		setRunning(false);
		return;
	}

	// frameSheet.saveToMemory();

	// setRunning(false);

	CardFrameSheetGenerator generator(&imageManager, &frameSheet);
	cardFrames = generator.generate();

	changeState(new GameState(this, cardFrames));
}
コード例 #13
0
ファイル: HighscoreList.cpp プロジェクト: nebula2/Pew
void HighscoreList::Update(Game &game){
	//update elapsedTime
	m_elapsedTime = (float)m_clock.restart().asMilliseconds();

	if (!m_startFading){
		//color the Back-Button
		if (m_back.getGlobalBounds().intersects(sf::Rect<float>((float)sf::Mouse::getPosition(game.window).x,
			(float)sf::Mouse::getPosition(game.window).y + 1.0f, 1.0f, 1.0f))){
			m_back.setColor(sf::Color(255, 128, 0));
		}
		else{
			m_back.setColor(sf::Color(255, 255, 255));
		}
	}

	//See if we should change the ScreenState
	if (m_startFading){
		fadeOut();
		changeState(game);
	}
}
コード例 #14
0
EntityStatus PudgeHookThrowState::update(PudgeEntity& pudge)
{
	if (pudge.m_Input->hasHookTarget())
	{
		m_HookTarget = pudge.m_Input->hookTarget();

	}

	pudge.m_SpeedCurrent = 0;
	pudge.m_DirectionTarget = pudge.m_Position.directionToPoint(m_HookTarget);

	if (pudge.m_DirectionCurrent == pudge.m_DirectionTarget)
	{
		ServiceLocator::GetEventService()->broadcast(Event(EVENT_TYPE_SPAWN_HOOK, new EntityEventArgs(&pudge)));

		// Change State -> Stun Recovery
		changeState(new PudgeStunRecoveryState(pudge.m_HookRecoveryTime));
	}
	
	return ENTITY_ALIVE;
}
コード例 #15
0
bool MqttSnClient::disconnect() {
   uint8_t buffer[I_RfPacketSocket::PAYLOAD_CAPACITY+1] = {0};

   Disconnect* message = reinterpret_cast<Disconnect*>(buffer);
   message->initialize();
   if (!send(buffer, message->header.length))
   {
      BT_LOG_WARNING("send DISCONNECT failed");
      return false;
   }

   changeState(DISCONNECTED);

   if(!pollLoop(buffer, DISCONNECT)) {
      BT_LOG_WARNING("wait for DISCONNECT timeout");
      return false;
   }

   return true;

}
コード例 #16
0
ファイル: Scan.cpp プロジェクト: CloudSending/main
void Scan::update()
{
	if (ofGetElapsedTimeMillis() - getSharedData().lastUpdate > 1000)
	{
		getSharedData().counter++;
		getSharedData().lastUpdate = ofGetElapsedTimeMillis();
        
        std::cout << getSharedData().counter << "," << scanned << std::endl;
        
        // 時間がたったら次へ
        if (getSharedData().counter > 2) {
            scanned = true;
        }
        
        if (getSharedData().counter > 5) {
            init();
            changeState("Flight");
        }
	}
    
}
コード例 #17
0
ファイル: Moids.cpp プロジェクト: kinoshita-lab/moids-app
void Moids::readAnalogInput()
{
	if (m_dontReadCounter)
	{
		return;
	}

	if (m_firstTimeAfterStateTransition)
	{
		m_firstTimeAfterStateTransition = false;
		makeOffset();

		int read = analogRead(m_inputMicPin) - m_micOffset;
		for (int i = 0; i < MIC_INPUT_ARRAY_LENGTH; i++)
		{
			m_micInput[i] = read;
		}
	}

	// read Input
	m_micInput[0] = analogRead(m_inputMicPin) - m_micOffset;

	// check threshold
	bool changed = checkInput();
	m_micInput[1] = m_micInput[0];

	if (changed)
	{
		if (STRICT_CHECKING) {
			// double checking
			m_micInput[0] = analogRead(m_inputMicPin) - m_micOffset;
			changed = checkInput();
			m_micInput[1] = m_micInput[0];
		}

		if (changed) {
			changeState(SoundInput);
		}
	}
}
コード例 #18
0
ファイル: engine.cpp プロジェクト: muromec/qtopia-ezx
// Input and output
void Engine::pushInstruction(QString name) {
    if (!checkState())
        return;

    Instruction *i = resolve(name);
    previousInstructionsPrecedence = i->precedence;

    // Immediate instructions
    if (!i->precedence) {
        executeInstructionOnStack(i);
        emit(stackChanged());
        return;
    }

    // Overwrite last instruction
    if (!iStack.isEmpty()
            && state == sStart
            && i->precedence
            && previousInstructionsPrecedence) {
        if ("Open brace impl" == *(iStack.top())) { // No tr
            executeInstructionOnStack("Factory"); // No tr
        } else {
            delete iStack.pop();
        }
    }

    // Evaluate previous high-precedence instructions
    if (!iStack.isEmpty()) {
        Instruction *top = resolve(*(iStack.top()));
        if (i->precedence <= top->precedence)
            doEvalStack(top->precedence);
    }

    // Push instruction onto stack
    if (state != sError) {
        iStack.push(new QString(name));
        changeState(sStart);
    }
    emit(stackChanged());
}
コード例 #19
0
bool MqttSnClient::sleep(uint16_t iSleepDuration) {
   uint8_t buffer[I_RfPacketSocket::PAYLOAD_CAPACITY+1] = {0};

   Disconnect* message = reinterpret_cast<Disconnect*>(buffer);
   message->initialize(iSleepDuration);
   if (!send(buffer, message->header.length))
   {
      BT_LOG_WARNING("send DISCONNECT failed");
      return false;
   }

   if(!pollLoop(buffer, DISCONNECT)) {
      BT_LOG_WARNING("wait for DISCONNECT timeout");
      return false;
   }

   changeState(ASLEEP);

   mSocket->suspend();

   return true;
}
コード例 #20
0
ファイル: Device.cpp プロジェクト: waggle-sensor/wagman
byte Device::kill()
{
    if (state == STATE_DISABLED)
        return ERROR_INVALID_ACTION;

    Logger::begin(name);
    Logger::log("killing");
    Logger::end();

    Record::setRelayState(port, RELAY_TURNING_OFF);
    delay(10);
    Wagman::setRelay(port, false);
    delay(500);
    Record::setRelayState(port, RELAY_OFF);
    delay(10);

    changeState(STATE_STOPPED);

    startTimer.reset();

    return 0;
}
コード例 #21
0
ファイル: GameEngine.cpp プロジェクト: Clever-Boy/mario
/**
 * Starts game engine, creates window and renderer
 */
int GameEngine::init() 
{
	window = SDL_CreateWindow( "SDL Tutorial", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, Mario::SCREEN_WIDTH, Mario::SCREEN_HEIGHT, SDL_WINDOW_SHOWN );
	if( window == NULL )
	{
		printf( "Window could not be created! SDL_Error: %s\n", SDL_GetError() );
		return Mario::STATUS_FATAL;
	}
	renderer = SDL_CreateRenderer( window, -1, SDL_RENDERER_ACCELERATED );
	if (renderer == NULL) 
	{
		printf( "Could not create renderer. SDL_Error: %s\n", SDL_GetError() );
		return Mario::STATUS_FATAL;
	}
	// Set render draw color to WHITE
	SDL_SetRenderDrawColor( renderer, 0xFF, 0xFF, 0xFF, 0xFF );

	set_next_state(STATE_INIT);
	changeState();

	return Mario::STATUS_OK;
}
コード例 #22
0
ファイル: SoundSet.cpp プロジェクト: nebula2/Pew
void SoundSet::Update(Game &game){

	//update elapsedTime
	m_elapsedTime = (float)m_clock.restart().asMilliseconds();

	//Update Mouse Rectangle
	m_MouseRect = sf::Rect<float>((float)sf::Mouse::getPosition(game.window).x,
		(float)sf::Mouse::getPosition(game.window).y + 1.0f, 1.0f, 1.0f);

	if (!m_startFading){
		m_selectionString.Update(m_selectionStream, m_selection);

		if (m_selection != game.getVolume())
			game.setVolume(m_selection);
	}

	//See if we should change the ScreenState
	if (m_startFading){
		fadeOut();
		changeState(game);
	}
}
コード例 #23
0
void FrequencyEstimator::handleEvent(const Event *event)
{
    double now = event->time();
    switch(event->type())
    {
    case SPIKE:
        if(m_tPrevSpike > 0 && m_state) {
            double isi, weight;
            isi = now - m_tPrevSpike;
            weight = exp(-isi/FE_TAU);
            m_frequency = (1-weight)/isi + weight*m_frequency;
            emitTrigger();
            Logger(Debug, "FrequencyEstimator(%d): Estimated frequency: %g\n", id(), m_frequency);
        }
        m_tPrevSpike = now; // Updates last spike also when TOGGLE is off.
        break;
    case TOGGLE:
        changeState();
        Logger(Debug, "FrequencyEstimator(%d): Toggled at %9.3f.\n", id(), GetGlobalTime());
        break;
    }
}
コード例 #24
0
ファイル: Socket.cpp プロジェクト: RoboBuddie/gubg
            ReturnCode bind(int port)
            {
                MSS_BEGIN(ReturnCode);

                MSS(state == Fresh, InvalidState);

                MSS(port > 0, PortTooLow);
                MSS(port < 65536, PortTooHigh);
                std::ostringstream oss;
                oss << port;
                struct addrinfo hints, *res;
                ::memset(&hints, 0, sizeof(hints));
                hints.ai_family = AF_UNSPEC;
                hints.ai_socktype = SOCK_STREAM;
                hints.ai_flags = AI_PASSIVE;
                MSS(::getaddrinfo(0, oss.str().c_str(), &hints, &res) == 0, CouldNotGetAddrInfo);
                MSS(::bind(fid, res->ai_addr, res->ai_addrlen) != -1, CouldNotBind);

                changeState(Bound);

                MSS_END();
            }
コード例 #25
0
ファイル: rs_sync.cpp プロジェクト: DeathBorn/mongo
    /* should be in RECOVERING state on arrival here.
       readlocks
       @return true if transitioned to SECONDARY
    */
    bool ReplSetImpl::tryToGoLiveAsASecondary(OperationContext* txn, OpTime& /*out*/ minvalid) {
        bool golive = false;

        lock rsLock( this );

        if (_maintenanceMode > 0) {
            // we're not actually going live
            return true;
        }

        // if we're blocking sync, don't change state
        if (_blockSync) {
            return false;
        }

        Lock::GlobalWrite writeLock(txn->lockState());

        // make sure we're not primary, secondary, rollback, or fatal already
        if (box.getState().primary() || box.getState().secondary() ||
            box.getState().fatal()) {
            return false;
        }

        minvalid = getMinValid(txn);
        if( minvalid <= lastOpTimeWritten ) {
            golive=true;
        }
        else {
            sethbmsg(str::stream() << "still syncing, not yet to minValid optime " <<
                     minvalid.toString());
        }

        if( golive ) {
            sethbmsg("");
            changeState(MemberState::RS_SECONDARY);
        }
        return golive;
    }
コード例 #26
0
ファイル: AState.cpp プロジェクト: robotology-legacy/yarp1
void ASRestingInit:: handle(ArmThread *t)
{
	t->_arm_status._state = _armThread::restingInit;

	ARM_STATE_DEBUG(("ASRestingInit\n"));
	t->_restingInhibited = true;
	t->_directCommand(firstPosition);

	// prepare ASMove state...
	ASMove *asmove = ASMove::instance();
	asmove->setCmd(secondPosition);
	asmove->setNext(ASRestingLowerGains::instance());
	
	// prepare wait state
	ASWaitForMotion *waitState = ASWaitForMotion::instance();
	waitState->setNext(asmove);
	
	// chenge to wait state
	changeState(t,waitState);

	// signal end of motion
	t->writeAndSend(YBVArmRest);
}
コード例 #27
0
ファイル: mainwindow.cpp プロジェクト: andeliero92/PaO
void mainwindow::closeFile(){
    if(shop.isEmpty()) return;
    if(shop.isChanged()){
		QMessageBox msgBox;
        msgBox.setText(tr("The document has been modified."));
        msgBox.setInformativeText(tr("Do you want to save your changes?"));
        msgBox.setStandardButtons(QMessageBox::Save | QMessageBox::Discard);
        msgBox.setDefaultButton(QMessageBox::Save);
        int ret = msgBox.exec();
		if(ret==QMessageBox::Save){
            saveFile();
		}
    }
    NRow->disconnect(this,SLOT(addElement()));
    DRow->disconnect(tbl,SLOT(removeRow()));
    tbl->disconnect(this,SLOT(changeState()));
    shop.deleteAll();
    delete tbl;
    tbl=0;
	NRow->setEnabled(false);
	DRow->setEnabled(false);
	setWindowTitle("GuitarShop");
}
コード例 #28
0
ファイル: Settings.cpp プロジェクト: nebula2/Pew
void Settings::Update(Game &game){

	//update elapsedTime
	m_elapsedTime = (float)m_clock.restart().asMilliseconds();

	//Update Mouse Rectangle
	m_MouseRect = sf::Rect<float>((float)sf::Mouse::getPosition(game.window).x,
		(float)sf::Mouse::getPosition(game.window).y + 1.0f, 1.0f, 1.0f);

	if (!m_startFading){
		//Update Mouse selection
		updateMouseSelection();

		//Color the buttons
		updateButtonColor();
	}

	//See if we should change the ScreenState
	if (m_startFading){
		fadeOut();
		changeState(game);
	}
}
コード例 #29
0
ファイル: Socket.cpp プロジェクト: RoboBuddie/gubg
            ReturnCode connect(const string &ip, int port)
            {
                MSS_BEGIN(ReturnCode);

                MSS(state == Fresh, InvalidState);

                MSS(port > 0, PortTooLow);
                MSS(port < 65536, PortTooHigh);

                struct addrinfo hints, *res;
                int sockfd;
                ::memset(&hints, 0, sizeof(hints));
                hints.ai_family = AF_UNSPEC; //Use IPv4 or IPv6, whichever
                hints.ai_socktype = SOCK_STREAM;
                ostringstream oss;
                oss << port;
                MSS(::getaddrinfo(ip.c_str(), oss.str().c_str(), &hints, &res) == 0, CouldNotGetAddrInfo);
                MSS(::connect(fid, res->ai_addr, res->ai_addrlen) != -1, CouldNotConnect);

                changeState(Connected);

                MSS_END();
            }
コード例 #30
0
ファイル: Bullet.cpp プロジェクト: sinjax/bassinvaders
void Bullet::reactToCollision(Entity* pOther)
{
	switch(pOther->getType())
	{
		case RT_ENEMY:
		{
			/* Bullet has hit an enemy.
			 * Remember that the enemy Entity will figure out what it
			 * should be doing at this point. All the bullet cares is that it
			 * has now ceased to be.
			 */
			changeState(RS_DEAD);
		}break;

		case RT_POWERUP:
		case RT_FRIENDLY:
		case RT_NEUTRAL:
		default:
		{
			return;
		}
	}
}