|
|
|
@ -431,7 +431,7 @@ void Unit::_RunAI(PixelGameEngine*pge){ |
|
|
|
|
RunAI(pge); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void Unit::_Update(PixelGameEngine*pge,std::map<Sound,std::unique_ptr<Audio>>&SOUNDS){ |
|
|
|
|
void Unit::_Update(PixelGameEngine*pge,std::map<Sound,std::unique_ptr<Audio>>&SOUNDS,Resources&player_resources,Resources&enemy_resources){ |
|
|
|
|
if(!target.expired()){ |
|
|
|
|
auto ptrTarget=target.lock(); |
|
|
|
|
if(!InRange(ptrTarget)){ |
|
|
|
@ -452,6 +452,31 @@ void Unit::_Update(PixelGameEngine*pge,std::map<Sound,std::unique_ptr<Audio>>&SO |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if(!attachedPoint.expired()){ |
|
|
|
|
collectionTime-=pge->GetElapsedTime(); |
|
|
|
|
if(collectionTime<=0){ |
|
|
|
|
collectionTime=CONSTANT::COLLECTION_WAIT_TIME; |
|
|
|
|
Resources&targetResource=IsFriendly()?player_resources:enemy_resources; |
|
|
|
|
switch(attachedPoint.lock()->type){ |
|
|
|
|
case HEALTH:{ |
|
|
|
|
targetResource.health++; |
|
|
|
|
}break; |
|
|
|
|
case RANGE:{ |
|
|
|
|
targetResource.range++; |
|
|
|
|
}break; |
|
|
|
|
case ATKSPD:{ |
|
|
|
|
targetResource.atkSpd++; |
|
|
|
|
}break; |
|
|
|
|
case MOVESPD:{ |
|
|
|
|
targetResource.moveSpd++; |
|
|
|
|
}break; |
|
|
|
|
case PROCEDURE:{ |
|
|
|
|
targetResource.procedure++; |
|
|
|
|
}break; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if(!IsFriendly()){ |
|
|
|
|
_RunAI(pge); |
|
|
|
|
} |
|
|
|
|