Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/tutorial/src/modules/pickup/DroppedPickup.cc @ 11468

Last change on this file since 11468 was 7549, checked in by dafrick, 14 years ago

Resolving some more TODO's.

  • Property svn:eol-style set to native
File size: 2.7 KB
Line 
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 *      Damian 'Mozork' Frick
26 *
27 */
28
29/**
30    @file DroppedPickup.cc
31    @brief Implementation of the DroppedPickup class.
32*/
33
34#include "DroppedPickup.h"
35
36#include "core/CoreIncludes.h"
37
38#include "interfaces/Pickupable.h"
39#include "interfaces/PickupCarrier.h"
40
41namespace orxonox
42{
43
44    CreateFactory(DroppedPickup);
45
46    /**
47    @brief
48        Default constructor. Registers object and sets default values.
49    */
50    DroppedPickup::DroppedPickup(BaseObject* creator) : PickupSpawner(creator)
51    {
52        RegisterObject(DroppedPickup);
53    }
54
55    /**
56    @brief
57        Constructor. Registers the object and sets values.
58    @param creator
59        The creator of the DroppedPickup.
60    @param pickup
61        The Pickupable that was dropped.
62    @param carrier
63        The PickupCarrier that carried the input pickup before it was dropped.
64    @param triggerDistance
65        The distance at which the PickupSpawner triggers. Default is 10.
66    */
67    DroppedPickup::DroppedPickup(BaseObject* creator, Pickupable* pickup, PickupCarrier* carrier, float triggerDistance) : PickupSpawner(creator, pickup, triggerDistance, 5, 1)
68    {
69        RegisterObject(DroppedPickup);
70
71        this->setPosition(carrier->getCarrierPosition());
72        this->block(carrier, DEFAULT_BLOCKED_TIME);
73    }
74
75    /**
76    @brief
77        Destructor.
78    */
79    DroppedPickup::~DroppedPickup()
80    {
81
82    }
83
84    /**
85    @brief
86        Creates the Pickupable that is going to get picked up.
87        In the case of the DroppedItem it is the one and only Pickupable that was dropped. No additional Pickupables of the same type are created.
88    */
89    Pickupable* DroppedPickup::getPickup(void)
90    {
91        Pickupable* pickup = this->pickup_;
92        this->pickup_ = NULL;
93        return pickup;
94    }
95
96}
Note: See TracBrowser for help on using the repository browser.