void AMagnetTile::Tick( float DeltaTime )
{
	Super::Tick( DeltaTime );
	lockFrameTimer += DeltaTime;

	if ( enabled && lockFrameTimer >= lockFPS)
	{
		FHitResult hit;
		auto hitActor = GetMagnetHitActor( hit );
		bool hitBall = false;
		bool hitPortal = false;
		if ( isActivated() )
		{
			UpdateBallPawnSearch( hitActor );
			UpdatePortalSearch( hitActor , hit );
		}

		auto emitter = magnetParticle->EmitterInstances[0];
		if ( emitter != nullptr )
		{
			//update magnet particle 	
			magnetEndPos = hit.bBlockingHit ? hit.ImpactPoint : GetClampedForwardVector( true ) + GetActorLocation();
			magnetParticle->EmitterInstances[0]->SetBeamTargetPoint( magnetEndPos , 0 );
		}

		lockFrameTimer = .0f;
	}

}
Beispiel #2
0
bool SingleIncident::update( double dTime, float fElapsedTime )
{
	assert( !m_trigger.empty() );
	assert( !m_action.empty() );

	if ( !checkTrigCountRemained() )
		return false;

	if ( !isActivated() )
	{
		// The first action is not triggered yet.
		// Check each condition of triggers.
		int satisCount = 0;
		TriggerList::iterator itTrig = m_trigger.begin();
		for( ; itTrig != m_trigger.end(); itTrig++ )
		{
			if ( (*itTrig)->check() )
			{
				satisCount++;
			}
			else
			{
				// One of the trigger conditions is not satisfied. Do nothing.
				return false;
			}
		}

		// All triggers satisfy its condition.
		assert( satisCount == (int) m_trigger.size() );
		activate();
	}

	// All triggers are satisfied.
	return true;
}
Beispiel #3
0
void MMSLabelWidget::getForeground(MMSFBColor *color) {
    color->a = 0;

    if (isActivated()) {
        if (isSelected()) {
            *color = getSelColor();
        }
        else {
            *color = getColor();
        }
        if (isPressed()) {
            MMSFBColor mycol;
            if (isSelected()) {
                mycol = getSelColor_p();
                if (mycol.a>0) *color=mycol;
            }
            else {
                mycol = getColor_p();
                if (mycol.a>0) *color=mycol;
            }
        }
    }
    else {
        if (isSelected()) {
            *color = getSelColor_i();
        }
        else {
            *color = getColor_i();
        }
    }
}
Beispiel #4
0
bool Placeable::click(Object *triggerer) {
	// If the placeable is locked, just play the apropriate sound and bail
	if (isLocked()) {
		playSound(_soundLocked);
		return false;
	}

	// If the object was destroyed, nothing more can be done with it
	if (_state == kStateDestroyed)
		return true;

	_lastUsedBy = triggerer;

	// Objects with an inventory toggle between open and closed
	if (_hasInventory) {
		if (isOpen())
			return close(triggerer);

		return open(triggerer);
	}

	// Objects without an inventory toggle between activated and deactivated
	if (isActivated())
		return deactivate(triggerer);

	return activate(triggerer);
}
bool GdiBitmapBufferedContext::deactivate()
{
	if (!isActivated()) return true;
	if (NULL == memBmp_ || NULL == memDC_ || NULL == hDC_) return false;

	setActivation(false);
	return true;
}
Beispiel #6
0
bool Pass::isActivated() const
{
    auto ptr = lock();
    
    if(ptr)
        return ptr->isActivated();
    return false;
}
bool GdiPrintContext::deactivate()
{
	if (!isActivated()) return true;
	if (NULL == memBmp_ || NULL == memDC_ || NULL == printDC_) return false;

	setActivation(false);
	return true;
}
Beispiel #8
0
void SubassemblyView::draw ( void ) const
{
  lC::Render::Mode mode = lC::Render::REGULAR;

  if ( isActivated() )
    mode = lC::Render::ACTIVATED;
  else if ( isHighlighted() )
    mode = lC::Render::HIGHLIGHTED;

  drawer_->draw( parent()->renderStyle(), parent()->selectionType().entity_, mode );

  // If activated and we have any dimensioned constraints, draw the dimensions

  if ( isActivated() )
    for ( uint i = 0; i < 3; i++ )
      if ( dimensions_[i] != 0 )
	dimensions_[i]->draw();
}
bool GdiBitmapBufferedContext::resize(const int x1, const int y1, const int x2, const int y2)
{
	if (isActivated()) return false;
	drawRegion_ = Region2<int>(x1, y1, x2, y2);

	deleteOffScreen();

	return createOffScreen();
}
bool WglBitmapBufferedContext::deactivate()
{
	if (!isActivated()) return true;
	if (NULL == memBmp_ || NULL == memDC_ || NULL == hDC_) return false;

	setActivation(false);

	return wglMakeCurrent(NULL, NULL) == TRUE;
}
Beispiel #11
0
bool GdiContext::deactivate()
{
	if (!isActivated()) return true;
	if (NULL == hDC_) return false;

	setActivation(false);

	return true;
}
bool GdiBitmapBufferedContext::activate()
{
	if (isActivated()) return true;
	if (NULL == memBmp_ || NULL == memDC_ || NULL == hDC_) return false;

	setActivation(true);
	return true;

	// draw something into memDC_
}
bool GdiPrintContext::activate()
{
	if (isActivated()) return true;
	if (NULL == memBmp_ || NULL == memDC_ || NULL == printDC_) return false;

	setActivation(true);
	return true;

	// draw something into memDC_
}
void
StructuralInterfaceElementPhF :: updateYourself(TimeStep *tStep)
{
    Element :: updateYourself(tStep);

    // record initial displacement if element not active
    if ( activityTimeFunction && !isActivated(tStep) ) {
        this->computeVectorOf(VM_Total, tStep, initialDisplacements);
    }
}
Beispiel #15
0
bool GdiContext::activate()
{
	if (isActivated()) return true;
	if (NULL == hDC_) return false;

	setActivation(true);

	return true;

	// draw something into hDC_
}
Beispiel #16
0
void GritObject::notifyFade (lua_State *L,
                             const GritObjectPtr &self,
                             const float fade)
{
    if (gritClass==NULL) GRIT_EXCEPT("Object destroyed");

    if (!isActivated()) return;

    STACK_BASE;
    //stack is empty

    push_cfunction(L, my_lua_error_handler);
    int error_handler = lua_gettop(L);

    //stack: err

    // call into lua...
    //stack: err
    getField(L, "setFade");
    //stack: err, class, callback
    if (lua_isnil(L, -1)) {
        // TODO(dcunnin): We should add needsFadeCallbacks.
        // This might be part of a genreal overhaul of lod levels, etc.

        // no setFade function, do nothing
        lua_pop(L, 2);
        //stack is empty
        STACK_CHECK;
        return;
    }

    //stack: err, callback
    // we now have the callback to play with
    
    push_gritobj(L, self); // persistent grit obj
    lua_pushnumber(L, fade); // fade
    //stack: err, callback, persistent, fade
    int status = lua_pcall(L, 2, 0, error_handler);
    if (status) {
        //stack: err, msg
        // pop the error message since the error handler will
        // have already printed it out
        lua_pop(L, 1);
        object_del(L, self);
        //stack: err
    }
    //stack: err

    lua_pop(L, 1);
    //stack is empty
    STACK_CHECK;

}
Beispiel #17
0
void SingleIncident::addTrigger( Trigger* trigger )
{
	if ( !isActivated() )
	{
		if ( trigger )
			m_trigger.push_back( trigger );
		else
			OutputDebugString( _T( " - EpWarn: Null 'Trigger' pointer will be ignored.\n" ) );
	}
	else
		throw std::runtime_error( "You cannot add any trigger after the incident activated" );
}
Beispiel #18
0
void SingleIncident::addAction( Action* action )
{
	if ( !isActivated() )
	{
		if ( action )
			m_action.push_back( action );
		else
			OutputDebugString( _T( " - EpWarn: Null 'Action' pointer will be ignored.\n" ) );
	}
	else
		throw std::runtime_error( "You cannot add any action after the incident activated" );
}
void UTilesManager::UpdateGroupedBlockingTiles()
{
	for (int32 i = 0; i < activatedGroupedBlocks.Num(); i++)
	{
		auto gbt = activatedGroupedBlocks[i];
		if (!gbt->isActivated())
		{
			activatedGroupedBlocks.RemoveAt(i);
			i--;
		}
	}

	for (int32 i = 0; i < activatedBlocks.Num(); i++)
	{
		auto bt = activatedBlocks[i];
		if (!bt->isActivated())
		{
			activatedBlocks.RemoveAt(i);
			i--;
		}
	}
}
Beispiel #20
0
void TabContainer::activate(std::size_t index)
{
	if (index != mActivatedTab)
	{
		// ALW - A new tab has been activated
		if (isActivated())
		{
			// ALW - Unactivate the old tab
			mTabs.at(mActivatedTab)->deactivate();
		}

		mTabs.at(index)->activate();
		mActivatedTab = index;
	}
}
bool WglBitmapBufferedContext::activate()
{
	if (isActivated()) return true;
	if (NULL == memBmp_ || NULL == memDC_ || NULL == hDC_) return false;

	const bool ret = (wglGetCurrentContext() == wglRC_) ? true : (wglMakeCurrent(memDC_, wglRC_) == TRUE);
	if (ret)
	{
		setActivation(true);
		return true;
	}
	else return false;

	// draw something into rendering context
}
Beispiel #22
0
// Retrieve/restore all connections, on all buses.
// return the total number of effective (re)connection attempts...
int qtractorEngine::updateConnects (void)
{
	// It must be activated, sure...
	if (!isActivated())
		return 0;

	// On all dependable buses...
	int iUpdate = 0;

	iUpdate += updateConnects(m_buses.first());
	iUpdate += updateConnects(m_busesEx.first());

	// Done.
	return iUpdate;
}
bool WglBitmapBufferedContext::resize(const int x1, const int y1, const int x2, const int y2)
{
	if (isActivated()) return false;
	drawRegion_ = Region2<int>(x1, y1, x2, y2);

	// delete rendering context
	if (wglRC_)
	{
		wglDeleteContext(wglRC_);
		wglRC_ = NULL;
	}

	deleteOffScreen();

	return createOffScreen();
}
Beispiel #24
0
bool StartIncidentAction::update( double dTime, float fElapsedTime )
{
	Action::update( dTime, fElapsedTime );

	if ( isActivated() )
	{
		// Incident::update() returns true when all actions are finished.
		// Action::update() returns true when the update is valid which means this update is needed.
		bool allActionsFinished = m_incident->update( dTime, fElapsedTime );
		if ( allActionsFinished )
		{
			deactivate();
			return false;
		}
	}
	return true;
}
Beispiel #25
0
void SubassemblyView::select ( SelectionType /*select_type*/ ) const
{
  glLoadName( selectionName() );

  drawer_->select( parent()->selectionType().entity_, lC::Render::REGULAR );

  if ( isActivated() ) {
    glPushName( dimension_name_ );
    for ( uint i = 0; i < 3; i++ )
      if ( dimensions_[i] != 0 ) {
	glPushName( i );
	dimensions_[i]->select();
	glPopName();
      }
    glPopName();
  }
}
Beispiel #26
0
bool Placeable::deactivate(Object *user) {
	if (_hasInventory)
		return false;

	if (!isActivated())
		return true;

	if (isLocked()) {
		playSound(_soundLocked);
		return false;
	}

	playSound(_soundUsed);
	runScript(kScriptUsed, this, user);

	_state = kStateDeactivated;

	return true;
}
Beispiel #27
0
void ofxWidget::setFocus(bool focus_) {

	if (focus_ == isActivated())
		return;

	// callback previous widget telling it that it 
	// loses focus
	if (auto previousElementInFocus = sFocusedWidget.lock())
		if (previousElementInFocus->onFocusLeave)
			previousElementInFocus->onFocusLeave();

	sFocusedWidget = mThis;

	// callback this widget telling it that it 
	// receives focus
	if (auto nextFocusedWidget = sFocusedWidget.lock())
		if (nextFocusedWidget->onFocusEnter)
			nextFocusedWidget->onFocusEnter();
}
Beispiel #28
0
/*!
    This virtual event handler receives all events for the managed
    widget. QGraphicsLayout uses this event handler to listen for layout
    related events such as geometry changes, layout changes or layout
    direction changes.

    \a e is a pointer to the event.

    You can reimplement this event handler to track similar events for your
    own custom layout.

    \sa QGraphicsWidget::event(), QGraphicsItem::sceneEvent()
*/
void QGraphicsLayout::widgetEvent(QEvent *e)
{
    switch (e->type()) {
    case QEvent::GraphicsSceneResize:
        if (isActivated()) {
            setGeometry(parentLayoutItem()->contentsRect());
        } else {
            activate(); // relies on that activate() will call updateGeometry()
        }
        break;
    case QEvent::LayoutRequest:
        activate();
        break;
    case QEvent::LayoutDirectionChange:
        invalidate();
        break;
    default:
        break;
    }
}
Beispiel #29
0
void
Truss2d :: computeLumpedMassMatrix(FloatMatrix &answer, TimeStep *tStep)
// Returns the lumped mass matrix of the receiver. This expression is
// valid in both local and global axes.
{
    Material *mat;
    double halfMass;
    GaussPoint *gp = integrationRulesArray [ 0 ]->getIntegrationPoint(0);

    answer.resize(4, 4);
    answer.zero();
    if ( !isActivated(tStep) ) {
        return;
    }

    mat        = this->giveMaterial();
    halfMass   =  mat->give('d', gp) * this->giveCrossSection()->give(CS_Area) * this->giveLength() / 2.;
    answer.at(1, 1) = halfMass;
    answer.at(2, 2) = halfMass;
    answer.at(3, 3) = halfMass;
    answer.at(4, 4) = halfMass;
}
Beispiel #30
0
void CMovement::UpdateMovement(vfloat32 time) {
	if(!isActivated())
		return;
	
	_sprite->UpdateAnimation(time);
	
	if(_frame != _sprite->getFrame()){
		_frame = _sprite->getFrame();

		//printf("\n 1 %d %d",_characterPosition->getX(), _characterPosition->getY());
		//printf("\n 2 %d %d %d",_frame, _offsetPerFrame[_frame]->getX(), _offsetPerFrame[_frame]->getY());
		*_characterPosition += *_offsetPerFrame[_frame];
		//printf("\n 3 %d %d",_characterPosition->getX(), _characterPosition->getY());
		_position->setXY(*_characterPosition);
		//printf("\n 4 %d %d",_characterPosition->getX(), _characterPosition->getY());

		/*
		if( _positionPerFrame[_frame]->getX() != 0){
			printf("\nX %d ",_positionPerFrame[_frame]->getX());
			printf("\nY %d ",_positionPerFrame[_frame]->getY());
		}
		*/

		*_position += *_positionPerFrame[_frame];

		_sprite->MoveSpriteToPos(_position);
	}
	

	_currentDuration += time;
	if(_currentDuration >= _totalDuration){
		if(_loopeable){
			_currentDuration = 0;
		}else{
			setActivated(false);
		}
	}
} // UpdateMovement