Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Nov 21, 2016, 3:55:43 PM (8 years ago)
Author:
ooguz
Message:

Arrow movessvn add Waypoint.h!

Location:
code/branches/QuestGuide_HS16/src/modules/waypoints
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • code/branches/QuestGuide_HS16/src/modules/waypoints/Waypoint.h

    r11287 r11298  
    5252
    5353           
    54 
     54            bool waypoint_actived;
    5555
    5656        private:
     
    5959            Model* model;
    6060            DistanceTrigger* distancetrigger;
    61             bool waypoint_actived;
    6261            int order;
    6362           
  • code/branches/QuestGuide_HS16/src/modules/waypoints/WaypointGroup.cc

    r11287 r11298  
    1616    {
    1717        RegisterObject(WaypointGroup);
     18        activeWaypoint = nullptr;
     19
    1820        //model = new Model(this->getContext());
    1921        //model->setMeshSource("cube.mesh");  // Name of the arrow file for now bottle
     
    6062
    6163    Waypoint* WaypointGroup::getActive(){
    62           for (Waypoint* object : this->waypoints_){
     64          if (activeWaypoint == nullptr){
     65                                    orxout() << "OOOOOOOOOO" << endl;
     66
     67            activateNext();
     68
     69          }           
     70          return activeWaypoint;
     71    }
     72
     73    Waypoint* WaypointGroup::activateNext(){
     74        for (Waypoint* object : this->waypoints_){
    6375            if(!(object->waypoint_actived)){
    6476                object->enable_waypoint();
    65                 return object;
     77                activeWaypoint = object;
    6678            }
    6779        }
     80        return activeWaypoint;
    6881    }
    69 
    7082
    7183
  • code/branches/QuestGuide_HS16/src/modules/waypoints/WaypointGroup.h

    r11287 r11298  
    4545
    4646
    47        
     47        Waypoint* getActive();
     48         
    4849
     50        Waypoint* activateNext();
    4951
    5052           
     
    5860         
    5961        std::set<Waypoint*> waypoints_;
     62        Waypoint* activeWaypoint;
    6063
    6164            // network callbacks
  • code/branches/QuestGuide_HS16/src/modules/waypoints/Waypointarrow.cc

    r11287 r11298  
    1919       // model->setOrientation(Vector3(0,0,-1));
    2020        model->setPosition(Vector3(0,15,0));
     21        waypoints_ = nullptr;
    2122       
    2223    }
     
    2627    }
    2728
     29   /* 
     30    Waypoint* WaypointGroup::getActive(){
     31          for (Waypoint* object : this->waypoints_){
     32            if(!(object->waypoint_actived)){
     33                object->enable_waypoint();
     34                return object;
     35            }
     36        }
     37    }
     38
     39
     40    void tick::getActive
     41*/
     42
     43
     44    WaypointGroup* Waypointarrow::getWaypointgroup()
     45    {
     46        if (waypoints_ == nullptr){
     47
     48            for (WaypointGroup* group : ObjectList<WaypointGroup>())
     49                waypoints_ = group;
     50       
     51        }
     52
     53        return waypoints_;
     54    }
     55
     56
     57
     58
     59    void Waypointarrow::tick(float dt){
    2860     
     61        if (getWaypointgroup() == nullptr){
     62                    orxout() << "Second" << endl;
    2963
     64            return;
     65        }     
     66               
     67        waypoints_ = getWaypointgroup();
     68               
     69        waypoint = waypoints_->getActive();
     70                       
     71        Vector3 waypoint_position = waypoint->getWorldPosition();
     72     
     73        orxout() << "dsfsf" << waypoint_position.x << endl;
     74        model->lookAt(waypoint_position - this->getWorldPosition());
     75
     76       
     77    }
    3078
    3179    void Waypointarrow::XMLPort(Element& xmlelement, XMLPort::Mode mode){
    3280        SUPER(Waypointarrow, XMLPort, xmlelement, mode); // From the SpaceShip.cc file
     81       
    3382        //XMLPortParamTemplate(WorldEntity, "orientation", setOrientation, getOrientation, xmlelement, mode, Vector3)
    3483
  • code/branches/QuestGuide_HS16/src/modules/waypoints/Waypointarrow.h

    r11287 r11298  
    3131    */
    3232
    33     class _OrxonoxExport Waypointarrow : public StaticEntity {
     33    class _OrxonoxExport Waypointarrow : public StaticEntity, public Tickable {
    3434       
    3535        public:
     
    3737            Waypointarrow(Context* context);
    3838            virtual ~Waypointarrow();
     39            WaypointGroup* getWaypointgroup();
    3940
    4041
    4142            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override;
    4243
    43 
     44            virtual void tick(float dt);
    4445
    4546
     
    4849            //virtual bool isCollisionTypeLegal(CollisionType type) const override;
    4950            Model* model;
    50             //Waypoint* waypoint;
     51            WaypointGroup* waypoints_;
     52            Waypoint* waypoint;
    5153            // network callbacks
    5254    };
Note: See TracChangeset for help on using the changeset viewer.