Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/pickups/src/orxonox/objects/pickup/DroppedItem.h @ 2961

Last change on this file since 2961 was 2900, checked in by danielh, 16 years ago
  • some changes to the base framework
  • added DroppedItem
  • implemented usable items and a test UsableItem (Jump), console command to use an item is "useItem"
  • added ModifierType::Acceleration
File size: 2.6 KB
RevLine 
[2900]1/*
2 *   ORXONOX - the hottest 3D action shooter ever to exist
3 *                    > www.orxonox.net <
4 *
5 *
6 *   License notice:
7 *
8 *   This program is free software; you can redistribute it and/or
9 *   modify it under the terms of the GNU General Public License
10 *   as published by the Free Software Foundation; either version 2
11 *   of the License, or (at your option) any later version.
12 *
13 *   This program is distributed in the hope that it will be useful,
14 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
15 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 *   GNU General Public License for more details.
17 *
18 *   You should have received a copy of the GNU General Public License
19 *   along with this program; if not, write to the Free Software
20 *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
21 *
22 *   Author:
23 *      Daniel 'Huty' Haggenmueller
24 *   Co-authors:
25 *      ...
26 *
27 */
28
29/**
30    @file
31    @brief Definition of BaseItem (base-class for items/pickups).
32*/
33
34#ifndef _DroppedItem_H__
35#define _DroppedItem_H__
36
37#include "OrxonoxPrereqs.h"
38
39#include "objects/Tickable.h"
40#include "objects/worldentities/StaticEntity.h"
41#include "tools/Timer.h"
42
43namespace orxonox
44{
45    class BaseItem;
46    class Pawn;
47
48    class _OrxonoxExport DroppedItem : public StaticEntity, public Tickable
49    {
50    public:
51        DroppedItem(BaseObject* creator);
52        virtual ~DroppedItem();
53
54        void tick(float dt);
55        void trigger(Pawn* pawn);
56
57        static DroppedItem* createDefaultDrop(BaseItem* item, const Vector3& position, const ColourValue& flareColour = ColourValue(0.5f, 1.0f, 0.3f), float timeToLive = 0);
58        static DroppedItem* createDefaultDrop(BaseItem* item, Pawn* pawn, const ColourValue& flareColour = ColourValue(0.5f, 1.0f, 0.3f), float timeToLive = 0);
59
60        void createTimer();
61        void timerCallback();
62
63        inline float getTriggerDistance() const
64            { return this->triggerDistance_; }
65        inline void setTriggerDistance(float distance)
66            { this->triggerDistance_ = distance; }
67
68        inline BaseItem* getItem() const 
69            { return this->item_; }
70        inline void setItem(BaseItem* item)
71            { this->item_ = item; }
72
73        inline float getTimeToLive() const
74            { return this->timeToLive_; }
75        inline void setTimeToLive(float time)
76            { this->timeToLive_ = time; }
77    private:
78        float timeToLive_;
79        float triggerDistance_;
80        BaseItem* item_;
81
82        Timer<DroppedItem> timer_;
83    };
84}
85
86#endif /* _DroppedItem_H__ */
Note: See TracBrowser for help on using the repository browser.