Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Mar 20, 2010, 6:36:00 PM (14 years ago)
Author:
ebeier
Message:

adapted SpeedPickup from HealthPickup

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/ppspickups1/src/modules/pickup/items/SpeedPickup.h

    r6552 r6574  
    2121 *
    2222 *   Author:
    23  *      Damian 'Mozork' Frick
     23 *      Eric Beier
    2424 *   Co-authors:
    2525 *      ...
    2626 *
    27  *   TODO: Implement...
    2827 */
    29 /*
    30  *   ORXONOX - the hottest 3D action shooter ever to exist
    31  *                    > www.orxonox.net <
    32  *
    33  *
    34  *   License notice:
    35  *
    36  *   This program is free software; you can redistribute it and/or
    37  *   modify it under the terms of the GNU General Public License
    38  *   as published by the Free Software Foundation; either version 2
    39  *   of the License, or (at your option) any later version.
    40  *
    41  *   This program is distributed in the hope that it will be useful,
    42  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
    43  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    44  *   GNU General Public License for more details.
    45  *
    46  *   You should have received a copy of the GNU General Public License
    47  *   along with this program; if not, write to the Free Software
    48  *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
    49  *
    50  *   Author:
    51  *      Damian 'Mozork' Frick
    52  *   Co-authors:
    53  *      ...
    54  *
    55  *   TODO: Implement...
    56  */
     28
     29/**
     30    @file SpeedPickup.h
     31    @brief Declaration of the SpeedPickup class.
     32*/
     33
     34#ifndef _SpeedPickup_H__
     35#define _SpeedPickup_H__
     36
     37#include "pickup/PickupPrereqs.h"
     38
     39#include <string>
     40#include <worldentities/pawns/Pawn.h>
     41#include "worldentities/StaticEntity.h"
     42
     43#include "pickup/Pickup.h"
     44
     45namespace orxonox {
     46
     47    /**
     48    @brief
     49        A Pickup which can manipulate the Speed of a Pawn.
     50
     51        1) The speed multiplier:
     52           The additional (forward) speed:
     53        2) The activation type: 'immediate' or 'onUse'. defines if the item is used when it's picked up or only after the player chooses to use it.
     54        4) The duration: the activation time of the pickup.
     55
     56    @author
     57        Eric Beier
     58    */
     59    class _PickupExport SpeedPickup : public Pickup, public Tickable
     60    {
     61        public:
     62
     63            SpeedPickup(BaseObject* creator); //!< Constructor.
     64            virtual ~SpeedPickup(); //!< Destructor.
     65
     66            virtual void XMLPort(Element& xmlelement, orxonox::XMLPort::Mode mode); //!< Method for creating a HealthPickup object through XML.
     67            virtual void tick(float dt); //!< Is called every tick.
     68
     69            virtual void changedUsed(void); //!< Is called when the pickup has transited from used to unused or the other way around.
     70            virtual void clone(OrxonoxClass*& item); //!< Creates a duplicate of the input OrxonoxClass.
     71
     72            inline float getDuration(void)
     73                { return this->duration_; }
     74            inline float getSpeedAdd(void)
     75                { return this->speedAdd_; }
     76            inline float getSpeedMultiply(void)
     77                { return this->speedMultiply_; }
     78
     79        protected:
     80            void initializeIdentifier(void); //!< Initializes the PickupIdentifier of this pickup.
     81
     82            void setDuration(float duration); //!< Sets the duration
     83            void setSpeedAdd(float speedAdd);
     84            void setSpeedMultiply(float speedMultiply);
     85
     86
     87        private:
     88            void initialize(void); //!< Initializes the member variables.
     89            Pawn* carrierToPawnHelper(void); //!< Helper to transform the PickupCarrier to a Pawn, and throw an error message if the conversion fails.
     90
     91            float duration_; //!< The health that is transferred to the Pawn.
     92            float speedAdd_;
     93            float speedMultiply_;
     94    };
     95}
     96
     97#endif // _HealthPickup_H__
Note: See TracChangeset for help on using the changeset viewer.