From 3e79619582dda4d687e61c9a01c1c9ba87815a72 Mon Sep 17 00:00:00 2001 From: Habiba Ayman <137416623+habibayman@users.noreply.github.com> Date: Wed, 3 Apr 2024 23:16:59 +0200 Subject: [PATCH] =?UTF-8?q?=E2=9E=95=20added=20Initial=20classes=20code=20?= =?UTF-8?q?(#6)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * ➕ added Initial classes code * ➕ Added more parameters --- Alien-Invasion.vcxproj | 7 +++++++ Alien-Invasion.vcxproj.filters | 32 +++++++++++++++++++++++++++--- UnitClasses/AlienDrone.h | 9 +++++++++ UnitClasses/AlienMonster.h | 9 +++++++++ UnitClasses/AlienSolider.h | 9 +++++++++ UnitClasses/EarthGunnery.h | 10 ++++++++++ UnitClasses/EarthSolider.h | 10 ++++++++++ UnitClasses/EarthTank.h | 10 ++++++++++ UnitClasses/Unit.h | 36 ++++++++++++++++++++++++++++++++++ 9 files changed, 129 insertions(+), 3 deletions(-) create mode 100644 UnitClasses/AlienDrone.h create mode 100644 UnitClasses/AlienMonster.h create mode 100644 UnitClasses/AlienSolider.h create mode 100644 UnitClasses/EarthGunnery.h create mode 100644 UnitClasses/EarthSolider.h create mode 100644 UnitClasses/EarthTank.h create mode 100644 UnitClasses/Unit.h diff --git a/Alien-Invasion.vcxproj b/Alien-Invasion.vcxproj index 67e189b..07b23f0 100644 --- a/Alien-Invasion.vcxproj +++ b/Alien-Invasion.vcxproj @@ -30,6 +30,13 @@ + + + + + + + 17.0 diff --git a/Alien-Invasion.vcxproj.filters b/Alien-Invasion.vcxproj.filters index 2e95a54..cb0c941 100644 --- a/Alien-Invasion.vcxproj.filters +++ b/Alien-Invasion.vcxproj.filters @@ -1,12 +1,12 @@  - - - {30a4ef19-f6b1-4dde-9639-08137b5a96c3} + + {d6265d0d-9e06-4a0b-9c88-39e5e3415fa3} + @@ -33,5 +33,31 @@ Containers + + UnitsClasses + + + UnitsClasses + + + UnitsClasses + + + UnitsClasses + + + UnitsClasses + + + UnitsClasses + + + UnitsClasses + + + + + UnitsClasses + \ No newline at end of file diff --git a/UnitClasses/AlienDrone.h b/UnitClasses/AlienDrone.h new file mode 100644 index 0000000..66fc183 --- /dev/null +++ b/UnitClasses/AlienDrone.h @@ -0,0 +1,9 @@ +#ifndef ALIENDRONE_H +#define ALIENDRONE_H + +#include "Unit.h" +class AlienDrone: public Unit +{ + +}; +#endif diff --git a/UnitClasses/AlienMonster.h b/UnitClasses/AlienMonster.h new file mode 100644 index 0000000..f150bb3 --- /dev/null +++ b/UnitClasses/AlienMonster.h @@ -0,0 +1,9 @@ +#ifndef ALIENMONSTER_H +#define ALIENMONSTER_H + +#include "Unit.h" +class AlienMonster: public Unit +{ + +}; +#endif diff --git a/UnitClasses/AlienSolider.h b/UnitClasses/AlienSolider.h new file mode 100644 index 0000000..3b7368c --- /dev/null +++ b/UnitClasses/AlienSolider.h @@ -0,0 +1,9 @@ +#ifndef ALIENSOLIDER_H +#define ALIENSOLIDER_H + +#include "Unit.h" +class AlienSolider: public Unit +{ + +}; +#endif diff --git a/UnitClasses/EarthGunnery.h b/UnitClasses/EarthGunnery.h new file mode 100644 index 0000000..f07d4a6 --- /dev/null +++ b/UnitClasses/EarthGunnery.h @@ -0,0 +1,10 @@ +#ifndef EARTHGUNNERY_H +#define EARTHGUNNERY_H + +#include "Unit.h" +class EearthGunnery: public Unit +{ + +}; +#endif + diff --git a/UnitClasses/EarthSolider.h b/UnitClasses/EarthSolider.h new file mode 100644 index 0000000..a246d3a --- /dev/null +++ b/UnitClasses/EarthSolider.h @@ -0,0 +1,10 @@ +#ifndef EARTHSOLIDER_H +#define EARTHSOLIDER_H + +#include "Unit.h" +class EearthSolider: public Unit +{ + +}; +#endif + diff --git a/UnitClasses/EarthTank.h b/UnitClasses/EarthTank.h new file mode 100644 index 0000000..584b97d --- /dev/null +++ b/UnitClasses/EarthTank.h @@ -0,0 +1,10 @@ +#ifndef EARTHTANK_H +#define EARTHTANK_H + +#include "Unit.h" +class EearthTank: public Unit +{ + +}; +#endif + diff --git a/UnitClasses/Unit.h b/UnitClasses/Unit.h new file mode 100644 index 0000000..b439693 --- /dev/null +++ b/UnitClasses/Unit.h @@ -0,0 +1,36 @@ +#ifndef UNIT_H +#define UNIT_H + +enum UnitType +{ + ES, EG, ET, + AS, AD, AM +}; +class Unit +{ + UnitType unitType; + int id; + + int Tj; // Join time + int Ta; // First attack time + int Td; // Destruction time + + int Df; // First attack delay + int Dd; // Destruction delay + int Db; // Battle time + + int health; + int power; + int attackCapacity; +public: + void recieveDamage(int loss); + virtual void print() = 0; + virtual void attack(Unit* aUnit) = 0; //shouldn't it be passed a list??? will check later + +}; +#endif + +void Unit:: recieveDamage(int loss) +{ + health -= loss; +}