Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 8875 in orxonox.OLD for branches/single_player_map/src


Ignore:
Timestamp:
Jun 28, 2006, 5:25:42 PM (18 years ago)
Author:
patrick
Message:

door proximity algorithm

Location:
branches/single_player_map/src/world_entities
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/single_player_map/src/world_entities/door.cc

    r8874 r8875  
    100100  const std::list<BaseObject*>* list = ClassList::getList(CL_PLAYABLE);
    101101  WorldEntity* entity;
     102  float distance;
    102103
    103104  if( list == NULL)
     
    109110    entity = dynamic_cast<WorldEntity*>(*it);
    110111
     112    distance = fabs((this->getAbsCoor() - entity->getAbsCoor()).len());
     113    if( distance < this->actionRadius)
     114      return true;
    111115  }
    112116
     
    117121  for( it = list->begin(); it != list->end(); it++)
    118122  {
     123    entity = dynamic_cast<WorldEntity*>(*it);
    119124
     125    distance = fabs((this->getAbsCoor() - entity->getAbsCoor()).len());
     126    if( distance < this->actionRadius)
     127      return true;
    120128  }
    121129
  • branches/single_player_map/src/world_entities/door.h

    r8874 r8875  
    1919
    2020    void setAnim(int animationIndex, int animPlaybackMode);
     21    void setActionRadius(float radius) { this->actionRadius = radius; }
    2122
    2223    virtual void tick (float time);
     24
     25    void open();
     26    void close();
    2327
    2428  private:
     
    2731  private:
    2832    bool           bOpen;             //!< true if the door is open
     33    float          actionRadius;      //!< action radius
    2934
    3035};
Note: See TracChangeset for help on using the changeset viewer.