Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 8909 in orxonox.OLD for branches/single_player_map


Ignore:
Timestamp:
Jun 29, 2006, 3:48:16 PM (18 years ago)
Author:
bensch
Message:

better impementation

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

Legend:

Unmodified
Added
Removed
  • branches/single_player_map/src/world_entities/npcs/generic_npc.cc

    r8908 r8909  
    149149void GenericNPC::walkTo(const Vector& coordinate)
    150150{
    151 }
    152 
    153 void GenericNPC::walkTo(float x, float y)
    154 {}
     151  GenericNPC::Anim anim;
     152  anim.v = coordinate;
     153  anim.type = Walk;
     154
     155  this->behaviourList.push_back(anim);
     156}
    155157
    156158void GenericNPC::walkTo(float x, float y, float z)
    157 {}
     159{
     160  this->walkTo(Vector(x,y,z));
     161
     162}
    158163
    159164/* running functions */
    160165void GenericNPC::runTo(const Vector& coordinate)
    161 {}
    162 void GenericNPC::runTo(float x, float y)
    163 {}
     166{
     167  GenericNPC::Anim anim;
     168  anim.v = coordinate;
     169  anim.type = Run;
     170
     171  this->behaviourList.push_back(anim);
     172}
     173
    164174void GenericNPC::runTo(float x, float y, float z)
    165 {}
     175{
     176  this->runTo(Vector(x,y,z));
     177}
    166178
    167179/* couching functinos */
    168180void GenericNPC::crouchTo(const Vector& coordinate)
    169 {}
    170 void GenericNPC::crouchTo(float x, float y)
    171 {}
     181{
     182  GenericNPC::Anim anim;
     183  anim.v = coordinate;
     184  anim.type = Crouch;
     185
     186  this->behaviourList.push_back(anim);
     187}
    172188void GenericNPC::crouchTo(float x, float y, float z)
    173 {}
     189{
     190  this->crouchTo(Vector(x,y,z));
     191}
    174192
    175193
    176194
    177195void GenericNPC::turnTo(float degreeInY)
    178 {}
     196{
     197  GenericNPC::Anim anim;
     198  anim.q = Quaternion(Vector(0,1,0), degreeInY);
     199  anim.type = TurnTo;
     200
     201  this->behaviourList.push_back(anim);
     202}
    179203
    180204
     
    185209 */
    186210void GenericNPC::lookAt(WorldEntity* worldEntity)
    187 {}
     211{
     212  GenericNPC::Anim anim;
     213  anim.entity = worldEntity;
     214  anim.type = LookAt;
     215
     216  this->behaviourList.push_back(anim);
     217}
    188218
    189219
     
    223253  if( likely(this->getModel(0) != NULL))
    224254    ((InteractiveModel*)this->getModel(0))->tick(time);
     255
     256
     257  if (!this->behaviourList.empty())
     258  {
     259    switch(this->behaviourList.front().type)
     260    {
     261      case Walk:
     262        break;
     263      case Run:
     264        break;
     265      case Crouch:
     266        break;
     267      case LookAt:
     268        break;
     269      case Shoot:
     270        break;
     271
     272    }
     273  }
    225274
    226275}
  • branches/single_player_map/src/world_entities/npcs/generic_npc.h

    r8908 r8909  
    4141  /* walking functions */
    4242  void walkTo(const Vector& coordinate);
    43   void walkTo(float x, float y);
    4443  void walkTo(float x, float y, float z);
    4544
    4645  /* running functions */
    4746  void runTo(const Vector& coordinate);
    48   void runTo(float x, float y);
    4947  void runTo(float x, float y, float z);
    5048
    5149  /* couching functinos */
    5250  void crouchTo(const Vector& coordinate);
    53   void crouchTo(float x, float y);
    5451  void crouchTo(float x, float y, float z);
    5552
    5653  /* stopping the movement */
    5754  void stop();
     55  void nextStep();
    5856
    5957  /* some oriantation functions */
     
    10199   typedef struct Anim
    102100   {
    103      Anim();
    104 
    105101     Vector        v;
    106102     Quaternion    q;
Note: See TracChangeset for help on using the changeset viewer.