Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 6512 for code


Ignore:
Timestamp:
Mar 11, 2010, 4:30:30 PM (15 years ago)
Author:
dafrick
Message:

Added additional pickup (TestPickup), and did some bug $fixing.

Location:
code/branches/pickup3
Files:
3 added
9 edited

Legend:

Unmodified
Added
Removed
  • code/branches/pickup3/data/levels/templates/pickup_representation_templates.oxt

    r6498 r6512  
    44            <StaticEntity>
    55                <attached>
    6                     <Billboard position="0,0,0" colour="0.5,1.0,0" material="Examples/Flare" />
     6                    <Billboard position="0,0,0" colour="0.50,0.90,0.25" material="Sphere2" scale=0.1>
     7                        <attached>
     8                            <Billboard position="0,0,0" colour="0.36,0.81,0.10" material="Cross" scale=0.3 />
     9                        </attached>
     10                    </Billboard>
    711                </attached>
    812            </StaticEntity>
     
    2529            <StaticEntity>
    2630                <attached>
    27                     <Billboard position="0,0,0" colour="0,1.0,0.5" material="Examples/Flare" />
     31                    <Billboard position="0,0,0" colour="0.50,0.90,0.25" material="Sphere2" scale=0.1>
     32                        <attached>
     33                            <Billboard position="0,0,0" colour="0.36,0.81,0.10" material="Cross" scale=0.5 />
     34                        </attached>
     35                    </Billboard>
    2836                </attached>
    2937            </StaticEntity>
     
    4654            <StaticEntity>
    4755                <attached>
    48                     <Billboard position="0,0,0" colour="0,1.0,0.5" material="Examples/Flare" />
     56                    <Billboard position="0,0,0" colour="0.50,0.90,0.25" material="Sphere2" scale=0.1>
     57                        <attached>
     58                            <Billboard position="0,0,0" colour="0.36,0.81,0.10" material="Cross" scale=0.7 />
     59                        </attached>
     60                    </Billboard>
    4961                </attached>
    5062            </StaticEntity>
     
    6779            <StaticEntity>
    6880                <attached>
    69                     <Billboard position="0,0,0" colour="0,1.0,0.5" material="Examples/Flare" />
     81                    <Billboard position="0,0,0" colour="0.50,0.90,0.25" material="Sphere2" scale=0.1>
     82                        <attached>
     83                            <Billboard position="0,0,0" colour="0.36,0.81,0.10" material="Cross" scale=1.2 />
     84                        </attached>
     85                    </Billboard>
    7086                </attached>
    7187            </StaticEntity>
  • code/branches/pickup3/src/modules/pickup/DroppedPickup.cc

    r6475 r6512  
    4040namespace orxonox
    4141{
     42   
     43    CreateFactory(DroppedPickup);
     44   
    4245    /**
    4346    @brief
     
    6366        The distance at which the PickupSpawner triggers. Default is 10.
    6467    */
    65     DroppedPickup::DroppedPickup(BaseObject* creator, Pickupable* pickup, const Vector3& position, float triggerDistance) : PickupSpawner(creator, pickup, triggerDistance, 0, 1)
     68    DroppedPickup::DroppedPickup(BaseObject* creator, Pickupable* pickup, const Vector3& position, float triggerDistance) : PickupSpawner(creator, pickup, triggerDistance, 10, 1)
    6669    {   
    6770        RegisterObject(DroppedPickup);
     
    7073       
    7174        this->setPosition(position);
     75        this->setActive(false);
     76        this->startRespawnTimer();
    7277    }
    7378
  • code/branches/pickup3/src/modules/pickup/PickupPrereqs.h

    r6496 r6512  
    7676    //items
    7777    class HealthPickup;
     78    class TestPickup;
    7879   
    7980}
  • code/branches/pickup3/src/modules/pickup/PickupRepresentation.cc

    r6484 r6512  
    154154    {
    155155        StaticEntity* representation = new StaticEntity(spawner);
    156         //TODO: Nicer...
    157         Billboard* billboard = new Billboard(spawner);
    158         billboard->setColour(ColourValue(1.0, 0.0, 0.0));
    159         billboard->setMaterial("Examples/Flare");
    160         representation->attach(billboard);
     156        Billboard* sphere = new Billboard(spawner);
     157        sphere->setColour(ColourValue(0.95, 0.85, 0.27));
     158        sphere->setMaterial("Sphere2");
     159        sphere->setScale(0.1);
     160        Billboard* icon = new Billboard(spawner);
     161        icon->setColour(ColourValue(0.89, 0.79, 0.08));
     162        icon->setMaterial("Asterix");
     163        icon->setScale(0.5);
     164        sphere->attach(icon);
     165        representation->attach(sphere);
    161166        return representation;
    162167    }
  • code/branches/pickup3/src/modules/pickup/PickupSpawner.cc

    r6499 r6512  
    216216        {
    217217            //TODO: Nicer? Does this even work?
    218             this->respawnTimer_.setTimer(this->respawnTime_, false, createExecutor(createFunctor(&PickupSpawner::respawnTimerCallback, this)));
     218            this->startRespawnTimer();
    219219
    220220            this->setActive(false);
     
    227227            this->destroy();
    228228        }
     229    }
     230   
     231    /**
     232    @brief
     233        Starts the respawn timer.
     234    */
     235    void PickupSpawner::startRespawnTimer(void)
     236    {
     237        this->respawnTimer_.setTimer(this->respawnTime_, false, createExecutor(createFunctor(&PickupSpawner::respawnTimerCallback, this)));
    229238    }
    230239   
  • code/branches/pickup3/src/modules/pickup/PickupSpawner.h

    r6496 r6512  
    101101        protected:
    102102            void decrementSpawnsRemaining(void); //!< Decrements the number of remaining spawns.
     103                       
     104            void startRespawnTimer(void);
    103105           
    104106            virtual Pickupable* getPickup(void); //!< Creates a new Pickupable.
  • code/branches/pickup3/src/modules/pickup/items/CMakeLists.txt

    r6474 r6512  
    11ADD_SOURCE_FILES(PICKUP_SRC_FILES
    22  HealthPickup.cc
     3  TestPickup.cc
    34)
  • code/branches/pickup3/src/orxonox/interfaces/PickupCarrier.h

    r6477 r6512  
    4040#include <set>
    4141#include "Pickupable.h"
     42#include "core/Identifier.h"
    4243
    4344#include "core/OrxonoxClass.h"
     
    4546namespace orxonox
    4647{
     48   
     49    class Pickup;
     50    class HealthPickup;
     51    class TestPickup;
    4752
    4853    /**
     
    5560    {
    5661        friend class Pickupable; //!< The Pickupable has full acces to its PickupCarrier.
     62        //TODO: Ugly workaround.
     63        friend class Pickup;
     64        friend class HealthPickup;
     65        friend class TestPickup;
    5766       
    5867        public:
     
    6978                    bool pickedUp = this->pickups_.insert(pickup).second;
    7079                    if(pickedUp)
     80                    {
     81                        COUT(4) << "Picked up Pickupable " << pickup->getIdentifier()->getName() << "(&" << pickup << ")." << std::endl;
    7182                        pickup->pickedUp(this);
     83                    }
    7284                    return pickedUp;
    7385                }
     
    8193            bool drop(Pickupable* pickup, bool drop = true)
    8294                {
    83                    bool dropped = this->pickups_.erase(pickup) == 1;
    84                    if(dropped && drop)
    85                    {
    86                        pickup->dropped();
    87                    }
    88                    return dropped;
     95                    bool dropped = this->pickups_.erase(pickup) == 1;
     96                    if(dropped && drop)
     97                    {
     98                        COUT(4) << "Dropping Pickupable " << pickup->getIdentifier()->getName() << "(&" << pickup << ")." << std::endl;
     99                        pickup->dropped();
     100                    }
     101                    return dropped;
    89102                }
    90103               
     
    161174            */
    162175            virtual const Vector3& getCarrierPosition(void) = 0;
     176                           
     177            //TODO: Remove.
     178            std::set<Pickupable*>& getPickups(void)
     179                { return this->pickups_; }
    163180       
    164181        private:
  • code/branches/pickup3/src/orxonox/interfaces/Pickupable.cc

    r6497 r6512  
    198198        //TODO: possible problem.
    199199        if(!created)
     200        {
    200201            this->destroy();
     202        }
    201203       
    202204        return true;
Note: See TracChangeset for help on using the changeset viewer.