-
Notifications
You must be signed in to change notification settings - Fork 0
/
ActiveUnits.hpp
103 lines (84 loc) · 2.76 KB
/
ActiveUnits.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
#ifndef ACTIVEUNITS_HPP_INCLUDED
#define ACTIVEUNITS_HPP_INCLUDED
#endif // ACTIVEUNITS_HPP_INCLUDED
#include <iostream>
#include <functional>
#include <utility>
#include <string>
#include <vector>
#include <SFML/Graphics.hpp>
#include "Physics.hpp"
#include <memory>
#include "Units.hpp"
#pragma once
class ActiveEntity:public Entity{// obiekty wykonujace samodzielny ruch
public:
~ActiveEntity(){};
ActiveEntity(ObjectTypes &&, sf::Vector2f &&,sf::Texture&);
public:
bool DoItWannaFire(){return WannaFire;} //ACTIV
std::unique_ptr<Entity> ReturnBullet(TextureHolder&); //ACTIV
bool ConnectionToMove(){return isConnectedToMove;} //ACTIV
protected:
sf::Texture tekstura;
protected:
bool isConnectedToMove=0;// ACTIV
bool WannaFire=0;
};
class Player:public ActiveEntity,public Human{
public:
Player(ObjectTypes &&, sf::Vector2f &&,sf::Texture& );
void update() override;
void MoveEntity(sf::Vector2f& ,sf::Time&,sf::Vector2f&w) override;
void react(Collision& ) override;
void AutomaticMove(sf::Time&) override;
void MoveEntity(sf::Vector2f& );
private:
sf::Vector2f velocity {200,30};
};
class Enemy:public ActiveEntity,public CellularAutomata{
public:
void update() override;
void MoveEntity(sf::Vector2f& ,sf::Time& ,sf::Vector2f&w) override;
void react(Collision& ) override;
void AutomaticMove(sf::Time&) override;
Enemy(ObjectTypes &&, sf::Vector2f &&,sf::Texture& );
private:
sf::Vector2f velocity {100,20};
};
class BasicWalkingEnemy:public ActiveEntity,public CellularAutomata{
public:
void update() override;
void MoveEntity(sf::Vector2f& ,sf::Time& ,sf::Vector2f&w){};
void react(Collision& ) override;
void AutomaticMove(sf::Time&) override;
void SetDependent(std::shared_ptr<Entity> &d);
BasicWalkingEnemy(ObjectTypes &&, sf::Vector2f &&,sf::Texture& );
private:
sf::Vector2f velocity {100,0};
//sf::Vector2f bufor{0,0};
};
class Bomb:public ActiveEntity{
public:
void update() override;
void MoveEntity(sf::Vector2f& ,sf::Time& ,sf::Vector2f&w) {};
void react(Collision& );
void AutomaticMove(sf::Time&) override;
//~Bomb();
Bomb(ObjectTypes &&, sf::Vector2f &&,sf::Texture& );
private:
sf::Vector2f velocity {0,300};
};
class BasicFlyingEnemy:public ActiveEntity, public CellularAutomata
{
public:
void update() override;
void MoveEntity(sf::Vector2f& ,sf::Time& ,sf::Vector2f&w){};
void react(Collision& ) override;
void AutomaticMove(sf::Time&) override;
//void SetDependent(std::shared_ptr<Entity> &d);
BasicFlyingEnemy(ObjectTypes &&, sf::Vector2f &&,sf::Texture& );
private:
sf::Vector2f velocity {100,100};
int licznik=0;
};