From 930f01060deb923606de0838328c48f5a87c0c75 Mon Sep 17 00:00:00 2001 From: Habiba Ayman Date: Wed, 3 Apr 2024 03:18:37 +0200 Subject: [PATCH] =?UTF-8?q?=E2=9E=95=20added=20Initial=20classes=20code?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Alien-Invasion.vcxproj | 7 +++++++ 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 | 28 ++++++++++++++++++++++++++++ 8 files changed, 92 insertions(+) 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/UnitClasses/AlienDrone.h b/UnitClasses/AlienDrone.h new file mode 100644 index 0000000..66f7d38 --- /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..95c12a7 --- /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..1567bb7 --- /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..d0dada2 --- /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..55b23ca --- /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..5e1bcb5 --- /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..5870a3d --- /dev/null +++ b/UnitClasses/Unit.h @@ -0,0 +1,28 @@ +#ifndef UNIT_H +#define UNIT_H + +enum UnitType +{ + ES, EG, ET, + AS, AD, AM +}; +class Unit +{ + UnitType unitType; + int id; + int joinTime; + 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; +}