本文整理汇总了C++中cChunk::IsValid方法的典型用法代码示例。如果您正苦于以下问题:C++ cChunk::IsValid方法的具体用法?C++ cChunk::IsValid怎么用?C++ cChunk::IsValid使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cChunk
的用法示例。
在下文中一共展示了cChunk::IsValid方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Tick
void cEntity::Tick(float a_Dt, cChunk & a_Chunk)
{
if (m_AttachedTo != NULL)
{
if ((m_Pos - m_AttachedTo->GetPosition()).Length() > 0.5)
{
SetPosition(m_AttachedTo->GetPosition());
}
}
else
{
if (a_Chunk.IsValid())
{
HandlePhysics(a_Dt, a_Chunk);
}
}
if (a_Chunk.IsValid())
{
TickBurning(a_Chunk);
}
if ((a_Chunk.IsValid()) && (GetPosY() < -46))
{
TickInVoid(a_Chunk);
}
else { m_TicksSinceLastVoidDamage = 0; }
}
示例2: Tick
void cEntity::Tick(float a_Dt, cChunk & a_Chunk)
{
if (m_InvulnerableTicks > 0)
{
m_InvulnerableTicks--;
}
if (m_AttachedTo != NULL)
{
Vector3d DeltaPos = m_Pos - m_AttachedTo->GetPosition();
if (DeltaPos.Length() > 0.5)
{
SetPosition(m_AttachedTo->GetPosition());
if (IsPlayer())
{
cPlayer * Player = (cPlayer *)this;
Player->UpdateMovementStats(DeltaPos);
}
}
}
else
{
if (!a_Chunk.IsValid())
{
return;
}
// Position changed -> super::Tick() called
GET_AND_VERIFY_CURRENT_CHUNK(NextChunk, POSX_TOINT, POSZ_TOINT)
TickBurning(*NextChunk);
if (GetPosY() < VOID_BOUNDARY)
{
TickInVoid(*NextChunk);
}
else
{
m_TicksSinceLastVoidDamage = 0;
}
if (IsMob() || IsPlayer() || IsPickup() || IsExpOrb())
{
DetectCacti();
}
if (IsMob() || IsPlayer())
{
// Set swimming state
SetSwimState(*NextChunk);
// Handle drowning
HandleAir();
}
// None of the above functions change position, we remain in the chunk of NextChunk
HandlePhysics(a_Dt, *NextChunk);
}
}
示例3: Tick
void cEntity::Tick(float a_Dt, cChunk & a_Chunk)
{
if (m_AttachedTo != NULL)
{
if ((m_Pos - m_AttachedTo->GetPosition()).Length() > 0.5)
{
SetPosition(m_AttachedTo->GetPosition());
}
}
else
{
if (a_Chunk.IsValid())
{
HandlePhysics(a_Dt, a_Chunk);
}
}
if (a_Chunk.IsValid())
{
TickBurning(a_Chunk);
}
}
示例4: Tick
void cPlayer::Tick(float a_Dt, cChunk & a_Chunk)
{
if (m_ClientHandle != NULL)
{
if (m_ClientHandle->IsDestroyed())
{
// This should not happen, because destroying a client will remove it from the world, but just in case
m_ClientHandle = NULL;
return;
}
if (!m_ClientHandle->IsPlaying())
{
// We're not yet in the game, ignore everything
return;
}
}
m_Stats.AddValue(statMinutesPlayed, 1);
if (!a_Chunk.IsValid())
{
// This may happen if the cPlayer is created before the chunks have the chance of being loaded / generated (#83)
return;
}
super::Tick(a_Dt, a_Chunk);
// Handle charging the bow:
if (m_IsChargingBow)
{
m_BowCharge += 1;
}
// Handle updating experience
if (m_bDirtyExperience)
{
SendExperience();
}
if (GetPosition() != m_LastPos) // Change in position from last tick?
{
// Apply food exhaustion from movement:
ApplyFoodExhaustionFromMovement();
cRoot::Get()->GetPluginManager()->CallHookPlayerMoving(*this);
m_ClientHandle->StreamChunks();
}
BroadcastMovementUpdate(m_ClientHandle);
if (m_Health > 0) // make sure player is alive
{
m_World->CollectPickupsByPlayer(this);
if ((m_EatingFinishTick >= 0) && (m_EatingFinishTick <= m_World->GetWorldAge()))
{
FinishEating();
}
HandleFood();
}
if (m_IsFishing)
{
HandleFloater();
}
// Update items (e.g. Maps)
m_Inventory.UpdateItems();
// Send Player List (Once per m_LastPlayerListTime/1000 ms)
cTimer t1;
if (m_LastPlayerListTime + cPlayer::PLAYER_LIST_TIME_MS <= t1.GetNowTime())
{
m_World->SendPlayerList(this);
m_LastPlayerListTime = t1.GetNowTime();
}
if (IsFlying())
{
m_LastGroundHeight = (float)GetPosY();
}
}
示例5: Tick
void cPlayer::Tick(float a_Dt, cChunk & a_Chunk)
{
if (m_ClientHandle != NULL)
{
if (m_ClientHandle->IsDestroyed())
{
// This should not happen, because destroying a client will remove it from the world, but just in case
m_ClientHandle = NULL;
return;
}
if (!m_ClientHandle->IsPlaying())
{
// We're not yet in the game, ignore everything
return;
}
}
if (!a_Chunk.IsValid())
{
// This may happen if the cPlayer is created before the chunks have the chance of being loaded / generated (#83)
return;
}
super::Tick(a_Dt, a_Chunk);
// Set player swimming state
SetSwimState(a_Chunk);
// Handle air drowning stuff
HandleAir();
// Handle charging the bow:
if (m_IsChargingBow)
{
m_BowCharge += 1;
}
//handle updating experience
if (m_bDirtyExperience)
{
SendExperience();
}
if (m_bDirtyPosition)
{
// Apply food exhaustion from movement:
ApplyFoodExhaustionFromMovement();
cRoot::Get()->GetPluginManager()->CallHookPlayerMoving(*this);
BroadcastMovementUpdate(m_ClientHandle);
m_ClientHandle->StreamChunks();
}
else
{
BroadcastMovementUpdate(m_ClientHandle);
}
if (m_Health > 0) // make sure player is alive
{
m_World->CollectPickupsByPlayer(this);
if ((m_EatingFinishTick >= 0) && (m_EatingFinishTick <= m_World->GetWorldAge()))
{
FinishEating();
}
HandleFood();
}
// Send Player List (Once per m_LastPlayerListTime/1000 ms)
cTimer t1;
if (m_LastPlayerListTime + cPlayer::PLAYER_LIST_TIME_MS <= t1.GetNowTime())
{
m_World->SendPlayerList(this);
m_LastPlayerListTime = t1.GetNowTime();
}
}