void BallisticDemo::fire() { // Find the first available round. AmmoRound *shot; for (shot = ammo; shot < ammo+ammoRounds; shot++) { if (shot->type == UNUSED) break; } // If we didn't find a round, then exit - we can't fire. if (shot >= ammo+ammoRounds) return; // Else, setup the shot with a vector 3 to offset it from it's orientation cyclone::Vector3 direction; if (currentLauncher == 0) { direction = cyclone::Vector3(0, 0, 2.0f); } else { direction = cyclone::Vector3(0, 0, -2.0f); } shot->setState( currentShotType, (launchers[currentLauncher]->body->getPosition() + direction) ); }
void BigBallisticDemo::fire() { // Find the first available round. AmmoRound *shot; for (shot = ammo; shot < ammo+ammoRounds; shot++) { if (shot->type == UNUSED) break; } // If we didn't find a round, then exit - we can't fire. if (shot >= ammo+ammoRounds) return; // Set the shot shot->setState(currentShotType); }