summaryrefslogtreecommitdiff
path: root/inc/organism.hpp
blob: 954d25f5b8a891df75d914122af8347bc969a584 (plain)
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
#ifndef organism_h
#define organism_h

#include <vector>
#include <algorithm>

#include "dna.hpp"
#include "rectangle.hpp"
#include "functions.hpp"

class Organism
{
        public:
                Organism(Rectangle r, DNA d);

                void            Behavior();
                void            Action();
                void            Priority();
                void            setTarget();
                void            checkTarget();
                void            moveTowards(Rectangle r);
                void            passDNA(DNA d);
                void            giveNearMe(std::vector<Organism*> n){nearMe = n;};
                void            grow();
                void            takeBite(int bite);
                void            hadPregnancy(){pregnate = pregnancyReady = false;};

                DNA             getDNA()                {return myDNA;};
                DNA             getChildsDNA()          {return childsDNA;};
                DNA::Visuals    getVisuals()            {return myDNA.appearance;};    
                Rectangle       getRectangle()          {return rect;};
                int             getHealth()             {return health;};
                int             getBestSense()          {return myDNA.bestSense;};
                int             getType()               {return myDNA.type;};
                bool            getGender()             {return gender;};
                bool            getPregnancyReady()     {return pregnancyReady;};

        private:
                Rectangle               wTarget;
                Organism*               target;
                std::vector<Organism*>  nearMe;
                DNA                     myDNA;
                DNA                     childsDNA;
                Rectangle               rect;

                int                     health; 
                int                     pregnancyTime;
                int                     age;
                int                     hunger;
                
                bool                    starving;
                bool                    gender;
                bool                    pregnate;
                bool                    hungry; 
                bool                    pregnancyReady;
                bool                    able;     
                bool                    hasTarget;
                bool                    wander;
};

#endif