예제 #1
0
void
GeometryObject::SetProperties(
    Properties::Array Properties
    )
{
    ASSERT( m_bInitialized );

    //
    // Read in the properties.
    //
	for ( Properties::Iterator it=Properties.begin(); it != Properties.end(); it++ )
    {
        std::string sName = it->GetName();

        if ( it->GetFlags() & Properties::Flags::Valid )
        {
            if ( sName == sm_kapszPropertyNames[ Property_Position ] )
            {
                m_Position = it->GetVector3();
                PostChanges( System::Changes::Geometry::Position );
            }
            else if ( sName == sm_kapszPropertyNames[ Property_Orientation ] )
            {
                m_Orientation = it->GetQuaternion();
                PostChanges( System::Changes::Geometry::Orientation );
            }
            else if ( sName == sm_kapszPropertyNames[ Property_Scale ] )
            {
                m_Scale = it->GetVector3();
                PostChanges( System::Changes::Geometry::Scale );
            }
            else
            {
                ASSERT( False );
            }

            //
            // Set this property to invalid since it's already been read.
            //
            it->ClearFlag( Properties::Flags::Valid );
        }
    }
}
예제 #2
0
void 
OGREGraphicsObjectCamera::Update( f32 DeltaTime )
{
    UNREFERENCED_PARAM( DeltaTime );

    if( m_bLocked )
    {
        m_pCamera->lookAt( TOOGREVEC( m_vLookAt ) );
    }
    
    if (m_Modified) {
        PostChanges(m_Modified);
        m_Modified = System::Changes::None;
    }
}
void ConnectInputObject::Update(f32 DeltaTime) {
    ASSERT(m_bInitialized);
    m_modified = 0;

    if (m_connectInputAction->hasChanged()) {
        m_keyboardButtonData.type = 0;
        m_keyboardButtonData.down = m_connectInputAction->isActive();
        m_modified |= System::Changes::Input::Action;
        Proto::Object objectProto;
        objectProto.set_id(this->getEntity()->getParent()->getId());
        static_cast<InputScene*>(m_pSystemScene)->queueDeleteObject(objectProto);
    }
    
    PostChanges(m_modified);
}
예제 #4
0
void
InputObject::SetProperties(
    Properties::Array Properties
    )
{
    ASSERT( m_bInitialized );

	Error Err;
	Err = Errors::Failure;

    //
    // Read in the properties.
    //
    for ( Properties::Iterator it=Properties.begin(); it != Properties.end(); it++ )
    {
        if ( it->GetFlags() & Properties::Flags::Valid )
        {
            std::string sName = it->GetName();
 
            if ( sName == sm_kapszPropertyNames[Property_FKey] )
            {
				m_nFunctionKey = it->GetInt32(0);
			}
			else if ( sName == sm_kapszPropertyNames[Property_Orientation] )
			{
				m_Yaw   = it->GetFloat32(0);
				m_Pitch = it->GetFloat32(1);
				m_Roll  = it->GetFloat32(2);

				m_Orientation.x = m_Yaw;
				m_Orientation.y = m_Pitch;
				m_Orientation.z = 0;
				m_Orientation.w = 0;

				PostChanges(System::Changes::Geometry::Orientation);
			}
            else
            {
                ASSERT(False);
            }
            //
            // Set this property to invalid since it's already been read.
            //
            it->ClearFlag(Properties::Flags::Valid);
        }
    }
}
예제 #5
0
/**
 * @inheritDoc
 */
void PlayerInputObject::Update(f32 DeltaTime) {
    ASSERT(m_bInitialized);

    u32 mModified = 0;
    
    if (m_upInputAction->hasChanged()) {
        mModified |= System::Changes::Input::Velocity;
        m_velocity.y += m_upInputAction->isActive() ? -1 : 1;
    }
    if (m_rightInputAction->hasChanged()) {
        mModified |= System::Changes::Input::Velocity;
        m_velocity.x += m_rightInputAction->isActive() ? 1 : -1;
    }
    if (m_downInputAction->hasChanged()) {
        mModified |= System::Changes::Input::Velocity;
        m_velocity.y += m_downInputAction->isActive() ? 1 : -1;
    }
    if (m_leftInputAction->hasChanged()) {
        mModified |= System::Changes::Input::Velocity;
        m_velocity.x += m_leftInputAction->isActive() ? -1 : 1;
    }
    if (m_rightRotateInputAction->hasChanged()) {
        mModified |= System::Changes::Input::Rotation;
        m_rotation.z += m_rightRotateInputAction->isActive() ? -1 : 1;
    }
    if (m_leftRotateInputAction->hasChanged()) {
        mModified |= System::Changes::Input::Rotation;
        m_rotation.z += m_leftRotateInputAction->isActive() ? 1 : -1;
    }
    if (m_shotInputAction->hasChanged()) {
        if (m_shotInputAction->isActive()) {
            createShot();
        }
        mModified |= System::Changes::Input::Action;
        m_shotKeyboardButtonData->down = m_shotInputAction->isActive();
    }
    
    if (mModified != 0) {
        PostChanges(mModified);
    }
}
예제 #6
0
/**
 * @inheritDoc
 */
void PlayerInputObject::createShot(void) {
    Proto::Object shotProto;
    shotProto.set_id(ObjectId::gen().str());
    shotProto.set_name("Shot");
    shotProto.set_template_("ShotTemplate");

    auto physicSystemObject = shotProto.add_systemobjects();
    physicSystemObject->set_systemtype(Proto::SystemType::Physic);
    physicSystemObject->set_type("Movable");

    auto positionProperty = physicSystemObject->add_properties();
    positionProperty->set_name("Position");
    getVector3(&m_position, positionProperty->mutable_value());
    auto orientationProperty = physicSystemObject->add_properties();
    orientationProperty->set_name("Orientation");
    getQuaternion(&m_orientation, orientationProperty->mutable_value());

    auto networkSystemObject = shotProto.add_systemobjects();
    networkSystemObject->set_systemtype(Proto::SystemType::Network);
    networkSystemObject->set_type("Replicable");

    m_createObjectQueue->push_back(shotProto);
    PostChanges(System::Changes::Generic::CreateObject);
}