예제 #1
0
파일: cluzooka.cpp 프로젝트: fluxer/warmux
void CluzookaCluster::DoExplosion()
{
  if ( !m_spawned_clusters )
  {
    ApplyExplosion(GetPosition(), cfg, "weapon/cluzooka_hit", false, ParticleEngine::LittleESmoke);
  }
  else
    Ghost();    // just hide ourselvers
}
예제 #2
0
파일: cluzooka.cpp 프로젝트: fluxer/warmux
void CluzookaRocket::Explosion()
{
  if (m_timed_out) {
    DoSpawn();
    Ghost();
  } else
    WeaponProjectile::Explosion();

  flying_sound.Stop();
}
예제 #3
0
void PhysicalObj::SetEnergyDelta(int delta, Character* /*dealer*/)
{
  if (m_energy == -1)
    return;
  m_energy += delta;

  if (m_energy <= 0 && !IsGhost()) {
    Ghost();
    m_energy = -1;
  }
}
예제 #4
0
void UCheatManager::BugItWorker( FVector TheLocation, FRotator TheRotation )
{
	UE_LOG(LogCheatManager, Log,  TEXT("BugItGo to: %s %s"), *TheLocation.ToString(), *TheRotation.ToString() );

	Ghost();

	APlayerController* const MyPlayerController = GetOuterAPlayerController();
	if (MyPlayerController->GetPawn())
	{
		MyPlayerController->GetPawn()->TeleportTo( TheLocation, TheRotation );
		MyPlayerController->GetPawn()->FaceRotation( TheRotation, 0.0f );
	}
	MyPlayerController->SetControlRotation(TheRotation);
}
예제 #5
0
파일: Car.cpp 프로젝트: JannesMeyer/rac0r
void Car::updateGhosts() {
    static sf::Clock clock = sf::Clock();
    
    sf::Time time = clock.getElapsedTime();
    
    sf::Vector2f lastLocation = this->mLastLocation;
    if (this->mCarGhostDrawables.size() > 0) {
        lastLocation = this->mCarGhostDrawables.back().ghost.getPosition();
    }
    
    // add new ghost
    float ghostDistance = length(this->mCurrentLocation - lastLocation);
    if (ghostDistance >= Car::MAX_GHOSTS_DISTANCE && this->mVelocity > 0.0f) {
        sf::RectangleShape ghost(sf::Vector2f(Car::CAR_WIDTH, Car::CAR_HEIGHT));
        ghost.setOrigin(Car::CAR_WIDTH / 2.0f, Car::CAR_HEIGHT / 2.0f);
        
        sf::Vector2f dir = normalize(this->mCurrentDirection);
        ghost.setPosition(this->mCurrentLocation); // - (dir * (Car::MAX_GHOSTS_DISTANCE + 20.0f)));
        ghost.setRotation(RAD_TO_DEG(heading(dir)));
        
        ghost.setFillColor(this->mCarDrawable.getFillColor());
        
        this->mCarGhostDrawables.push_back(Ghost(ghost, time.asMilliseconds()));
        
        if (this->mCarGhostDrawables.size() >= Car::MAX_GHOSTS) {
            this->mCarGhostDrawables.erase(this->mCarGhostDrawables.begin());
        }
    }
    
    // do we need to remove some ghosts?
    std::list<Ghost>::iterator it = this->mCarGhostDrawables.begin();
    while (it != this->mCarGhostDrawables.end()) {
        if ((time.asMilliseconds() - (*it).age) >= Car::MAX_GHOSTS_AGE) {
            it = this->mCarGhostDrawables.erase(it);
        } else {
            ++it;
        }
    }
       
    // adjust alphas
    int i = this->mCarGhostDrawables.size()+1;
    //float steps = (80.0f - (80.0f * (MAX_VELOCITY / this->mVelocity))) / static_cast<float>(i);
    float steps = 80.0f / static_cast<float>(i);
    sf::Color color = this->mCarDrawable.getFillColor();
    for (std::list<Ghost>::reverse_iterator it = this->mCarGhostDrawables.rbegin(); it != this->mCarGhostDrawables.rend(); ++it) {
        color.a = steps * i--;
        (*it).ghost.setFillColor(color);
    }

}
예제 #6
0
void PhysicalObj::SetXY(const Point2d &position)
{
  CheckOverlapping();

  // Don't use METER_PER_PIXEL here: bad truncation occurs
  if (IsOutsideWorldXY(Point2i(position.x, position.y)) && can_be_ghost) {
    SetPhysXY(position / PIXEL_PER_METER);
    Ghost();
    SignalOutOfMap();
  } else {
    SetPhysXY(position / PIXEL_PER_METER);
    if (FootsInVacuum())
      StartMoving();
  }
}