Add Exp Bottle Effects
This commit is contained in:
@@ -4,6 +4,8 @@
|
||||
#include "Player.h"
|
||||
#include "../ClientHandle.h"
|
||||
|
||||
#include <ctime>
|
||||
|
||||
|
||||
cExpOrb::cExpOrb(double a_X, double a_Y, double a_Z, int a_Reward) :
|
||||
cEntity(etExpOrb, a_X, a_Y, a_Z, 0.98, 0.98),
|
||||
@@ -51,6 +53,12 @@ void cExpOrb::Tick(float a_Dt, cChunk & a_Chunk)
|
||||
{
|
||||
LOGD("Player %s picked up an ExpOrb. His reward is %i", a_ClosestPlayer->GetName().c_str(), m_Reward);
|
||||
a_ClosestPlayer->DeltaExperience(m_Reward);
|
||||
|
||||
srand (static_cast <unsigned> (time(0)));
|
||||
float r1 = static_cast <float> (rand()) / static_cast <float> (RAND_MAX); // Random Float Value (Java: random.nextFloat())
|
||||
float r2 = static_cast <float> (rand()) / static_cast <float> (RAND_MAX); // Random Float Value (Java: random.nextFloat())
|
||||
a_ClosestPlayer->PlaySoundEffect("random.orb", 0.1F, 0.5F * ((r1 - r2) * 0.7F + 1.8F));
|
||||
|
||||
Destroy(true);
|
||||
}
|
||||
a_Distance.Normalize();
|
||||
@@ -61,4 +69,4 @@ void cExpOrb::Tick(float a_Dt, cChunk & a_Chunk)
|
||||
BroadcastMovementUpdate();
|
||||
}
|
||||
HandlePhysics(a_Dt, a_Chunk);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user