Skip to content

Commit

Permalink
➕ added Initial classes code (#6)
Browse files Browse the repository at this point in the history
* ➕ added Initial classes code

* ➕ Added more parameters
  • Loading branch information
habibayman authored Apr 3, 2024
1 parent 1a63902 commit 3e79619
Show file tree
Hide file tree
Showing 9 changed files with 129 additions and 3 deletions.
7 changes: 7 additions & 0 deletions Alien-Invasion.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,13 @@
<ClInclude Include="Containers\PriorityQueue.h" />
<ClInclude Include="Containers\QueueADT.h" />
<ClInclude Include="Containers\StackADT.h" />
<ClInclude Include="UnitClasses\AlienDrone.h" />
<ClInclude Include="UnitClasses\AlienMonster.h" />
<ClInclude Include="UnitClasses\AlienSolider.h" />
<ClInclude Include="UnitClasses\EarthGunnery.h" />
<ClInclude Include="UnitClasses\EarthSolider.h" />
<ClInclude Include="UnitClasses\EarthTank.h" />
<ClInclude Include="UnitClasses\Unit.h" />
</ItemGroup>
<PropertyGroup Label="Globals">
<VCProjectVersion>17.0</VCProjectVersion>
Expand Down
32 changes: 29 additions & 3 deletions Alien-Invasion.vcxproj.filters
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<ClCompile Include="main.cpp" />
</ItemGroup>
<ItemGroup>
<Filter Include="Containers">
<UniqueIdentifier>{30a4ef19-f6b1-4dde-9639-08137b5a96c3}</UniqueIdentifier>
</Filter>
<Filter Include="UnitsClasses">
<UniqueIdentifier>{d6265d0d-9e06-4a0b-9c88-39e5e3415fa3}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClInclude Include="Containers\PriorityQueue.h">
Expand All @@ -33,5 +33,31 @@
<ClInclude Include="Containers\ArrayStack.h">
<Filter>Containers</Filter>
</ClInclude>
<ClInclude Include="UnitClasses\AlienDrone.h">
<Filter>UnitsClasses</Filter>
</ClInclude>
<ClInclude Include="UnitClasses\AlienMonster.h">
<Filter>UnitsClasses</Filter>
</ClInclude>
<ClInclude Include="UnitClasses\AlienSolider.h">
<Filter>UnitsClasses</Filter>
</ClInclude>
<ClInclude Include="UnitClasses\EarthGunnery.h">
<Filter>UnitsClasses</Filter>
</ClInclude>
<ClInclude Include="UnitClasses\EarthSolider.h">
<Filter>UnitsClasses</Filter>
</ClInclude>
<ClInclude Include="UnitClasses\EarthTank.h">
<Filter>UnitsClasses</Filter>
</ClInclude>
<ClInclude Include="UnitClasses\Unit.h">
<Filter>UnitsClasses</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="main.cpp">
<Filter>UnitsClasses</Filter>
</ClCompile>
</ItemGroup>
</Project>
9 changes: 9 additions & 0 deletions UnitClasses/AlienDrone.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#ifndef ALIENDRONE_H
#define ALIENDRONE_H

#include "Unit.h"
class AlienDrone: public Unit
{

};
#endif
9 changes: 9 additions & 0 deletions UnitClasses/AlienMonster.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#ifndef ALIENMONSTER_H
#define ALIENMONSTER_H

#include "Unit.h"
class AlienMonster: public Unit
{

};
#endif
9 changes: 9 additions & 0 deletions UnitClasses/AlienSolider.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#ifndef ALIENSOLIDER_H
#define ALIENSOLIDER_H

#include "Unit.h"
class AlienSolider: public Unit
{

};
#endif
10 changes: 10 additions & 0 deletions UnitClasses/EarthGunnery.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#ifndef EARTHGUNNERY_H
#define EARTHGUNNERY_H

#include "Unit.h"
class EearthGunnery: public Unit
{

};
#endif

10 changes: 10 additions & 0 deletions UnitClasses/EarthSolider.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#ifndef EARTHSOLIDER_H
#define EARTHSOLIDER_H

#include "Unit.h"
class EearthSolider: public Unit
{

};
#endif

10 changes: 10 additions & 0 deletions UnitClasses/EarthTank.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#ifndef EARTHTANK_H
#define EARTHTANK_H

#include "Unit.h"
class EearthTank: public Unit
{

};
#endif

36 changes: 36 additions & 0 deletions UnitClasses/Unit.h
Original file line number Diff line number Diff line change
@@ -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;
}

0 comments on commit 3e79619

Please sign in to comment.