Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 10643 in orxonox.OLD for trunk/src/world_entities/npcs


Ignore:
Timestamp:
Apr 29, 2007, 6:51:28 PM (18 years ago)
Author:
bknecht
Message:

improvements by landauf on bsp, rotor and wireframe (does build, should work)

Location:
trunk/src/world_entities/npcs
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/world_entities/npcs/mover.cc

    r10618 r10643  
    8282        .describe("sets the action time of the door")
    8383        .defaultValues(1.0);
     84    LoadParam(root, "stay-open-time", this, Mover, setStayOpenTime)
     85        .describe("sets the time, the door must stay open")
     86        .defaultValues(0.0);
    8487    LoadParam(root, "opening-sound", this, Mover, setOpeningSoundFile)
    8588        .describe("Sets the file of the opening sound source");
     
    146149                this->soundSource_moving.stop();
    147150        }
     151        this->openTime = 0;
    148152    }
    149153    else if (this->state == Open)
    150154    {
    151         if (!this->checkPlayerInActionRadius())
    152         {
    153             this->state = Closing;
    154             if (this->soundBuffer_closing.loaded())
    155                 this->soundSource_starting.play(this->soundBuffer_closing);
    156             if (this->soundBuffer_moving.loaded())
    157                 this->soundSource_moving.play(this->soundBuffer_moving, 1.0, true);
     155        this->openTime += dt;
     156        if (this->openTime >= this->stayOpenTime)
     157        {
     158            if (!this->checkPlayerInActionRadius())
     159            {
     160                this->state = Closing;
     161                if (this->soundBuffer_closing.loaded())
     162                    this->soundSource_starting.play(this->soundBuffer_closing);
     163                if (this->soundBuffer_moving.loaded())
     164                    this->soundSource_moving.play(this->soundBuffer_moving, 1.0, true);
     165            }
    158166        }
    159167    }
  • trunk/src/world_entities/npcs/mover.h

    r10487 r10643  
    3535        void setActionRadius(float radius) { this->actionRadius = radius; }
    3636        void setActionTime(float time) { this->actionTime = time; }
     37        void setStayOpenTime(float time) { this->stayOpenTime = time; }
    3738        void setOpeningSoundFile(const std::string& fileName);
    3839        void setOpenedSoundFile(const std::string& fileName);
     
    6263        float                       actionTime;                 //!< the action-time
    6364        int                         state;                      //!< the state of the mover
     65        float                       stayOpenTime;               //!< waiting time while opened
     66        float                       openTime;                   //!< time since opened
    6467};
    6568
Note: See TracChangeset for help on using the changeset viewer.