Ejemplo n.º 1
0
// Update with new frames
void LKTracker::Update(cv::Mat& frame, cv::Mat& next)
{
	MotionVector::iterator iter;

	// Update all tracked region
	for(iter = this->regions.begin(); iter != this->regions.end(); ++iter)
	{
		Motion *motionRegion = *iter;
		motionRegion->Update(frame, next);
	}
}
Ejemplo n.º 2
0
void TileEntity::Update() {
	Entity::Update();
	
    // update the fire flicker
    if ( IsOnFire() ) {
        fireDurationCounter++;
        if ( !(fireFlickerVisual->IsPlayingAnimation()) ) {
            fireFlickerVisual->PlayAnimation( fireFlickerAnim );
        }
    }

    // update the motion, if we have one
    if ( !motionQueue.empty() ) {

        Motion * curMotion = motionQueue.front();

        curMotion->Update();

        if ( curMotion->IsDone() ) {
            motionQueue.pop_front();
            pos->SetToClosestTile();
            
            if ( sourceTileLoc != -1 ) {
                // grab current chamber and remove from location
                Chamber * curChamber = (ChamberManager::GetInstance()).GetCurrentChamber();
                curChamber->UnregisterTileEntityInTile( this, sourceTileLoc );
                
                // Call onExtited tile on all tile entities in previous tile
                curChamber->OnEntityExitedTile( this, sourceTileLoc );
                
                // Call onEntered tile on all tile entities except for this one in current tile
                curChamber->OnEntityEnteredTile( this, Chamber::GetTileNumFromPos( pos->GetTileX(), pos->GetTileY() ) );

                // Call onMoveCompleted on self
                OnMoveCompleted( curMotion );
            }

            delete curMotion;
        }

    }
}