Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Playing with Triggers.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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
Note: See TracChangeset for help on using the changeset viewer.