Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Nov 12, 2008, 2:20:51 PM (16 years ago)
Author:
dafrick
Message:

Playing with Triggers.

Location:
code/branches/questsystem2/src/orxonox/objects
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • code/branches/questsystem2/src/orxonox/objects/quest/QuestEffectBeacon.cc

    r2191 r2193  
    3232#include "core/CoreIncludes.h"
    3333#include "core/XMLPort.h"
    34 #include "core/Event.h"
     34#include "core/EventIncludes.h"
    3535
    3636#include "orxonox/objects/worldentities/ControllableEntity.h"
    37 #include "orxonox/objects/worldentities/triggers/Trigger.h"
     37#include "orxonox/objects/worldentities/triggers/PlayerTrigger.h"
    3838#include "QuestEffect.h"
    3939
     
    6464    }
    6565   
    66     void processEvent(Event& event)
     66    void QuestEffectBeacon::processEvent(Event& event)
    6767    {
    68         //TDO. Resolve pseudo code.
    69         //if(isControllableEntity(event.originator_))
    70         //{
    71         //    SetEvent(BaseObject, "activity", execute, event);
    72         //}
     68        SetSubclassEvent(QuestEffectBeacon, "execute", execute, event, PlayerTrigger);
    7369    }
    7470   
     
    150146    }
    151147   
    152     bool QuestEffectBeacon::addTrigger(Trigger* trigger)
     148    bool QuestEffectBeacon::addTrigger(PlayerTrigger* trigger)
    153149    {
    154150        if(this->trigger_ != NULL)
  • code/branches/questsystem2/src/orxonox/objects/quest/QuestEffectBeacon.h

    r2191 r2193  
    7777            int times_; //!< Number of times the beacon can be exectued.
    7878            QuestEffectBeaconStatus::Enum status_;
    79             Trigger* trigger_;
     79            PlayerTrigger* trigger_;
    8080           
    8181            bool setTimes(const int & n);
    8282            bool addEffect(QuestEffect* effect);
    83             bool addTrigger(Trigger* trigger);
     83            bool addTrigger(PlayerTrigger* trigger);
    8484           
    8585            const QuestEffect* getEffect(unsigned int index) const;
  • code/branches/questsystem2/src/orxonox/objects/worldentities/triggers/DistanceTrigger.cc

    r2103 r2193  
    3939  CreateFactory(DistanceTrigger);
    4040
    41   DistanceTrigger::DistanceTrigger(BaseObject* creator) : Trigger(creator)
     41  DistanceTrigger::DistanceTrigger(BaseObject* creator) : PlayerTrigger(creator)
    4242  {
    4343    RegisterObject(DistanceTrigger);
     
    4545    this->distance_ = 100;
    4646    this->targetMask_.exclude(Class(BaseObject));
     47    this->player_ = NULL;
    4748  }
    4849
     
    117118      Vector3 distanceVec = entity->getWorldPosition() - this->getWorldPosition();
    118119      if (distanceVec.length() < this->distance_)
     120      {
     121        this->player_ = dynamic_cast<ControllableEntity*>(entity);
    119122        return true;
     123      }
    120124    }
    121125    return false;
    122126
     127  }
     128 
     129  ControllableEntity* DistanceTrigger::getTriggeringPlayer(void) const
     130  {
     131    return this->player_;
    123132  }
    124133
  • code/branches/questsystem2/src/orxonox/objects/worldentities/triggers/DistanceTrigger.h

    r2103 r2193  
    3030#define _DistanceTrigger_H__
    3131
    32 #include "Trigger.h"
     32#include "PlayerTrigger.h"
    3333
    3434#include <set>
     
    3737#include "core/BaseObject.h"
    3838
     39#include "orxonox/objects/worldentities/ControllableEntity.h"
     40
    3941namespace orxonox
    4042{
    41   class _OrxonoxExport DistanceTrigger : public Trigger
     43  class _OrxonoxExport DistanceTrigger : public PlayerTrigger
    4244  {
    4345    public:
     
    5658      inline float getDistance() const
    5759        { return this->distance_; }
     60       
     61        virtual ControllableEntity* getTriggeringPlayer(void) const;
    5862
    5963      bool checkDistance();
     
    6670      std::set<Ogre::Node*> targetSet_;
    6771      float distance_;
     72     
     73      ControllableEntity* player_;
     74     
    6875  };
    6976}
Note: See TracChangeset for help on using the changeset viewer.