Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Apr 10, 2014, 3:18:32 PM (11 years ago)
Author:
mkronig
Message:

Added an initial test for lua execution. Not tested yet.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/ScriptableController/src/orxonox/controllers/ControllerDirector.cc

    r10024 r10026  
    1111#include "interfaces/PlayerTrigger.h"
    1212#include "worldentities/pawns/Pawn.h"
     13#include "LuaState.h"
     14
    1315
    1416namespace orxonox
     
    2729    }
    2830
    29     bool ControllerDirector::party(bool bTriggered, BaseObject* trigger)
    30        {
    31            //XMLPortEventSink seems not to execute the party function
    32            orxout()<<"hello universe party"<< endl;
    33            return true;
    34        }
    35 
    3631
    3732    void ControllerDirector::XMLPort(Element& xmlelement, XMLPort::Mode mode)
     
    4035
    4136       
    42         orxout()<<"hello universe xmlport"<< endl;
     37        orxout()<<"ControllerDriector::XMLPort An instance of ControllerDirector has been created."<< endl;
    4338    }
    4439
     
    4742        SUPER(ControllerDirector, XMLEventPort, xmlelement, mode);
    4843
    49         XMLPortEventSink(ControllerDirector, BaseObject, "party", party, xmlelement, mode);
     44        XMLPortEventSink(ControllerDirector, BaseObject, "takeControl", takeControl, xmlelement, mode);
    5045
    5146    }
     
    5348
    5449
    55    /* void ControllerDirector::tick(float dt)
    56     {
    57 
    58         //Get controllable entity which is attached to this controller in the XML file.
    59         ControllableEntity* entity = this->getControllableEntity();
    60         if (!entity)
    61             orxout()<<"No controllable entity found"<<endl;
    62             return;
    63 
    64        
    65 
    66         SUPER(ControllerDirector, tick, dt);
    67     }
    68 
    69     */
    7050
    7151    void ControllerDirector::takeControl(Controller * controller, BaseObject * trigger) {
     
    7353        preparationToTakeControl(trigger);
    7454        setNewController(controller);
    75 
     55        LuaState test = new Luastate();
     56        test.doFile("/tmp/myluahelloworld.lua");
     57       
    7658    }
    7759
     
    11395        this->setControllableEntity(this->entity_);
    11496
     97
     98
    11599    }
    116100       
     
    119103}
    120104
    121 /* Detaillierte Planung
    122 Director nimmt event auf und hängt dann einen controller (momentan als erstellt zu betrachten) an objekt, welches event ausgelöst hat.
    123105
    124106
    125107
    126         Klassenvariablen
    127 
    128                 ...? brauchts überhaupt?
    129 
    130         Variablen (in Funktionen auftretend):
    131 
    132                 Playerinfo * player             enthält infos über objekt, welches event ausgelöst hat.Relevant für Inputseite des Directors
    133 
    134         Funktion:
    135 
    136                 Auf Seite des Inputs des Directors:
    137 
    138                         preparationForControlTakeOver(...)      Vorbereitende Massnahmen um neuen Controller anzuhängen, z.B. player = pTrigger->getTriggeringPlayer();
    139                                                                 Orientierung an execute Funktion von Dock.cc
    140        
    141                 Auf Outputseite des Directors:
    142 
    143                         takeControl(...)                        Orientierung an DockingController.cc
    144 
    145                         tick()                                  Soll von Event ausgelöst werden, wenn z.B. Kamera an Endposition angelangt ist. Danach soll wieder ein
    146                                                                 menschlicher Spieler die Kontrolle übernehmen (wie? new human controller? Klasse noch angucken!).
    147 */
    148 
    149 
    150 
Note: See TracChangeset for help on using the changeset viewer.