Transport vehicle class

This commit is contained in:
devZoGok
2023-10-17 19:46:16 +03:00
parent dfeddbdaa0
commit 0a4b7ae08e
9 changed files with 74 additions and 4 deletions
+1
View File
@@ -36,6 +36,7 @@ units = {
cost = {500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500},
range = {15, 15, 14, 14, 13, 13, 12, 12, 15, 25},
rateOfFire = {50, 100, 100, 100, 100, 100, 100},
garrisonCapacity = {0, 0, 3, 0, 0, 0, 0},
unitCornerPoints = {
{
+2 -2
View File
@@ -23,8 +23,8 @@ set(CONSOLE console.cpp abstractCommand.cpp addUnitCommand.cpp addResourceComman
set(CORE gameManager.cpp game.cpp defConfigs.cpp ${CONSOLE} ${CONTROLLERS})
set(PROJECTILES projectile.cpp)
set(FX fx.cpp)
set(VEHICLES vehicle.cpp engineer.cpp)
set(UNITS gameObjectFactory.cpp unit.cpp structure.cpp ${VEHICLES})
set(VEHICLES vehicle.cpp engineer.cpp transport.cpp)
set(UNITS gameObjectFactory.cpp unit.cpp structure.cpp garrisonable.cpp ${VEHICLES})
set(CONTENT player.cpp pathfinder.cpp map.cpp gameObject.cpp gameObjectFrame.h resourceDeposit.cpp ${UNITS} ${PROJECTILES} ${FX})
set(GAME_SRC ${STATES} ${GUI} ${CORE} ${CONTENT} ${UTIL})
+3 -1
View File
@@ -1,7 +1,7 @@
#include "gameObjectFactory.h"
#include "player.h"
#include "vehicle.h"
#include "engineer.h"
#include "transport.h"
#include "projectile.h"
#include "resourceDeposit.h"
#include "defConfigs.h"
@@ -22,6 +22,8 @@ namespace battleship{
switch((UnitClass)unitClass){
case UnitClass::ENGINEER:
return new Engineer(player, id, pos, rot);
case UnitClass::TRANSPORT:
return new Transport(player, id, pos, rot);
default:
return new Vehicle(player, id, pos, rot);
}
+10
View File
@@ -0,0 +1,10 @@
#include "garrisonable.h"
#include <node.h>
namespace battleship{
using namespace vb01;
void Garrisonable::ejectVehicle(int id){
}
}
+24
View File
@@ -0,0 +1,24 @@
#ifndef GARRISONABLE_H
#define GARRISONABLE_H
#include <vector>
namespace vb01{
class Node;
}
namespace battleship{
class Vehicle;
class Garrisonable{
public:
Garrisonable(){}
void ejectVehicle(int);
protected:
int capacity;
std::vector<Vehicle*> garrisonedVehicles;
std::vector<vb01::Node*> garrisonSlotForegrounds, garrisonSlotBackgrounds;
};
}
#endif
+8
View File
@@ -0,0 +1,8 @@
#include "transport.h"
#include "player.h"
namespace battleship{
using namespace vb01;
Transport::Transport(Player *player, int id, Vector3 pos, Quaternion rot) : Vehicle(player, id, pos, rot), Garrisonable(){}
}
+17
View File
@@ -0,0 +1,17 @@
#ifndef TRANSPORT_H
#define TRANSPORT_H
#include "vehicle.h"
#include "garrisonable.h"
namespace battleship{
class Player;
class Transport : public Vehicle, Garrisonable{
public:
Transport(Player*, int, vb01::Vector3, vb01::Quaternion);
private:
};
}
#endif
+4
View File
@@ -10,6 +10,7 @@
#include "vehicle.h"
#include "pathfinder.h"
#include "garrisonable.h"
#include "map.h"
using namespace gameBase;
@@ -151,6 +152,9 @@ namespace battleship{
removeOrder(0);
}
void Vehicle::garrison(Garrisonable *garrisonable){
}
//TODO add hover unit type
//TODO cleanup debug pathpoint removal
void Vehicle::preparePathpoints(Order order){
+5 -1
View File
@@ -8,13 +8,17 @@ namespace vb01{
}
namespace battleship{
class Garrisonable;
class Vehicle : public Unit{
public:
Vehicle(Player*, int, vb01::Vector3, vb01::Quaternion);
~Vehicle();
void move(Order);
void garrison(Garrisonable*);
bool isGarrisoned(){return garrisoned;}
private:
bool pursuingTarget = false;
bool pursuingTarget = false, garrisoned = false;
int patrolPointId = 0;
float speed, maxTurnAngle, anglePrecision;
vb01::Material *debugMat = nullptr;