Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 17, 2010, 1:22:26 PM (14 years ago)
Author:
dafrick
Message:

Added DistanceTriggerBeacon, which is a device which can be attached to objects to trigger a DistanceTrigger (both the (single) DistanceTrigger and DistanceMultiTrigger) based on the name of the DistanceTri$
Also some minor adjustements in QuestEffectBeacon: Removed some output and adjusted the outputlevel of some other output.
And started working on PickupInventory again (though no significant changes yet).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/trunk/src/modules/objects/triggers/DistanceMultiTrigger.cc

    r6864 r6906  
    3636#include "core/CoreIncludes.h"
    3737#include "core/XMLPort.h"
     38#include "DistanceTriggerBeacon.h"
    3839
    3940namespace orxonox
     
    5152       
    5253        this->distance_ = 100.0f;
     54        this->targetName_ = BLANKSTRING;
     55        this->singleTargetMode_ = false;
    5356    }
    5457
     
    7073
    7174        XMLPortParam(DistanceMultiTrigger, "distance", setDistance, getDistance, xmlelement, mode);
     75        XMLPortParam(DistanceMultiTrigger, "targetname", setTargetName, getTargetName, xmlelement, mode);
    7276    }
    7377
     
    128132                continue;
    129133
     134            // If the DistanceMultiTrigger is in single-target-mode.
     135            if(this->singleTargetMode_)
     136            {
     137                // If the object that is a target is no DistanceTriggerBeacon, then the DistanceMultiTrigger can't be in single-target-mode.
     138                if(!(*it)->isA(ClassIdentifier<DistanceTriggerBeacon>::getIdentifier()))
     139                    this->singleTargetMode_ = false;
     140                // If the target name and the name of the DistancTriggreBeacon don't match.
     141                else if(entity->getName().compare(this->targetName_) != 0)
     142                    continue;
     143            }
     144
    130145            Vector3 distanceVec = entity->getWorldPosition() - this->getWorldPosition();
    131146            // If the object is in range.
     
    136151                    continue;
    137152
     153                // Change the entity to the parent of the DistanceTriggerBeacon (if in single-target-mode), which is the entity to which the beacon is attached.
     154                if(this->singleTargetMode_)
     155                    entity = entity->getParent();
     156               
    138157                // If no queue has been created, yet.
    139158                if(queue == NULL)
Note: See TracChangeset for help on using the changeset viewer.