[Orxonox-commit 6270] r10927 - code/branches/campaignHS15/src/orxonox/controllers
gania at orxonox.net
gania at orxonox.net
Mon Dec 7 13:56:45 CET 2015
Author: gania
Date: 2015-12-07 13:56:45 +0100 (Mon, 07 Dec 2015)
New Revision: 10927
Modified:
code/branches/campaignHS15/src/orxonox/controllers/ActionpointController.cc
code/branches/campaignHS15/src/orxonox/controllers/FightingController.cc
code/branches/campaignHS15/src/orxonox/controllers/FightingController.h
Log:
fixed?
Modified: code/branches/campaignHS15/src/orxonox/controllers/ActionpointController.cc
===================================================================
--- code/branches/campaignHS15/src/orxonox/controllers/ActionpointController.cc 2015-12-07 12:26:23 UTC (rev 10926)
+++ code/branches/campaignHS15/src/orxonox/controllers/ActionpointController.cc 2015-12-07 12:56:45 UTC (rev 10927)
@@ -41,7 +41,6 @@
{
this->ticks_ = 0;
this->bPatrolling_ = false;
- this->maneuverCounter_ = 0;
this->bInLoop_ = false;
this->bLoop_ = false;
this->bEndLoop_ = false;
@@ -54,7 +53,6 @@
this->squaredaccuracy_ = 2500;
this->bFirstTick_ = true;
this->bStartedDodging_ = false;
- this->timeDodged_ = 0;
this->bDefaultPatrol_ = true;
this->bDefaultFightAll_ = true;
this->stop_ = false;
@@ -99,7 +97,7 @@
}
void ActionpointController::tick(float dt)
{
- if (!this || !this->getControllableEntity())
+ if (!this || !this->getControllableEntity() || !this->isActive())
return;
++this->ticks_;
// orxout (internal_error) << "this id = " << this->actionpointControllerId_ << endl;
@@ -112,7 +110,7 @@
if (!this || !this->getControllableEntity())
return;
- if (this->ticks_ == 1)
+ if (ActionpointController::sTicks_ == 1)
{
this->actionpointControllerId_ = ActionpointController::nextActionpointControllerId_++;
@@ -123,7 +121,7 @@
this->action_ = Action::FIGHTALL;
}
}
- if (this->ticks_ == 1)
+ if (ActionpointController::sTicks_ == 1)
{
this->timeOffset_ = 0.0f;
this->bActionCalled_ = false;
@@ -166,16 +164,20 @@
{
this->timeout_ -= dt;
}
- if (this->bStartedDodging_)
- {
- this->timeDodged_ += dt;
- }
- maneuverCounter_ += dt;
+
if (!this || !this->getControllableEntity())
return;
//maneuver every 0.25 sec ->
int step = 4;
+ if (ActionpointController::sTicks_ % 100 <= 10)
+ {
+ this->bDodge_ = false;
+ }
+ else
+ {
+ this->bDodge_ = true;
+ }
if (ActionpointController::sTicks_ % 100 == step * this->actionpointControllerId_ + 1)
{
//orxout (internal_error) << "Team " << this->getControllableEntity()->getTeam() << (this->hasTarget() ? ", got " : ", don't have") << " target" << endl;
@@ -188,13 +190,8 @@
if (this->hasTarget() && ActionpointController::sTicks_ % (ActionpointController::nextActionpointControllerId_ + 1) == (this->actionpointControllerId_))
{
- if (maneuverCounter_ > 6.0f)
- this->maneuverCounter_ = 0;
- if (this->bStartedDodging_ && this->timeDodged_ > 4.0f)
- {
- this->bStartedDodging_ = false;
- this->timeDodged_ = 0;
- }
+
+
if (!this || !this->getControllableEntity())
return;
this->maneuver();
Modified: code/branches/campaignHS15/src/orxonox/controllers/FightingController.cc
===================================================================
--- code/branches/campaignHS15/src/orxonox/controllers/FightingController.cc 2015-12-07 12:26:23 UTC (rev 10926)
+++ code/branches/campaignHS15/src/orxonox/controllers/FightingController.cc 2015-12-07 12:56:45 UTC (rev 10927)
@@ -149,9 +149,11 @@
if (!this || !this->getControllableEntity())
return;
// if (this->actionCounter_ % 3 == 0)
- if (maneuverCounter_ <= 1.2)
+ if (!this->bDodge_)
{
// orxout(internal_error) << "attacking" << endl;
+ this->bStartedDodging_ = false;
+
this->setTargetPosition(this->positionOfTarget_ - diffUnit * 50.0f);
return;
}
Modified: code/branches/campaignHS15/src/orxonox/controllers/FightingController.h
===================================================================
--- code/branches/campaignHS15/src/orxonox/controllers/FightingController.h 2015-12-07 12:26:23 UTC (rev 10926)
+++ code/branches/campaignHS15/src/orxonox/controllers/FightingController.h 2015-12-07 12:56:45 UTC (rev 10927)
@@ -81,14 +81,13 @@
Quaternion orientationOfTarget_;
Pawn* closestTarget() const;
+ bool bDodge_;
int attackRange_;
bool bShooting_;
- float maneuverCounter_;
bool bLookAtTarget_;
float deltaHp;
float previousHp;
bool bStartedDodging_;
- float timeDodged_;
//WEAPONSYSTEM DATA
int rocketsLeft_;
float timeout_;
More information about the Orxonox-commit
mailing list