Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Nov 30, 2015, 9:34:54 PM (8 years ago)
Author:
gania
Message:

tried to fix fighting whn fps is low

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/campaignHS15/src/orxonox/controllers/ActionpointController.cc

    r10903 r10906  
    5353        this->squaredaccuracy_ = 2500;
    5454        this->bFirstTick_ = true;
    55 
     55        this->bStartedDodging_ = false;
     56        this->timeDodged_ = 0;
    5657        RegisterObject(ActionpointController);
    5758
     
    7879            this->timeout_ -= dt;
    7980        }
     81        if (this->bStartedDodging_)
     82        {
     83            this->timeDodged_ += dt;
     84            if (this->timeDodged_ > 2.0f)
     85            {
     86                this->bStartedDodging_ = false;
     87                this->timeDodged_ = 0;
     88            }
     89        }
     90        maneuverCounter_ += dt;
     91        if (maneuverCounter_ > 6.0f)
     92            maneuverCounter_ = 0;
    8093        if (timeout_ <= 0)
    8194            this->bFiredRocket_ = false;
     
    110123            this->bFirstTick_ = false;
    111124        }
    112 
     125        if (this->hasTarget())
     126        {
     127            this->maneuver();
     128            if (static_cast<int>(this->maneuverCounter_*100) % 3 == 0)
     129                this->bShooting_ = this->canFire();
     130        }
    113131        SUPER(ActionpointController, tick, dt);
    114132    }
     
    123141        this->deltaHp = orxonox_cast<Pawn*> (this->getControllableEntity())->getHealth() - this->previousHp;
    124142        this->previousHp = orxonox_cast<Pawn*> (this->getControllableEntity())->getHealth();
     143
    125144        // if (this->actionCounter_ % 2 == 0)
    126145        //No action -> pop one from stack
     
    236255            }
    237256        }
    238         if (this->hasTarget())
    239         {
    240             this->maneuver();
    241             this->bShooting_ = this->canFire();
     257
    242258            // Vector3 healthPosition = bestHealthPickup((this->target_->getWorldPosition() - this->getControllableEntity()->getWorldPosition()).length());
    243259            // if ((this->getControllableEntity()->getWorldPosition() - healthPosition).length() < this->tolerance_)
     
    252268            // //----fire if you can----
    253269            // this->bShooting_ = this->canFire(); 
    254         }
     270         
    255271        this->actionCounter_ += this->actionCounter_ < 100000 ? 1 : -this->actionCounter_ ;
    256272
Note: See TracChangeset for help on using the changeset viewer.