void CSamplingInfEngine::Continue( int dt )
{
    PNL_CHECK_LEFT_BORDER( dt, 0);
    
    int startTime = GetMaxTime();
    PNL_CHECK_LEFT_BORDER( startTime, 0);
    
    int endTime = startTime + dt;
    SetMaxTime(endTime);
    Sampling( startTime, endTime );
}
Esempio n. 2
0
void COpenLock::ResetLockInfo()
{
	Open_lockCfg* lockCfg = OpenLockData.get(GetLockId());
	if(!lockCfg) return;

	int randRange = abs(lockCfg->random_min)+lockCfg->random_max;
	srand (time(NULL));
	m_openDegreeMin = rand()%randRange + 1;
	if(m_openDegreeMin>lockCfg->random_max)
	{
		m_openDegreeMin = lockCfg->random_max - m_openDegreeMin;
	}
	m_openDegreeMax = m_openDegreeMin + lockCfg->section;
	m_openDegreeMiddle = (m_openDegreeMin+m_openDegreeMax)/2;

	SetMaxTime(lockCfg->max_time);
	SetLeftTime(lockCfg->max_time);
	unschedule(SEL_SCHEDULE(&COpenLock::ScheduleLeftTime));
	schedule(SEL_SCHEDULE(&COpenLock::ScheduleLeftTime),1.0f,GetMaxTime()+1,0.0f);
}
Esempio n. 3
0
MIDASTimer::MIDASTimer (double maxtime) {
	base_time = 0.0;
	SetMaxTime(maxtime);
	Start();
}
void EngineStatePoolShowShot::SetActive(bool active)
{
  if (active)
  {
    GetEngine()->SetLetterbox(true);

    m_pLevel = LevelServer::Instance()->GetCurrentLevel();

    // The "take shot" animation expects the ball to be at the (x, z) origin.
    Orientation o = *(GetActivePlayer()->GetOrientation());
    Vec3f v = GetBall()->GetOrientation()->GetVertex();
    o.SetX(v.x);
    o.SetZ(v.z);

    GetActivePlayer()->SetOrientation(o); 

    if (IsOnlineGame() && 
        Engine::Instance()->GetGameState()->GetCurrentPlayerInfo()->m_isOnline) // TEST
    {
      // Player character was hidden, so unhide
      GetActivePlayer()->SetAlpha(1.0f); 
    }
    GetActivePlayer()->SetActionGo();

    Assert(GetCamera().GetPtr());    
   
    // For testing, allow user to cycle through all valid shots. 
    // Don't play on until key is pressed.
#ifdef SHOW_VALID_SHOTS
    SetMaxTime(99999.9f);
    // Debug print info on current shot
    m_validShotNum = -1;
    Blue(true);
#else
    // POOL - immediately play shot, as the use has already swing the cue.
    // But do wait if player is not user controlled, so we see the swing
    // animation.
    if (IsUserControlled())
    {
      SetMaxTime(0); 
    }
    else
    {
      SetMaxTime(GetEngine()->GetConfigFloat("golf_swing_time"));
      // Pull the camera back so we can see where the AI player is aiming.
      Camera* pCam = GetCamera().GetPtr();
      PoolCamera* pPoolCam = dynamic_cast<PoolCamera*>(pCam);
      if (pPoolCam)
      {
        pPoolCam->SetIsAiPlayer(true);
      }
      // If online player is taking shot we want the camera to be looking
      // at the player character, not behind her.
      if (IsOnlineGame())
      {
#ifdef _DEBUG
std::cout << "*** IS ONLINE, setting camera...\n";
#endif

        Orientation o = *(GetActivePlayer()->GetOrientation());
        Orientation o2 = *(GetBall()->GetOrientation());
        o2.SetYRot(o.GetYRot() + 180.0f); // look at from front
        GetBall()->SetOrientation(o2);
        GetCamera()->Reset();
      }
    }
#endif
    m_time = 0;
  }
  else
  {
    GetEngine()->SetLetterbox(false);
  }
}