Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Oct 12, 2011, 7:50:43 PM (13 years ago)
Author:
jo
Message:

Ai and tutorial improvements merged back to the trunk. AI features: all weapons are used, the ai-firestrength is configurable, bots are able to collect pickups . I've set the tutorial level as default level.

Location:
code/trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • code/trunk

  • code/trunk/src/orxonox/worldentities/ControllableEntity.cc

    r8858 r8891  
    6767        this->camera_ = 0;
    6868        this->xmlcontroller_ = 0;
    69         this->controller_ = 0;
     69        //this->controller_ = 0;
    7070        this->reverseCamera_ = 0;
    7171        this->bDestroyWhenPlayerLeft_ = false;
     
    7474        this->bMouseLook_ = false;
    7575        this->mouseLookSpeed_ = 200;
     76        this->bIsRocket_ = false;
    7677
    7778        this->server_position_         = Vector3::ZERO;
     
    189190        return counter;
    190191    }
    191    
     192
    192193    bool ControllableEntity::setCameraPosition(unsigned int index)
    193194    {
     
    309310    }
    310311
     312    void ControllableEntity::setController(Controller* val)
     313    {
     314        this->controller_ = val;
     315    }
     316
    311317    void ControllableEntity::setTarget( WorldEntity* target )
    312318    {
  • code/trunk/src/orxonox/worldentities/ControllableEntity.h

    r8706 r8891  
    9999            */
    100100            virtual void boost(bool bBoost) {}
    101            
     101
    102102            virtual void greet() {}
    103103            virtual void switchCamera();
     
    155155
    156156            inline Controller* getController() const
    157                 { return this->controller_; }
    158             inline void setController(Controller* val)
    159                 { this->controller_ = val; }
     157                { return this->controller_.get(); }
     158            void setController(Controller* val);
     159
    160160
    161161            virtual void setTarget( WorldEntity* target );
     
    163163                { return this->target_.get(); }
    164164            void setTargetInternal( uint32_t targetID );
     165            inline bool getRocket() const
     166                { return this-> bIsRocket_; }
    165167
    166168        protected:
     
    181183
    182184            Ogre::SceneNode* cameraPositionRootNode_;
     185            bool bIsRocket_; //Workaround to see, if the controllable entity is a Rocket.
    183186
    184187        private:
     
    234237            std::string cameraPositionTemplate_;
    235238            Controller* xmlcontroller_;
    236             Controller* controller_;
     239            WeakPtr<Controller> controller_;
    237240            CameraPosition* reverseCamera_;
    238241            WeakPtr<WorldEntity> target_;
  • code/trunk/src/orxonox/worldentities/pawns/Pawn.cc

    r8855 r8891  
    9393
    9494        this->isHumanShip_ = this->hasLocalController();
    95        
     95
    9696        this->setSyncMode(ObjectDirection::Bidirectional); // needed to synchronise e.g. aimposition
    9797    }
     
    450450        this->isHumanShip_ = true;
    451451    }
     452
     453    void Pawn::changedActivity(void)
     454    {
     455        SUPER(Pawn, changedActivity);
     456
     457        this->setRadarVisibility(this->isActive());
     458    }
     459
     460    void Pawn::changedVisibility(void)
     461    {
     462        SUPER(Pawn, changedVisibility);
     463        //this->setVisible(this->isVisible());
     464        this->setRadarVisibility(this->isVisible());
     465    }
     466
    452467}
  • code/trunk/src/orxonox/worldentities/pawns/Pawn.h

    r8855 r8891  
    170170            virtual const Vector3& getCarrierPosition(void) const
    171171                { return this->getWorldPosition(); };
     172            virtual void changedActivity(void); //!< To enable radarviewability when the activity is changed
     173            virtual void changedVisibility(void); //!< To enable proper radarviewability when the visibility is changed
    172174
    173175        protected:
     
    195197            float maxHealth_;
    196198            float initialHealth_;
    197            
     199
    198200            float shieldHealth_;
    199201            float maxShieldHealth_;
  • code/trunk/src/orxonox/worldentities/pawns/SpaceShip.cc

    r8858 r8891  
    298298    }
    299299
    300         /**
    301     @brief
    302         Add an Engine to the SpaceShip.
    303     @param engine
    304         A pointer to the Engine to be added.
    305     */
    306300    void SpaceShip::addEngine(orxonox::Engine* engine)
    307301    {
     
    504498    void SpaceShip::resetCamera()
    505499    {
    506         Camera *camera = this->getCamera();
    507         if (camera == 0)
    508         {
    509             orxout(internal_warning) << "Failed to reset camera!" << endl;
    510             return;
    511         }
    512 
    513         this->shakeDt_ = 0.0f;
    514         camera->setPosition(this->cameraOriginalPosition_);
    515         camera->setOrientation(this->cameraOriginalOrientation_);
     500        if(this->hasLocalController() && this->hasHumanController())
     501        {
     502            Camera *camera = this->getCamera();
     503            if (camera == 0)
     504            {
     505                orxout(internal_warning) << "Failed to reset camera!" << endl;
     506                return;
     507            }
     508            this->shakeDt_ = 0.0f;
     509            camera->setPosition(this->cameraOriginalPosition_);
     510            camera->setOrientation(this->cameraOriginalOrientation_);
     511        }
    516512    }
    517513
Note: See TracChangeset for help on using the changeset viewer.