[10609] | 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 | |
---|
| 17 | #include "tick_trigger.h" |
---|
| 18 | #include "debug.h" |
---|
| 19 | |
---|
| 20 | ObjectListDefinition(TickTrigger); |
---|
[10611] | 21 | CREATE_FACTORY(TickTrigger); |
---|
[10609] | 22 | |
---|
[10610] | 23 | CREATE_SCRIPTABLE_CLASS(TickTrigger, |
---|
| 24 | // Coordinates |
---|
| 25 | addMethod("setAbsCoor", Executor3<PNode, lua_State*,float,float,float>(&PNode::setAbsCoor)) |
---|
| 26 | ->addMethod("getAbsCoorX", Executor0ret<PNode, lua_State*, float>(&PNode::getAbsCoorX)) |
---|
| 27 | ->addMethod("getAbsCoorY", Executor0ret<PNode, lua_State*, float>(&PNode::getAbsCoorY)) |
---|
| 28 | ->addMethod("getAbsCoorZ", Executor0ret<PNode, lua_State*, float>(&PNode::getAbsCoorZ)) |
---|
| 29 | //Properties |
---|
| 30 | ->addMethod("setName", Executor1<BaseObject, lua_State*, const std::string&>(&BaseObject::setName)) |
---|
| 31 | ->addMethod("setScript", Executor1<ScriptTrigger, lua_State*, const std::string&>(&ScriptTrigger::setScript)) |
---|
| 32 | ->addMethod("setFunction", Executor1<ScriptTrigger, lua_State*, const std::string&>(&ScriptTrigger::setFunction)) |
---|
| 33 | ->addMethod("setDebugDraw", Executor1<ScriptTrigger, lua_State*, bool>(&ScriptTrigger::setDebugDraw)) |
---|
| 34 | ); |
---|
[10609] | 35 | |
---|
| 36 | |
---|
| 37 | /** |
---|
| 38 | * Constructs a new TickTrigger. |
---|
| 39 | * @param root the xml element to load the parameters from. |
---|
| 40 | * |
---|
| 41 | */ |
---|
| 42 | TickTrigger::TickTrigger(const TiXmlElement* root) |
---|
| 43 | { |
---|
| 44 | this->registerObject(this, TickTrigger::_objectList); |
---|
| 45 | this->toList(OM_COMMON); |
---|
| 46 | |
---|
| 47 | } |
---|
| 48 | |
---|
| 49 | /** |
---|
| 50 | * Deletes the TickTrigger. |
---|
| 51 | * |
---|
| 52 | */ |
---|
| 53 | TickTrigger::~TickTrigger() |
---|
| 54 | { |
---|
| 55 | |
---|
| 56 | } |
---|
| 57 | |
---|
| 58 | |
---|
| 59 | void TickTrigger::tick(float timestep) |
---|
| 60 | { |
---|
| 61 | if( scriptFinished ) return; |
---|
| 62 | |
---|
| 63 | this->executeAction(timestep); |
---|
| 64 | |
---|
| 65 | } |
---|