//Unit* unit;
//TheList->
0: unit->moveToTargetUntilInRadius(quest_giver_person.position, glob::COMMUNICATION_RADIUS);//To be very simple, this gets you to target until you are in radius given
1: unit->getQuestFrom(quest_giver_person);//AI Logic handles this, and gets quest
//Unit* unit;
//TheList->
0: unit->moveUntilPathFinished();//Follows generated path, handles exceptions like collision that shouldn't occur, but gets you to target location in the end
1: unit->moveToTargetUntilInRadius(quest_giver_person.position, glob::COMMUNICATION_RADIUS);//To be very simple, this gets you to target until you are in radius given
2: unit->getQuestFrom(quest_giver_person);//AI Logic handles this, and gets quest
//Unit* unit;
//TheList->
0: unit->moveToTargetUntilInRadius(quest_giver_person.position, glob::COMMUNICATION_RADIUS);//To be very simple, this gets you to target until you are in radius given
1: unit->getQuestFrom(quest_giver_person);//AI Logic handles this, and gets quest
//Unit* unit;
//TheList->
1: unit->getQuestFrom(quest_giver_person);//AI Logic handles this, and gets quest
int main()
{
}
int a = 1;
double d = 2;//REGISTER THIS AS C++ SNYTAX PLS!
//Unit.h
namespace uni
{
enum MovementType
{
MTNone = 0,
MTPath = 2,
MTKeysButton = 3,
MTPatrol = 4
};
};
class UnitMovement
{
public:
uni::MovementType moveType;
glob::Direction movDirectionX;
glob::Direction movDirectionY;
bool isMoving;
double moveSpeed;
std::vector<sf::Vector2f> listPath;
int moveTargetVecID;//Target vecID to follow
glob::Direction facingDirection;
int patrolVecID;//This is ID, that indicates to which note in listPath to move to
int patrolIncrementValue;//This is to know if moving forward on path or backwards
unsigned int patrolAmountOfTimes;
UnitMovement(double MoveSpeed);
UnitMovement(double MoveSpeed, const std::vector<sf::Vector2f> & ListPath);
void setMoveToLocation(Object & me, const sf::Vector2f & position);
void setMoveToLocationSmart(Object & me, const sf::Vector2f & position);//Uses AStar
void setAllMovementToHalt();
void setPatrolToLocation(Object & me, const sf::Vector2f & position, unsigned int TimesToPatrol = glob::MaxUI);
void setPatrolPath(Object & me, std::vector<sf::Vector2f> & listPath, unsigned int TimesToPatrol = glob::MaxUI);
void AssignFollowTarget(Object & obj);
void SetFacingDirection(glob::Direction dir, Object & me);
};
class Unit : public UnitMovement, public UnitBattle ...
{
public:
LoopUnit();//Loops unit specific stuff like movement, following paths, and executes it on the unit effectively causing un
//it to reposition, and calls LoopUnitAI()
LoopUnitAI();//Loops unit AI specific stuff if unit controller is AI
};
//Object.h
class Object
{
public:
std::unique_ptr<Unit> unit;
};
class ObjectHolder
{
public:
std::vector<Object> listObject;
LoopObjects();//Handles objects logic, and calls LoopUnit()
};
I gave it a though with teammate, and the result is pretty poor, it will work but i don't like that:
How it would work is:
Have a function that would take action, and be able to tell unit what to do with the action.
For example:
int a = 0;//C++ syntax PLS!
enum Command
{
none = 0,
moveToTargetUntilInRadius = 1,
getQuestFrom = 2
//...
};
class Action
{
Command commandType;
//Whatever std::bind requires to be stored
Action(Command CommandType, whatever_std::bind_requires);
}
//Will probably use std::list for the final product, but i haven't used list in ages so i'l use vector in this example
std::vector<Action> listActions;//This would be the list that unit has
//This is how it would add stuff to the list
listActions.push_back(Action(Command::moveToTargetUntilInRadius, std::bind(target_unit->objVectorID)));
And this should work, i need to prototype it first, but its idea we came up with.