void Engine_State::switch_off(void)
{
  if ( m_on )
  {
    set_to_idle();
    m_on = false;
    emit switched_off();
  }
}
void Engine_State::change(double RPM)
{
  const double rpmOff = 50; // 50
  const double rpmIdle = 2000; // 150

  if ( RPM < rpmOff )
    {
      switch_off();
      set_to_idle();
    }
  else if ( RPM < rpmIdle )
    {
      switch_on();
      set_to_idle();
    }
  else
    {
      switch_on();
      unset_idle();
    }
}
Пример #3
0
void enemy::move_to(double x,double y) {
    if(x<0 || y<0) debug_log::report("destiny negative",err,true,true,false);
    else {
        if(x==position.first && y==position.second) set_to_idle();
        else {
            destiny.first=x;
            destiny.second=y;
            set_movement_animation();
            animation[idle_anim].stop();
        }
    }
}
Пример #4
0
void enemy::update() {
    if(spawned()) {
        if(alive()) {
            if(!idle()) { //not idle option
                position=movement_update(position,destiny,speed);
            }
            else set_to_idle(); //if reach destiny
        }
        else if(current_animation!=dead_anim) kill(); //killed
        animation[current_animation].update(); //animation update
        if(current_animation==dead_anim && animation[current_animation].is_active()==false)   deactivate();
    }
}
Пример #5
0
//ENEMY CONTROL
void enemy::stop() {
    destiny=position;
    set_to_idle();
}