bool ValueAnimationInfo::Update(float timeStep)
{
    if (!animation_ || !target_)
        return true;

    currentTime_ += timeStep * speed_;

    if (!animation_->IsValid())
        return true;

    bool finished = false;

    // Calculate scale time by wrap mode
    float scaledTime = CalculateScaledTime(currentTime_, finished);

    // Apply to the target object
    ApplyValue(animation_->GetAnimationValue(scaledTime));

    // Send keyframe event if necessary
    if (animation_->HasEventFrames())
    {
        PODVector<const VAnimEventFrame*> eventFrames;
        GetEventFrames(lastScaledTime_, scaledTime, eventFrames);

        for (unsigned i = 0; i < eventFrames.Size(); ++i)
            target_->SendEvent(eventFrames[i]->eventType_, const_cast<VariantMap&>(eventFrames[i]->eventData_));
    }

    lastScaledTime_ = scaledTime;

    return finished;
}
void RemoteControlLinkage::StepSimulation()
{
	if(m_bEnabled && m_lpSourceData)
	{
		if(m_bInLink)
			ApplyValue(*m_lpSourceData);
		else
			m_Data.m_fltValue = *m_lpSourceData;
	}
}
Exemplo n.º 3
0
BOOL DTransformPosition::PreTranslateMessage(MSG* pMsg) 
{
	// TODO: Add your specialized code here and/or call the base class
	if ( (pMsg->message == WM_KEYDOWN) && (pMsg->wParam == VK_RETURN)) {
		//return CPropertyPage::PreTranslateMessage(pMsg);
		ApplyValue();
		return TRUE;
	}

	return CPropertyPage::PreTranslateMessage(pMsg);
}
Exemplo n.º 4
0
//CAN message handling function, modify it if you want to do some extra works when having receive a message.
void HandleMessage(struct CANFrame* cANFrame)
{
	int index = cANFrame->frameIndex;
	switch (cANFrame->frameType)
	{
	case(0x01) :
		//控制帧
		ApplyValue(cANFrame);
		ReplyControlMessage(index);
		break;
	case(0x02) :
		//参数帧(未用)
		break;
	case(0x03) :
		//图形帧(未用)
		break;
	case(0x04) :
		ReplyStatusMessage(0x26);
		//状态帧
		break;
	case(0x05) :
		//启动
		RunMode = 1;
		ReplyStartMessage(0x26);
		break;
	case(0x06) :
		//停止
		RunMode = 0;
		ReplyStopMessage(0x26);
		break;
	case(0x07) :
		//查询
		ReplyQueryMessage(index);
		break;
	case(0x08) :
		//ACK
		break;
	default:
		break;
	}

}