Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/trunk/src/orxonox/worldentities/Actionpoint.cc @ 11350

Last change on this file since 11350 was 11052, checked in by landauf, 9 years ago

merged branch presentationHS15 back to trunk

  • Property svn:eol-style set to native
File size: 2.8 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 *      Gani Aliguzhinov
24 *   Co-authors:
25 *      ...
26 *
27 */
28
29#include "Actionpoint.h"
30
31namespace orxonox
32{
33    RegisterClass(Actionpoint);
34
35    Actionpoint::Actionpoint(Context* context) : StaticEntity(context)
36    {
37        RegisterObject(Actionpoint);
38       
39        this->actionName_ = "";
40        this->name_ = "";
41       
42        this->bLoopStart_ = false;
43        this->bLoopEnd_ = false;
44        this->bProtectMe_ = false;
45    }
46   
47    void Actionpoint::XMLPort(Element& xmlelement, XMLPort::Mode mode)
48    {
49        SUPER(Actionpoint, XMLPort, xmlelement, mode);
50       
51        XMLPortParam(Actionpoint, "action", setActionXML, getActionXML,  xmlelement, mode);
52        XMLPortParam(Actionpoint, "protect", setProtectXML, getProtectXML,  xmlelement, mode);
53        XMLPortParam(Actionpoint, "attack", setAttackXML, getAttackXML,  xmlelement, mode);
54        XMLPortParam(Actionpoint, "protectMe", setProtectMeXML, getProtectMeXML,  xmlelement, mode).defaultValues(false);
55        XMLPortParam(Actionpoint, "loopStart", setLoopStart, getLoopStart,  xmlelement, mode).defaultValues(false);
56        XMLPortParam(Actionpoint, "loopEnd", setLoopEnd, getLoopEnd,  xmlelement, mode).defaultValues(false);
57    }
58    /**
59    @brief
60        action is ATTACK -> returns name of object to attack
61        action is PROTECT -> returns name of object to protect
62        if asked to protect human, returns a special string.
63    @return
64        name of an object to interact with.
65    @note
66        never use more than one of following arguments for XMLPort:
67        attack, protect, protectMe or
68        loopStart and loopEnd.
69    */
70    std::string Actionpoint::getName() const
71    {
72        if (this->name_ != "")
73        {
74            return this->name_;
75        }
76        else if (this->bProtectMe_)
77        {
78            return "reservedKeyword:human";
79        }
80        else
81        {
82            return "";
83        }
84    }   
85}
Note: See TracBrowser for help on using the repository browser.