Exemplo n.º 1
0
void
Entity::Update()
{
    if(m_MoveEntity != nullptr)
    {
        m_MovePosition = m_MoveEntity->GetPosition();
        m_MoveStopDistance = GetSolidRadius() + m_MoveEntity->GetSolidRadius();
    }

    if(m_TurnEntity != nullptr)
    {
        Ogre::Degree angle = GetDirectionToEntity(m_TurnEntity);
        angle = CalculateTurnAngle(m_TurnDirectionStart, angle);
        m_TurnDirectionEnd = angle;
    }
}
Exemplo n.º 2
0
void
Entity::SetTurn( const Ogre::Degree& direction_to, Entity* entity, const TurnDirection turn_direction, const ActionType turn_type, const float seconds )
{
    if( turn_type == AT_NONE )
    {
        SetRotation( direction_to );
        return;
    }

    m_TurnDirection = turn_direction;

    Ogre::Degree angle_start = GetRotation();
    Ogre::Degree angle_end = CalculateTurnAngle( angle_start, direction_to );

    m_TurnEntity = entity;
    m_TurnDirectionStart = angle_start;
    m_TurnDirectionEnd = angle_end;
    m_TurnType = turn_type;
    m_TurnSeconds = seconds;
    m_TurnCurrentSeconds = 0;
}