Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/trunk/src/world_entities/script_triggers/tick_trigger.cc @ 10627

Last change on this file since 10627 was 10622, checked in by snellen, 18 years ago

merged scriptimprovements back to trunk

File size: 2.0 KB
Line 
1/*
2   orxonox - the future of 3D-vertical-scrollers
3
4   Copyright (C) 2004 orx
5
6   This program is free software; you can redistribute it and/or modify
7   it under the terms of the GNU General Public License as published by
8   the Free Software Foundation; either version 2, or (at your option)
9   any later version.
10
11### File Specific:
12   main-programmer: Silvan Nellen
13   co-programmer: ...
14*/
15
16#include "util/loading/factory.h"
17#include "script_class.h"
18#include "tick_trigger.h"
19#include "debug.h"
20
21ObjectListDefinition(TickTrigger);
22CREATE_FACTORY(TickTrigger);
23
24CREATE_SCRIPTABLE_CLASS(TickTrigger,
25             // Coordinates
26                        addMethod("setAbsCoor", Executor3<PNode, lua_State*,float,float,float>(&PNode::setAbsCoor))
27                            ->addMethod("getAbsCoorX", Executor0ret<PNode, lua_State*, float>(&PNode::getAbsCoorX))
28                            ->addMethod("getAbsCoorY", Executor0ret<PNode, lua_State*, float>(&PNode::getAbsCoorY))
29                            ->addMethod("getAbsCoorZ", Executor0ret<PNode, lua_State*, float>(&PNode::getAbsCoorZ))
30             //Properties
31                            ->addMethod("setName", Executor1<BaseObject, lua_State*, const std::string&>(&BaseObject::setName))
32                            ->addMethod("setScript", Executor1<ScriptTrigger, lua_State*, const std::string&>(&ScriptTrigger::setScript))
33                            ->addMethod("setFunction", Executor1<ScriptTrigger, lua_State*, const std::string&>(&ScriptTrigger::setFunction))
34                            ->addMethod("setDebugDraw", Executor1<ScriptTrigger, lua_State*, bool>(&ScriptTrigger::setDebugDraw))
35             );
36
37
38/**
39 * Constructs a new TickTrigger.
40 * @param root the xml element to load the parameters from.
41 *
42 */
43TickTrigger::TickTrigger(const TiXmlElement* root)
44{
45  this->registerObject(this, TickTrigger::_objectList);
46
47  if(root != NULL)
48   {
49    loadParams(root);
50
51    if(addToScript && scriptIsOk)
52    {
53      script->addObject( "TickTrigger", this->getName());
54    }
55
56   }
57
58}
59
60/**
61 * Deletes the TickTrigger.
62 *
63 */
64TickTrigger::~TickTrigger()
65{
66
67}
68
69
70void TickTrigger::tick(float timestep)
71{
72  if( scriptFinished ) return;
73
74  this->executeAction(timestep);
75     
76}
Note: See TracBrowser for help on using the repository browser.