Пример #1
0
MosquitoNode::MosquitoNode(const trmb::TextureHolder& textures, sf::Vector2f position, bool active, sf::FloatRect worldBounds
	, SceneNode &houseLayer)
: mBeginSimulationEvent(0x5000e550)
, mBeginScoreboardEvent(0xf5e88b6e)
, mCreateTextPrompt(0x25e87fd8)
, mClearTextPrompt(0xc1523265)
, mTextures(textures)
, mWorldBounds(worldBounds)
, mHouseLayer(houseLayer)
, mAnimation(textures.get(Textures::ID::MosquitoAnimation))
, mPreviousPosition()
, mHasMalaria(false)
, mIndoor(false)
, mSimulationMode(false)
, mPause(false)
, mDelaySet(false)
, mActive(active)
, mTotalDelayTime()
, mUpdateDelayTime()
, mTotalMovementTime(sf::seconds(1.0))
, mUpdateMovementTime()
, mRandomDevice()				// ALW - obtain random number from hardware
, mGenerator(mRandomDevice())	// ALW - Seed the generator
, mWeightedDistribution()
{
	setPosition(position);

	mAnimation.setFrameSize(sf::Vector2i(64, 64));
	mAnimation.setNumFrames(8);
	mAnimation.setDuration(sf::seconds(1));
	mAnimation.setRepeating(true);

	if (mActive)
	{
		// ALW - A Mosquito will only spawn already active during the simulation mode.
		mSimulationMode = true;
	}

	// ALW - Change the range and weights 
	std::vector<float> intervals = { 0, 1, 2, 3 };
	std::vector<float> weights   = { 0.05f, 0.1f, 0.20f };
	decltype(mWeightedDistribution.param()) new_range(intervals.begin(), intervals.end(), weights.begin());
	mWeightedDistribution.param(new_range);
}
Пример #2
0
FlappyCatColorScheme::FlappyCatColorScheme()
: mRandomDevice()
, mGenerator(mRandomDevice())
, mScheme(ColorsSize, Color()) {
  //
}