TurretManager::TurretManager()
{
	//orbit01Angle = 0.0f;
	orbit02Angle = 0.0f;
	turret01Sprite = new uth::Sprite("CannonTower.png");
	turret01Texture = uthRS.LoadTexture("pixelTurrets.png");
	bulletTexture = uthRS.LoadTexture("projectileSheet.png");
	node01Texture = uthRS.LoadTexture("buttonTest.png");
	towerButtonTexture = uthRS.LoadTexture("particle.png");
	disruptorProjectile = uthRS.LoadTexture("Projectile_Disruptor.png");
	
	RocketButton = uthRS.LoadTexture("RocketButton.png");
	RailgunButton = uthRS.LoadTexture("RailgunButton.png");
	DisruptorButton = uthRS.LoadTexture("disruptorButton.png");
	CannonButton = uthRS.LoadTexture("CannonButton.png");
	BeamButton = uthRS.LoadTexture("BeamButton.png");
	GatlingLaserButton = uthRS.LoadTexture("GatlingLaserButton.png");
	CancelButton = uthRS.LoadTexture("CancelButton.png");

	CreateNodes();

	towers[0] = new ns::Button(uthEngine.GetWindow(), CannonButton);
	towers[1] = new ns::Button(uthEngine.GetWindow(), GatlingLaserButton);
	towers[2] = new ns::Button(uthEngine.GetWindow(), BeamButton);
	towers[3] = new ns::Button(uthEngine.GetWindow(), RocketButton);
	towers[4] = new ns::Button(uthEngine.GetWindow(), DisruptorButton);
	towers[5] = new ns::Button(uthEngine.GetWindow(), RailgunButton);
	
	for (size_t i = 0; i < 6; i++)
	{
		towers[i]->transform.SetScale(0.6f);
		towerButtons.emplace_back(towers[i]);
		AddChild(towerButtons.back());
		towers[i]->SetActive(false);
		towers[i]->AddTag("Tower");
	}

	cancel = new ns::Button(uthEngine.GetWindow(), CancelButton);
	AddChild(cancel);
	cancel->SetActive(false);
	cancel->AddTag("Cancel");
	cancel->transform.SetScale(0.6f);

	cancel->setCallBack([&]()
	{
		poisto();
	});

	UI = false;
}
void TurretManager::SearchNodes()
{
	for (int i = 0; i < nodes.size() - 1; i++)
	{
		auto& node = nodes[i];
		if (node->HasTag("Construct"))
		{
			towers[0]->setCallBack([&]()
			{
				CreateTurret(1, node->GetOrbit(), node->GetOrbitPos());
				poisto();
				node->RemoveTag("Construct");
				node->SetActive(false);
			});
			towers[1]->setCallBack([&]()
			{
				CreateTurret(2, node->GetOrbit(), node->GetOrbitPos());
				poisto();
				node->RemoveTag("Construct");
				node->SetActive(false);
			});
			towers[2]->setCallBack([&]()
			{
				CreateTurret(3, node->GetOrbit(), node->GetOrbitPos());
				poisto();
				node->RemoveTag("Construct");
				node->SetActive(false);
			});
			towers[3]->setCallBack([&]()
			{
				CreateTurret(4, node->GetOrbit(), node->GetOrbitPos());
				poisto();
				node->RemoveTag("Construct");
				node->SetActive(false);
			});
			towers[4]->setCallBack([&]()
			{
				CreateTurret(5, node->GetOrbit(), node->GetOrbitPos());
				poisto();
				node->RemoveTag("Construct");
				node->SetActive(false);
			});
			towers[5]->setCallBack([&]()
			{
				CreateTurret(6, node->GetOrbit(), node->GetOrbitPos());
				poisto();
				node->RemoveTag("Construct");
				node->SetActive(false);
			});

		}
	}
}
Ejemplo n.º 3
0
void AikatauluMuokkaaja::poistaJuna()
{
    QSqlQuery poisto(QString("delete from juna where junanro=\"%1\"").arg(junaTunnus_));
    emit junaPaivitetty(junaTunnus_);
    eiValittuaJunaa();
}