Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/pickups/src/orxonox/objects/pickup/Jump.h @ 2948

Last change on this file since 2948 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: 3.0 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 Jump.
32*/
33
34#ifndef _Jump_H__
35#define _Jump_H__
36
37#include "OrxonoxPrereqs.h"
38
39#include "UsableItem.h"
40#include "util/Math.h"
41
42namespace orxonox
43{
44    class Pawn;
45
46    /**
47        @brief Jump-item, enables player to "jump" into a direction.
48    */
49    class _OrxonoxExport Jump : public UsableItem
50    {
51    public:
52        Jump(BaseObject* creator);      //!< Constructor
53        virtual ~Jump();                //!< Deconstructor
54
55        virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);  //!< XMLPort
56
57        virtual void used(Pawn* pawn);          //!< Called when the item is used.
58
59        virtual bool pickedUp(Pawn* pawn);      //!< Called when the item is picked up.
60        virtual bool dropped(Pawn* pawn);       //!< Called when the item is dropped.
61
62        /**
63            @brief Get the velocity added when the item is used.
64            @return Returns the added velocity (relative to the Pawn).
65        */
66        inline const Vector3& getVelocity() const
67            { return this->velocity_; }
68        /**
69            @brief Set the velocity added when the item is used.
70            @param velocity New added velocity (relative to Pawn).
71        */
72        inline void setVelocity(const Vector3& velocity)
73            { this->velocity_ = velocity; }
74        /**
75            @brief Get the amount of jumps available.
76            @return Returns how many times the item can be used.
77        */
78        inline int getJumpsAvailable() const
79            { return this->jumpsAvailable_; }
80        /**
81            @brief Set the amount of jumps available.
82            @param num New number of available jumps.
83        */
84        inline void setJumpsAvailable(int num)
85            { this->jumpsAvailable_ = num; }
86    private:
87        Vector3 velocity_;      //!< The velocity added when the item is used.
88        int jumpsAvailable_;    //!< Amount of jumps still available.
89    };
90}
91
92#endif /* _Jump_H__ */
Note: See TracBrowser for help on using the repository browser.