[Orxonox-commit 5350] r10013 - code/branches/ScriptableController/src/orxonox/controllers
samuezu at orxonox.net
samuezu at orxonox.net
Thu Apr 3 13:46:08 CEST 2014
Author: samuezu
Date: 2014-04-03 13:46:08 +0200 (Thu, 03 Apr 2014)
New Revision: 10013
Removed:
code/branches/ScriptableController/src/orxonox/controllers/ScriptController.cc
code/branches/ScriptableController/src/orxonox/controllers/ScriptController.h
code/branches/ScriptableController/src/orxonox/controllers/ScriptController_00.cc
code/branches/ScriptableController/src/orxonox/controllers/ScriptController_00.h
Log:
adding ControllerDirector files
Deleted: code/branches/ScriptableController/src/orxonox/controllers/ScriptController.cc
===================================================================
--- code/branches/ScriptableController/src/orxonox/controllers/ScriptController.cc 2014-04-03 11:21:01 UTC (rev 10012)
+++ code/branches/ScriptableController/src/orxonox/controllers/ScriptController.cc 2014-04-03 11:46:08 UTC (rev 10013)
@@ -1,136 +0,0 @@
-/*
-First try of a scriptController. Target: An event occurs in the levelTry.oxw file, which is "heard" by an object of the type of this class. It then SHOULD (because it is not working) execute the party function.
- */
-
-#include "ScriptController.h"
-#include "core/CoreIncludes.h"
-
-namespace orxonox
-{
- RegisterClass(ScriptController);
-
- ScriptController::ScriptController(Context* context) : ArtificialController(context)
- {
- //Working
- RegisterObject(ScriptController);
- orxout()<<"hello universe constructor"<< endl;
-
- this->player_=NULL;
- this->entity_=NULL;
- this->pTrigger_=NULL;
- }
-
- bool ScriptController::party(bool bTriggered, BaseObject* trigger)
- {
- //XMLPortEventSink seems not to execute the party function
- orxout()<<"hello universe party"<< endl;
- return true;
- }
-
-
- void ScriptController::XMLPort(Element& xmlelement, XMLPort::Mode mode)
- {
- SUPER(ScriptController, XMLPort, xmlelement, mode);
-
-
- XMLPortEventSink(ScriptController, BaseObject, "party", party, xmlelement, mode);
- // Working
- orxout()<<"hello universe xmlport"<< endl;
- }
-
- void ScriptController::tick(float dt)
- {
-
- //Get controllable entity which is attached to this controller in the XML file.
- ControllableEntity* entity = this->getControllableEntity();
- if (!entity)
- orxout()<<"No controllable entity found"<<endl;
- return;
-
-
-
- SUPER(ScriptController, tick, dt);
- }
-
- void ScriptController::takeControl(Controller * controller, BaseObject * trigger) {
-
- preparationToTakeControl(trigger);
- setNewController(controller);
-
- }
-
-
- bool ScriptController::preparationToTakeControl(BaseObject * trigger) {
-
- this->pTrigger_ = orxonox_cast<PlayerTrigger*>(trigger);
- this->player_ = NULL;
-
- // Check whether it is a player trigger and extract pawn from it
- if(pTrigger != NULL)
- {
- if(!pTrigger->isForPlayer()) { // The PlayerTrigger is not exclusively for Pawns which means we cannot extract one.
- orxout(verbose, context::docking) << "Docking:execute PlayerTrigger was not triggered by a player.." << endl;
- return false;
- }
- player_ = pTrigger->getTriggeringPlayer(); //Get the object which triggered the event.
- }
- else
- {
- orxout(verbose, context::docking) << "Docking::execute Not a player trigger, can't extract pawn from it.." << endl;
- return false;
- }
-
-
- this->entity_ = this->player_->getControllableEntity();
- assert(this->entity_);
-
- }
-
- void ScriptController::setNewController(Controller * controller) {
-
-
- orxout(verbose) << "New Controller is going to be set!" << endl;
-
- this->entity_->setDestroyWhenPlayerLeft(false);
- this->player_->pauseControl();
- this->entity_->setController(controller);
- this->setControllableEntity(this->entity_);
-
-
-
- }
-
-
-
-
-/* Detaillierte Planung
-Director nimmt event auf und hängt dann einen controller (momentan als erstellt zu betrachten) an objekt, welches event ausgelöst hat.
-
-
-
- Klassenvariablen
-
- ...? brauchts überhaupt?
-
- Variablen (in Funktionen auftretend):
-
- Playerinfo * player enthält infos über objekt, welches event ausgelöst hat.Relevant für Inputseite des Directors
-
- Funktion:
-
- Auf Seite des Inputs des Directors:
-
- preparationForControlTakeOver(...) Vorbereitende Massnahmen um neuen Controller anzuhängen, z.B. player = pTrigger->getTriggeringPlayer();
- Orientierung an execute Funktion von Dock.cc
-
- Auf Outputseite des Directors:
-
- takeControl(...) Orientierung an DockingController.cc
-
- tick() Soll von Event ausgelöst werden, wenn z.B. Kamera an Endposition angelangt ist. Danach soll wieder ein
- menschlicher Spieler die Kontrolle übernehmen (wie? new human controller? Klasse noch angucken!).
-*/
-
-
-
-}
Deleted: code/branches/ScriptableController/src/orxonox/controllers/ScriptController.h
===================================================================
--- code/branches/ScriptableController/src/orxonox/controllers/ScriptController.h 2014-04-03 11:21:01 UTC (rev 10012)
+++ code/branches/ScriptableController/src/orxonox/controllers/ScriptController.h 2014-04-03 11:46:08 UTC (rev 10013)
@@ -1,65 +0,0 @@
-/*
- * ORXONOX - the hottest 3D action shooter ever to exist
- * > www.orxonox.net <
- *
- *
- * License notice:
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Author:
- * Fabian 'x3n' Landau
- * Co-authors:
- * ...
- *
- */
-
-#ifndef _ScriptController_H__
-#define _ScriptController_H__
-
-#include "OrxonoxPrereqs.h"
-#include "ArtificialController.h"
-#include "core/EventIncludes.h"
-
-
-namespace orxonox
-{
- class _OrxonoxExport ScriptController : public ArtificialController
- {
- public:
- ScriptController(Context* context);
- virtual ~ScriptController() { }
-
- virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
- bool party(bool bTriggered, BaseObject* trigger);
- void tick(float dt);
- void takeControl(Controller * controller, BaseObject * trigger);
- bool preparationToTakeControl(BaseObject * trigger);
- void setNewController(Controller * controller);
-
-
- private:
-
- PlayerInfo* player_;
-
- ControllableEntity* entity_;
-
- PlayerTrigger * pTrigger_;
-
-
- };
-}
-
-#endif /* _ScriptController_H__ */
Deleted: code/branches/ScriptableController/src/orxonox/controllers/ScriptController_00.cc
===================================================================
--- code/branches/ScriptableController/src/orxonox/controllers/ScriptController_00.cc 2014-04-03 11:21:01 UTC (rev 10012)
+++ code/branches/ScriptableController/src/orxonox/controllers/ScriptController_00.cc 2014-04-03 11:46:08 UTC (rev 10013)
@@ -1,39 +0,0 @@
-/*
-First try of a scriptController. Target: An event occurs in the levelTry.oxw file, which is "heard" by an object of the type of this class. It then SHOULD (because it is not working) execute the party function.
- */
-
-#include "ScriptController_00.h"
-#include "core/CoreIncludes.h"
-
-namespace orxonox
-{
- RegisterClass(ScriptController_00);
-
- ScriptController_00::ScriptController_00(Context* context) : ArtificialController(context)
- {
- //Working
- RegisterObject(ScriptController_00);
- orxout()<<"hello universe constructor"<< endl;
- }
-
- bool ScriptController_00::party(bool bTriggered, BaseObject* trigger)
- {
- //XMLPortEventSink seems not to execute the party function
- orxout()<<"hello universe party"<< endl;
- return true;
- }
-
-
- void ScriptController_00::XMLPort(Element& xmlelement, XMLPort::Mode mode)
- {
- SUPER(ScriptController_00, XMLPort, xmlelement, mode);
-
- //WORKING
- XMLPortEventSink(ScriptController_00, BaseObject, "party", party, xmlelement, mode);
- orxout()<<"hello universe xmlport"<< endl;
- }
-
-
-
-
-}
Deleted: code/branches/ScriptableController/src/orxonox/controllers/ScriptController_00.h
===================================================================
--- code/branches/ScriptableController/src/orxonox/controllers/ScriptController_00.h 2014-04-03 11:21:01 UTC (rev 10012)
+++ code/branches/ScriptableController/src/orxonox/controllers/ScriptController_00.h 2014-04-03 11:46:08 UTC (rev 10013)
@@ -1,55 +0,0 @@
-/*
- * ORXONOX - the hottest 3D action shooter ever to exist
- * > www.orxonox.net <
- *
- *
- * License notice:
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Author:
- * Fabian 'x3n' Landau
- * Co-authors:
- * ...
- *
- */
-
-#ifndef _ScriptController00_H__
-#define _ScriptController00_H__
-
-#include "OrxonoxPrereqs.h"
-#include "ArtificialController.h"
-#include "core/EventIncludes.h"
-
-
-namespace orxonox
-{
- class _OrxonoxExport ScriptController_00 : public ArtificialController
- {
- public:
- ScriptController_00(Context* context);
- virtual ~ScriptController_00() { }
-
- virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
- bool party(bool bTriggered, BaseObject* trigger);
-
-
- private:
-
-
- };
-}
-
-#endif /* _ScriptController_H__ */
More information about the Orxonox-commit
mailing list