Exemplo n.º 1
0
Vec2f Animal::getCohesionForce(vector<Animal> animals, float dist) {
    float neighbourDist = dist;
    Vec2f sum = Vec2f(0, 0);
    int count = 0;
    for (vector<Animal>::iterator it = animals.begin(); it != animals.end(); ++it) {
        
        if (isNear(*it, neighbourDist)) {
            sum = sum + pointToVec(it->getPos());
            count++;
        }
    }
    
    if (count > 0) {
        sum = sum / count;
        return getSeek(sum);
    } else {
        return Vec2f(0, 0);
    }
}
bool FileAsset::isEOF() const
{
    return getSeek() == getSize();
}
Exemplo n.º 3
0
bool Sound::finish() const
{
    return getSeek() >= 1.0f;
}