Esempio n. 1
0
void CDefendTask::FindTarget()
{
	CCircuitAI* circuit = manager->GetCircuit();
	auto enemies = std::move(circuit->GetCallback()->GetEnemyUnitsIn(GetPosition(), radius));
	if (enemies.empty()) {
		enemies = std::move(circuit->GetCallback()->GetEnemyUnitsIn(circuit->GetSetupManager()->GetBasePos(), radius));
		if (enemies.empty()) {
			SetTarget(nullptr);
			return;
		}
	}

	CEnemyUnit* bestTarget = nullptr;
	float minSqDist = std::numeric_limits<float>::max();

	for (Unit* e : enemies) {
		if (e == nullptr) {
			continue;
		}
		CEnemyUnit* enemy = circuit->GetEnemyUnit(e);
		if (enemy != nullptr) {
			float sqDist = GetPosition().SqDistance2D(enemy->GetPos());
			if (minSqDist > sqDist) {
				minSqDist = sqDist;
				bestTarget = enemy;
			}
		}
		delete e;
	}

	SetTarget(bestTarget);
}
Esempio n. 2
0
BattlePet * BattleData::GetCurrentTarget(BattlePet * attackpet)
{
	int side = attackpet->m_attackSide;
	CC_ASSERT(side == 0 || side == 1, "Side is wrong");
	if (m_bTarget[side] < 0 || m_bTarget[side] > 5)
	{
		SetTarget(side, -1, true, attackpet);
	}

	if (m_bTarget[side] == -1)
	{
		return nullptr;
	}

	if ( !m_bPets[side][m_bTarget[side]]->IsDead() )
	{
		return m_bPets[side][m_bTarget[side]];
	}
	else
	{
		SetTarget(side, -1, true, attackpet);
		if (m_bTarget[side] == -1)
		{
			return nullptr;
		}
		return m_bPets[side][m_bTarget[side]];
	}

}
Esempio n. 3
0
void
SeekerAI::CheckDecoys(double target_distance)
{
    // if the assigned target has the burner lit,
    // ignore the decoys:
    if (orig_target && orig_target->Augmenter()) {
        SetTarget(orig_target);
        return;
    }

    if (target && 
            target == orig_target && 
            orig_target->GetActiveDecoys().size()) {

        ListIter<Shot> decoy = orig_target->GetActiveDecoys();

        while (++decoy) {
            double decoy_distance = Point(decoy->Location() - self->Location()).length();

            if (decoy_distance < target_distance) {
                if (rand() < 1600) {
                    SetTarget(decoy.value(), 0);
                    return;
                }
            }
        }
    }
}
Esempio n. 4
0
void irtkQtBaseViewer::AddToDisplayedImages(irtkQtImageObject *imageObject, int index) {
    irtkImage* newImage = imageObject->GetImage();

    currentIndex = index;
    // If first image to be displayed make it target
    if (_image.size() == 0) {
        SetTarget(newImage);
        InitializeOrigin();
        InitializeDimensions();
        InitializeOrientation();
    }
    else if (index < _image.begin()->first) {
        SetTarget(newImage);
        UpdateCurrentSlice();

        InitializeDimensions();
        InitializeOrientation();
        CalculateOutputImages();
        /// check whether image dimensions agree
    }

    // If everything is fine add to maps
    AddToMaps(newImage, index);
    _lookupTable.insert(pair<int, irtkQtLookupTable*> ( index, imageObject->GetLookupTable() ));
}
Esempio n. 5
0
void Queen::Update(float _deltaTime)
{
	BaseAnt::Update(_deltaTime);
	if (timeToBorn == QUEEN_TIME_TO_BORN)
	{
		Log::Message("Was born");
		if (strategy != NULL) delete strategy;
		SetTarget(NULL);
		targetPoint = NULL;
		strategy = new WaitingStrategy(this);
		wait = true;
	}
	if (timeToBorn > 0)
	{
		timeToBorn -= _deltaTime;
	}
	else if (wait)
	{
		Log::Message("Want born");
		if (strategy != NULL) delete strategy;
		SetTarget(NULL);
		*targetPoint = *nest->Position();
		strategy = new BornStrategy(this);
		wait = false;
	}
}
Esempio n. 6
0
void C_Camera::SpecTargetByIndex(int index)
{
	if (index > gpGlobals->maxClients)
	{
		if (GetMatchBall() && GetMatchBall()->entindex() == index)
			SetTarget(index);
	}
	else
	{
		C_BasePlayer *pPlayer =	UTIL_PlayerByIndex( index );
		if (pPlayer)
			SetTarget(index);
	}
}
Esempio n. 7
0
void CNPC_Hydra::StartTask( const Task_t *pTask )
{
	switch( pTask->iTask )
	{
	case TASK_HYDRA_DEPLOY:
		m_vecHeadGoal = GetAbsOrigin( ) + m_vecOutward * 100;
		m_idealLength = 100;
		m_vecHeadDir = m_vecOutward;
		return;
	case TASK_HYDRA_PREP_STAB:
		{
			m_flTaskEndTime = gpGlobals->curtime + pTask->flTaskData;

			// Go outward
			m_vecHeadGoal = GetAbsOrigin( ) + m_vecOutward * 100;
			SetTarget( (CBaseEntity *)UTIL_GetLocalPlayer() );
			if (GetEnemy())
			{
				SetTarget( GetEnemy() );
			}

			//CPASAttenuationFilter filter( this, "NPC_Hydra.Alert" );
			//Vector vecHead = EyePosition();
			//EmitSound( filter, entindex(), "NPC_Hydra.Alert", &vecHead );
		}
		return;

	case TASK_HYDRA_STAB:
		{
			//CPASAttenuationFilter filter( this, "NPC_Hydra.Attack" );
			//Vector vecHead = EyePosition();
			//EmitSound( filter, entindex(), "NPC_Hydra.Attack", &vecHead );

			m_flTaskEndTime = gpGlobals->curtime + 0.5;
		}
		return;

	case TASK_HYDRA_PULLBACK:
		m_vecHeadGoal = GetAbsOrigin( ) + m_vecOutward * pTask->flTaskData;
		m_idealLength = pTask->flTaskData * 1.1;
		return;

	default:
		BaseClass::StartTask( pTask );
		break;
	}

}
Esempio n. 8
0
void ZObserver::ChangeToNextTarget()
{
	if (g_pGame == NULL) return;
	if (m_pTargetCharacter == NULL) return;

	ZCharacterManager::iterator itor = g_pGame->m_CharacterManager.find(m_pTargetCharacter->GetUID());
	ZCharacter* pCharacter = NULL;
	bool bFlag = false;
	if (itor != g_pGame->m_CharacterManager.end())
	{
		do 
		{
			itor++;

			if (itor == g_pGame->m_CharacterManager.end())
			{
				if (bFlag) 
				{
					// This bugs replays when both players die at the same time
					//Show(false);
					return;
				}

				itor = g_pGame->m_CharacterManager.begin();
				bFlag = true;
			}
			pCharacter = (*itor).second;

		} while (!IsVisibleSetTarget(pCharacter));

		SetTarget(pCharacter);
	}
}
void CAI_LeadBehavior::BeginScheduleSelection()
{
	SetTarget( AI_GetSinglePlayer() );
	CAI_Expresser *pExpresser = GetOuter()->GetExpresser();
	if ( pExpresser )
		pExpresser->ClearSpokeConcept( TLK_LEAD_ARRIVAL );
}
task autonomous()
{

	wait1Msec(5000);
	startTask(FlywheelController);
	SetTarget(1600,80);
	startTask(recoverFromShots);

	wait1Msec(4500);
	SensorValue[ANGLE] = 0;
	clearTimer(T3);

	while(time1[T3] <2550)
	{
		motor[rdy] = motor[rd] = -127 - (SensorValue[ANGLE]);  // was 8
		motor[ld] = motor[ldy] = -127 + (SensorValue[ANGLE]);
		wait1Msec(10);
	}
	motor[rd] = motor[rdy] = 0;
	motor[ld] = motor[ldy] = 0;
	startTask(autoConveyor);
	while(true)
	{}
//	AutonomousCodePlaceholderForTesting();  // Remove this function call once you have "real" code.
}
Esempio n. 11
0
void psClientCharManager::HandleTargetUpdate( MsgEntry* me )
{
    psGUITargetUpdateMessage targetMsg(me);
    if(targetMsg.targetID.IsValid()) //we have an eid
    {
        GEMClientObject* object = cel->FindObject( targetMsg.targetID );
        if ( object )
            SetTarget( object, "select", false);
        else
            Error1("Received TagetUpdateMessage with invalid target.");
    }
    else //we have an invalid eid (0) so we untarget
    {
         SetTarget(NULL, "select", false);
    }
}
Esempio n. 12
0
FatZombie::~FatZombie()
{
	SetTarget(nullptr);
	UnregisterFromEvent("GAME_OVER");

	
}
Esempio n. 13
0
    void PetAI::Attack(long actID, long x, long y, CMoveShape *target)
    {
        if(m_Host == NULL)
        {
			LogError(AI_MODULE, "m_Host is null.");
            return;
        }
		if (target == NULL)
		{
			LogError(AI_MODULE, "target is null.");
			return;
		}
        stModuParam *currentSkill = m_Owner->GetInstanceSkill();
        if(currentSkill != NULL)
        {
            eAddSub skillType = currentSkill->GetAddSub();
            if(BeginSkill(currentSkill, x, y, target) &&
                skillType == eSub_Type)
            {
                if(target != NULL && target != GetTarget())
                {
                    SetTarget(target->GetExID(), target->GetType());
                }
            }
        }
		else
		{
			LogError(AI_MODULE, "m_Owner->GetInstanceSkill() error");
		}
    }
Esempio n. 14
0
int Reaching::PerformPerturbedTrajectory(string *infname, string *outfname){
  string line;
  int i,perturbationTime,n=1;
  cart_vec_t& tar;
  joint_vec_t& pos,acc;
  ifstream istr(infname->c_str());
  string fname(*outfname);

  if(istr.fail()){
    cout <<"can't open file "<<infname->c_str()<<endl;
    return 0;
  }
  else{
    getline(istr,line);
    if(7 != sscanf(line.c_str(),"%f %f %f : %f %f %f %f ",&(tar[0]),&(tar[1]),&(tar[2]),
		     &(pos[0]),&(pos[1]),&(pos[2]),&(pos[3]))){
#ifndef SILENT
      cout << "line " << n << " not decripted"<<endl;
#endif
      return -3;
    }
    else{
      if(SetTarget(tar)){
	if(SetActualRobPosition(pos)){
	  ofstream out(fname.c_str());
	  while(!istr.eof()){ 
	    n++;
	    getline(istr,line);
	    if(5!= sscanf(line.c_str(),"%d : %f %f %f %f",&perturbationTime, 
			  &(acc[0]),&(acc[1]), &(acc[2]),&(acc[3]))){
#ifndef SILENT
	      cout << "line " << n << " not decripted"<<endl;
#endif
	    }
	    else{
	      for(i=1;i<perturbationTime;i++){
		ReachingStep();
		out << *this << endl;
	      }
	      SetRobAcceleration(acc);
	      out << *this << endl;
	    }
	  }
	  for(i=0;i<MAX_IT && !TargetReached();i++){
	    ReachingStep();
	    out << *this << endl;
	  }
	  out.close();
	  return TargetReached();
	}
	else{
	  return -1;
	}
      }
      else{
	return -2;
      }
    }
  }
}
Esempio n. 15
0
void
AATPoint::SetTarget(const fixed range, const fixed radial,
                    const TaskProjection &proj)
{
  fixed oldrange = fixed_zero;
  fixed oldradial = fixed_zero;
  GetTargetRangeRadial(oldrange, oldradial);

  const FlatPoint fprev =
    proj.ProjectFloat(GetPrevious()->GetLocationRemaining());
  const FlatPoint floc = proj.ProjectFloat(GetLocation());
  const FlatLine flb (fprev,floc);
  const FlatLine fradius (floc,proj.ProjectFloat(GetLocationMin()));
  const fixed bearing = fixed_minus_one * flb.angle().Degrees();
  const fixed radius = fradius.d();

  fixed swapquadrants = fixed_zero;
  if (positive(range) != positive(oldrange))
    swapquadrants = fixed(180);
  const FlatPoint ftarget1 (fabs(range) * radius *
        cos((bearing + radial + swapquadrants)
            / fixed(360) * fixed_two_pi),
      fabs(range) * radius *
        sin( fixed_minus_one * (bearing + radial + swapquadrants)
            / fixed(360) * fixed_two_pi));

  const FlatPoint ftarget2 = floc + ftarget1;
  const GeoPoint targetG = proj.Unproject(ftarget2);

  SetTarget(targetG, true);
}
Esempio n. 16
0
bool ZObserver::OnKeyEvent(bool bCtrl, char nKey)
{
	int nIndex = 0;
	if (m_QuickTarget.ConvertKeyToIndex(nKey, &nIndex) == false)
		return false;

	if (bCtrl) {
		m_QuickTarget.StoreTarget(nIndex, GetTargetCharacter()->GetUID());
	} else {
		MUID uidTarget = m_QuickTarget.GetTarget(nIndex);

		// Å°ÅÁöÁ¤ Ư¼öÅ° »ç¿ë üũ
		if ((uidTarget == MUID(0,0)) && (nKey == OBSERVER_QUICK_TAGGER_TARGET_KEY))
		{
			for (ZCharacterManager::iterator itor = g_pGame->m_CharacterManager.begin(); 
				itor != g_pGame->m_CharacterManager.end(); ++itor)
			{
				ZCharacter* pChar = (*itor).second;
				if (pChar->IsTagger())
				{
					uidTarget = pChar->GetUID();
					break;
				}
			}
		}
		
		ZCharacter* pCharacter = g_pGame->m_CharacterManager.Find(uidTarget);
		if (pCharacter && pCharacter->IsDie() == false)
		{
			SetTarget(uidTarget);
		}
	}
	return true;
}
Esempio n. 17
0
void CASW_Rocket::FindHomingPosition( Vector *pTarget )
{	
	CBaseEntity *pHomingTarget = m_hHomingTarget.Get();

	if ( !pHomingTarget )
	{
		SetTarget( pHomingTarget = FindPotentialTarget() );
		m_bFlyingWild = false;
	}

	if ( pHomingTarget )
	{
		*pTarget = pHomingTarget->WorldSpaceCenter();
		return;
	}
	else
	{
		// just fly straight if there's nothing to home in on
		Vector vecDir = GetAbsVelocity();
		vecDir.z = 0;
		*pTarget = GetAbsOrigin() + vecDir * 200.0f;
		VectorAngles( vecDir, m_vWobbleAngles );
		m_bFlyingWild = true;
	}
}
//-----------------------------------------------------------------------------
// Methods to change various targets
//-----------------------------------------------------------------------------
void CLogicMeasureMovement::InputSetMeasureTarget( inputdata_t &inputdata )
{
    m_strMeasureTarget = MAKE_STRING( inputdata.value.String() );
    SetMeasureTarget( inputdata.value.String() );
    SetTarget( STRING(m_target) );
    SetTargetReference( STRING(m_strTargetReference) );
}
Esempio n. 19
0
bool
FlarmTrafficWindow::SelectNearTarget(int x, int y, int max_distance)
{
  int min_distance = 99999;
  int min_id = -1;

  for (unsigned i = 0; i < data.traffic.size(); ++i) {
    // If FLARM target does not exist -> next one
    if (!data.traffic[i].IsDefined())
      continue;

    int distance_sq = (x - sc[i].x) * (x - sc[i].x) +
                      (y - sc[i].y) * (y - sc[i].y);

    if (distance_sq > min_distance
        || distance_sq > max_distance * max_distance)
      continue;

    min_distance = distance_sq;
    min_id = i;
  }

  if (min_id >= 0)
    SetTarget(min_id);

  return min_id >= 0;
}
Esempio n. 20
0
void
IPAddressControl::AttachedToWindow()
{
	BTextControl::AttachedToWindow();
	SetTarget(this);
	_UpdateMark();
}
task autonomous()
{
	//8.3 battery working
	setUp();
	startTask(FlywheelController);
	startTask(recoverFromShots);
	startTask(rpmIndicator);
	SetTarget(2610,85);
	wait1Msec(5000);
	Conveyor(127);
	wait1Msec(500);
	Conveyor(0);
	wait1Msec(2000);
	Conveyor(127);
	wait1Msec(500);
	Conveyor(0);
	wait1Msec(2000);
	Conveyor(127);
	wait1Msec(500);
	Conveyor(0);
	wait1Msec(2000);
	Conveyor(127);
	while(true)
	{}
}
Esempio n. 22
0
/*virtual*/ void CEarthBoss::HandleEvent(CEvent* pEvent)
{
	if (pEvent->GetEventID() == "New_Player")
		SetTarget((CEntity*)(pEvent->GetParam()));
	if (pEvent->GetDestination() == this)
	{
		if (pEvent->GetEventID() == "ModifyHealth")
			ModifyHealth( *(int*)(pEvent->GetParam()) );
		if (pEvent->GetDestination() == this && pEvent->GetEventID() == "Set_State")
			m_pEState->SetState((CEntityState::ENTITY_STATE)(int)(pEvent->GetParam()) );
		if (pEvent->GetDestination() == this && pEvent->GetEventID() == "Dodge_Pitfall")
			HandleCollision((const IEntity*)pEvent->GetSender(), *(const RECT*)pEvent->GetParam());
		if (pEvent->GetDestination() == this && pEvent->GetEventID() == "Kill_Self")
		{
			CRemoveEntityMessage* pDestroyMsg = new CRemoveEntityMessage(this);
			CSGD_MessageSystem::GetInstance()->SendMsg(pDestroyMsg);
			pDestroyMsg = nullptr;
		}
		if (pEvent->GetEventID() == "Self Destruct")
		{
			CRemoveEntityMessage* pMsg = new CRemoveEntityMessage(this);
			CSGD_MessageSystem::GetInstance()->SendMsg(pMsg);
			pMsg = nullptr;

			CDropEXPMessage* free_money = new CDropEXPMessage(m_nExpPts);
			CSGD_MessageSystem::GetInstance()->SendMsg(free_money);
			free_money = nullptr;
		}
	}
}
Esempio n. 23
0
CAbilityState::CAbilityState(CBattleEntity* PEntity, uint16 targid, uint16 abilityid) :
    CState(PEntity, targid),
    m_PEntity(PEntity)
{
    CAbility* PAbility = ability::GetAbility(abilityid);

    if (!PAbility)
    {
        throw CStateInitException(std::make_unique<CMessageBasicPacket>(m_PEntity, m_PEntity, 0, 0, MSGBASIC_UNABLE_TO_USE_JA));
    }
    auto PTarget = m_PEntity->IsValidTarget(m_targid, PAbility->getValidTarget(), m_errorMsg);

    if (!PTarget || m_errorMsg)
    {
        throw CStateInitException(std::move(m_errorMsg));
    }
    SetTarget(PTarget->targid);
    m_PAbility = std::make_unique<CAbility>(*PAbility);
    m_castTime = PAbility->getCastTime();
    if (m_castTime > 0s)
    {
        action_t action;
        action.id = PEntity->id;
        action.actiontype = ACTION_WEAPONSKILL_START;
        auto& list = action.getNewActionList();
        list.ActionTargetID = PTarget->id;
        auto& actionTarget = list.getNewActionTarget();
        actionTarget.reaction = (REACTION)24;
        actionTarget.animation = 121;
        actionTarget.messageID = 326;
        actionTarget.param = PAbility->getID() + 16;
        PEntity->loc.zone->PushPacket(PEntity, CHAR_INRANGE_SELF, new CActionPacket(action));
    }
    m_PEntity->PAI->EventHandler.triggerListener("ABILITY_START", m_PEntity, PAbility);
}
Esempio n. 24
0
TypeSceneLine::TypeSceneLine( TypeSceneItem& from, TypeSceneItem& target , Qt::GlobalColor color )
    : QGraphicsLineItem( &from )
{
    SetFrom( from );
    SetTarget( target );
    SetColor( color );
}
Esempio n. 25
0
void DrumsetDropField::AttachedToWindow() {
	
	BFont font;
	font.SetFamilyAndStyle("Swis721 BT","Roman"); 
	font.SetSize( 8.0 );
	SetFont(&font);
	
	SetLowColor( 66, 99, 132 );
	SetHighColor( 210, 220, 230 );
		
	BeginPicture( new BPicture() );
	DrawBitmap(((App *)be_app)->FetchResourceBitmap("dropfield"), BPoint(0.0, 0.0));
	DrawString("Drop instrument here!", BPoint(6.0, 12.0));
	fNormalBitmap = EndPicture();
	
	BeginPicture( new BPicture() );
	DrawBitmap(((App *)be_app)->FetchResourceBitmap("dropfield"), BPoint(0.0, 0.0));
	SetDrawingMode(B_OP_ALPHA);
	SetHighColor(0,0,0,80);
	FillRect(Bounds().InsetByCopy(1.0, 1.0));
	SetHighColor( 255, 255, 255 );
	DrawString("Drop instrument here!", BPoint(7.0, 13.0));
	fActiveBitmap = EndPicture();

	SetTarget(Parent());

}
Esempio n. 26
0
void LinkEvent::UnserializeFrom(gd::Project & project, const SerializerElement & element)
{
    SerializerElement & includeElement = element.GetChild("include", 0, "Limites");

    SetTarget(element.GetChild("target", 0, "Scene").GetValue().GetString());

    if(includeElement.HasAttribute("includeAll"))
    {
        //Compatibility with GDevelop <= 4.0.92
        if(includeElement.GetBoolAttribute("includeAll", true))
        {
            SetIncludeAllEvents();
        }
        else
        {
            SetIncludeStartAndEnd(includeElement.GetIntAttribute("start"),
                includeElement.GetIntAttribute("end"));
        }
    }
    else
    {
        //GDevelop > 4.0.92
        IncludeConfig config = static_cast<IncludeConfig>(includeElement.GetIntAttribute("includeConfig", 0));
        if(config == INCLUDE_ALL)
            SetIncludeAllEvents();
        else if(config == INCLUDE_EVENTS_GROUP)
            SetIncludeEventsGroup(includeElement.GetStringAttribute("eventsGroup"));
        else if(config == INCLUDE_BY_INDEX)
            SetIncludeStartAndEnd(includeElement.GetIntAttribute("start"), includeElement.GetIntAttribute("end"));
    }

}
Esempio n. 27
0
// constructor
VolumeSlider::VolumeSlider(BRect frame, const char* name,
						   int32 minValue, int32 maxValue,
						   BMessage* message, BHandler* target)
	: BControl(frame, name, NULL, message, B_FOLLOW_LEFT | B_FOLLOW_TOP,
			   B_WILL_DRAW | B_FULL_UPDATE_ON_RESIZE),
	  fLeftSideBits(NULL),
	  fRightSideBits(NULL),
	  fKnobBits(NULL),
	  fTracking(false),
	  fMuted(false),
	  fMinValue(minValue),
	  fMaxValue(maxValue)
{
	SetTarget(target);

	// create bitmaps
	BRect r(0.0, 0.0,
			kVolumeSliderBitmapWidth - 1, kVolumeSliderBitmapHeight - 1);
	fLeftSideBits = new BBitmap(r, B_CMAP8);
	fRightSideBits = new BBitmap(r, B_CMAP8);
	r.Set(0.0, 0.0,
		  kVolumeSliderKnobWidth - 1, kVolumeSliderKnobHeight - 1);
	fKnobBits = new BBitmap(r, B_CMAP8);

	_MakeBitmaps();
}
Esempio n. 28
0
void CAttackState::UpdateTarget(uint16 targid)
{
    m_errorMsg.reset();
    auto newTargid = m_PEntity->GetBattleTargetID();
    auto PNewTarget = m_PEntity->IsValidTarget(newTargid, TARGET_ENEMY, m_errorMsg);
    if (!PNewTarget)
    {
        m_PEntity->PAI->ChangeTarget(0);
        newTargid = 0;
    }
    if (targid != newTargid)
    {
        if (targid != 0)
        {
            m_PEntity->OnChangeTarget(PNewTarget);
            SetTarget(newTargid);
            if (!PNewTarget)
            {
                m_errorMsg.reset();
                return;
            }
        }
    }
    CState::UpdateTarget(m_PEntity->GetBattleTargetID());
}
//------------------------------------------------------------------------------
// Purpose: routine called to start when a task initially starts
// Input  : pTask - the task structure
//------------------------------------------------------------------------------
void CAI_ASW_HealOtherBehavior::StartTask( const Task_t *pTask )
{
	switch( pTask->iTask )
	{
		case TASK_HEAL_OTHER_FIND_TARGET:
			{
				if ( m_hHealTargetEnt )
				{
					AI_NavGoal_t goal( GOALTYPE_TARGETENT, ACT_RUN, m_flApproachDistance, AIN_YAW_TO_DEST | AIN_UPDATE_TARGET_POS, m_hHealTargetEnt );
					SetTarget( m_hHealTargetEnt );
					GetNavigator()->SetArrivalDistance( m_flApproachDistance );
					GetNavigator()->SetGoal( goal );
				}
				else
				{
					TaskFail( FAIL_NO_TARGET );
					m_flDeferUntil = gpGlobals->curtime + 3.0f;
				}
				break;
			}

		case TASK_HEAL_OTHER_MOVE_TO_TARGET:
			{
				break;
			}

		default:
			BaseClass::StartTask( pTask );
			break;
	}
}
    IFACEMETHODIMP CanvasCommandList::CreateDrawingSession(
        ICanvasDrawingSession** drawingSession)
    {
        return ExceptionBoundary(
            [&]
            {
                CheckAndClearOutPointer(drawingSession);

                if (m_d2dCommandListIsClosed)
                    ThrowHR(E_INVALIDARG, Strings::CommandListCannotBeDrawnToAfterItHasBeenUsed);

                if (*m_hasActiveDrawingSession)
                    ThrowHR(E_FAIL, Strings::CannotCreateDrawingSessionUntilPreviousOneClosed);

                auto& d2dCommandList = GetResource();
                auto& device = m_device.EnsureNotClosed();

                auto deviceContext = As<ICanvasDeviceInternal>(device)->CreateDeviceContextForDrawingSession();
                deviceContext->SetTarget(d2dCommandList.Get());

                auto adapter = std::make_shared<SimpleCanvasDrawingSessionAdapter>(deviceContext.Get());

                auto ds = CanvasDrawingSession::CreateNew(deviceContext.Get(), adapter, device.Get(), m_hasActiveDrawingSession);

                ThrowIfFailed(ds.CopyTo(drawingSession));
            });
    }