From 273e68e527f3d936d6273433c731798bb26dddb2 Mon Sep 17 00:00:00 2001 From: Clement Date: Mon, 6 Dec 2021 14:58:34 +0100 Subject: [PATCH] update inheritance of entity, charac, wall --- include/entity/character.h | 30 +++++++++++++----------------- include/entity/entity.h | 16 +++++++++++----- include/entity/wall.h | 13 +++++++------ 3 files changed, 31 insertions(+), 28 deletions(-) diff --git a/include/entity/character.h b/include/entity/character.h index 8b2347f..2c90c53 100644 --- a/include/entity/character.h +++ b/include/entity/character.h @@ -1,40 +1,36 @@ #ifndef CHARACTER_H #define CHARACTER_H -#include "controllable.h" -#include "drawable_handler.h" -#include "physical_entity.h" -#include "schedulable.h" +#include "entity.h" #include -class Character : Controllable, DrawableHandler, PhysicalEntity, Schedulable +class Character : public Entity { private: - std::vector attackHitbox; + std::vector attackHitbox; //in a strategy ? Hitbox damageHitbox; - -public: - - Character(/* args */); - ~Character(); - - virtual void sendEvent( sf::Event e ); - - - float maxLife; + float maxLife; //to be update if a charac is considered as an agglo of body parts float currentLife; float strength; - float speed; + float maxSpeed; float jumpHeight; +public: + + Character(std::vector strategies); //or every player has the same strategies ? to be discussed... + ~Character(); + }; +//in .cpp: + Character::Character(/* args */) { + //initialize startegies of parent class ! } Character::~Character() diff --git a/include/entity/entity.h b/include/entity/entity.h index 37df772..99ae7f0 100644 --- a/include/entity/entity.h +++ b/include/entity/entity.h @@ -1,17 +1,23 @@ #ifndef ENTITY_H #define ENTITY_H -class Entity +#include "strategy.h" +#include + +class Entity //maybe virtual class ? let's see if this is usefull or not later { private: - + std::vector strategies; public: - Entity(); + Entity(std::vector strategies); ~Entity(); }; -Entity::Entity() -{ +//in .cpp : + + +Entity::Entity(std::vector strategies){ + //this->strategies = strategies; } Entity::~Entity() diff --git a/include/entity/wall.h b/include/entity/wall.h index 2dd897f..4652770 100644 --- a/include/entity/wall.h +++ b/include/entity/wall.h @@ -1,21 +1,22 @@ #ifndef WALL_H #define WALL_H -#include "drawable_handler.h" -#include "physical_entity.h" +#include "entity.h" - - -class Wall: DrawableHandler, PhysicalEntity +class Wall: Entity { private: + //properties as visible, physical (can we pass through, or only some charcac ?) will be store in strategies public: - Wall(/* args */); + Wall(std::vector strategies);// same question as character ~Wall(); }; +// in .cpp : + Wall::Wall(/* args */) { + } Wall::~Wall()