コード例 #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);
    }
}
コード例 #2
0
bool FileAsset::isEOF() const
{
    return getSeek() == getSize();
}
コード例 #3
0
ファイル: spSound.cpp プロジェクト: bekasov/SoftPixelEngine
bool Sound::finish() const
{
    return getSeek() >= 1.0f;
}