[Orxonox-commit 3701] r8381 - code/branches/pickup/src/modules/pickup/items
ssgier at orxonox.net
ssgier at orxonox.net
Mon May 2 15:58:10 CEST 2011
Author: ssgier
Date: 2011-05-02 15:58:10 +0200 (Mon, 02 May 2011)
New Revision: 8381
Modified:
code/branches/pickup/src/modules/pickup/items/ShrinkPickup.cc
code/branches/pickup/src/modules/pickup/items/ShrinkPickup.h
Log:
started creating a more efficient code structure
Modified: code/branches/pickup/src/modules/pickup/items/ShrinkPickup.cc
===================================================================
--- code/branches/pickup/src/modules/pickup/items/ShrinkPickup.cc 2011-05-02 13:45:14 UTC (rev 8380)
+++ code/branches/pickup/src/modules/pickup/items/ShrinkPickup.cc 2011-05-02 13:58:10 UTC (rev 8381)
@@ -7,6 +7,9 @@
#include "pickup/PickupIdentifier.h"
#include "worldentities/pawns/Pawn.h"
+#include "weaponsystem/WeaponSlot.h"
+#include "weaponsystem/Weapon.h"
+
namespace orxonox
{
CreateFactory(ShrinkPickup);
@@ -39,11 +42,14 @@
this->Pickupable::destroy();
COUT(0) << "shrinking..." << endl;
+ //this->pawn->setScale3D(this->pawn->getScale3D() / 2.0);
std::set<WorldEntity*> set = this->pawn->getAttachedObjects();
for(std::set<WorldEntity*>::iterator it = set.begin(); it != set.end(); it++)
{
(*it)->setScale((*it)->getScale() / 5.0);
+ (*it)->setPosition((*it)->getPosition() / 5.0);
}
+
durationTimer.setTimer(10, false, createExecutor(createFunctor(&ShrinkPickup::terminate, this)));
}
else
@@ -54,6 +60,8 @@
void ShrinkPickup::terminate(void)
{
+ //this->pawn->setScale3D(this->pawn->getScale3D() * 5.0);
+
std::set<WorldEntity*> set = this->pawn->getAttachedObjects();
for(std::set<WorldEntity*>::iterator it = set.begin(); it != set.end(); it++)
{
Modified: code/branches/pickup/src/modules/pickup/items/ShrinkPickup.h
===================================================================
--- code/branches/pickup/src/modules/pickup/items/ShrinkPickup.h 2011-05-02 13:45:14 UTC (rev 8380)
+++ code/branches/pickup/src/modules/pickup/items/ShrinkPickup.h 2011-05-02 13:58:10 UTC (rev 8381)
@@ -4,6 +4,7 @@
#include "pickup/PickupPrereqs.h"
#include <string>
+#include <vector>
#include "pickup/Pickup.h"
#include "tools/interfaces/Tickable.h"
@@ -26,7 +27,18 @@
private:
void initialize(void);
- Pawn* carrierToPawnHelper(void);
+ const float duration; //determines how long the pickup will be active
+ const float shrinkFactor; //shrink factor of the space ship
+ const float shrinkDelay; //how long it takes to shrink to the final size
+ double factorPerCall;
+ bool isTerminating;
+ vector<float> defaultScales;
+ vector<float> smallScales;
+ vector<float> actualScales;
+ vector<float> defaultPositions;
+ vector<float> smallPositions;
+ vector<float> actualPositions;
+ Pawn* carrierToPawnHelper(void);
Pawn* pawn;
Timer durationTimer;
void terminate(void);
@@ -35,4 +47,4 @@
};
}
-#endif
+#endif
\ No newline at end of file
More information about the Orxonox-commit
mailing list