Exemplo n.º 1
0
void BulletMLRunnerImpl::calcChangeDirection(double direction, int term,
											 bool seq)
{
	int finalTurn = actTurn_ + term;

	double dirFirst = runner_->getBulletDirection();

	if (seq) {
		auto_ptr_copy(changeDir_, new LinearFunc<int, double>
					  (actTurn_, finalTurn,
					   dirFirst, dirFirst + direction * term));
	}
	else {
		double dirSpace;

		// ちゃんと近い方を回っていくのは結構難しいね
		double dirSpace1 = direction - dirFirst;
		double dirSpace2;
		if (dirSpace1 > 0) dirSpace2 = dirSpace1 - 360;
		else dirSpace2 = dirSpace1 + 360;
		if (abs(dirSpace1) < abs(dirSpace2)) dirSpace = dirSpace1;
		else dirSpace = dirSpace2;

		auto_ptr_copy(changeDir_, new LinearFunc<int, double>
					  (actTurn_, finalTurn, dirFirst, dirFirst + dirSpace));
	}
}
Exemplo n.º 2
0
void BulletMLRunnerImpl::calcChangeSpeed(double speed, int term) {
	int finalTurn = actTurn_ + term;

	double spdFirst = runner_->getBulletSpeed();

	auto_ptr_copy(changeSpeed_, new LinearFunc<int, double>
				  (actTurn_, finalTurn, spdFirst, speed));
}
Exemplo n.º 3
0
void BulletMLRunnerImpl::calcAccelX(double vertical, int term,
									BulletMLNode::Type type)
{
	int finalTurn = actTurn_ + term;

	double firstSpd = runner_->getBulletSpeedX();
	double finalSpd;

	if (type == BulletMLNode::sequence) {
		finalSpd = firstSpd + vertical * term;
	}
	else if (type == BulletMLNode::relative) {
		finalSpd = firstSpd + vertical;
	}
	else {
		finalSpd = vertical;
	}

	auto_ptr_copy(accelx_ ,new LinearFunc<int, double>
				  (actTurn_, finalTurn, firstSpd, finalSpd));
}
void
BulletMLNode::setValue (const std::string & val)
{
   auto_ptr_copy (val_, calc (val));
}