Pacman Torben Petré
Loading...
Searching...
No Matches
logic::FruitModel Class Referencefinal

#include <FruitModel.h>

Inheritance diagram for logic::FruitModel:
Collaboration diagram for logic::FruitModel:

Public Member Functions

 FruitModel (float normalizedX, float normalizedY)
 Constructs a Fruit model. Fruit can be eaten by Pacman which initiates the Ghosts frightened mode.
Events collect () override
 To be called when Pacman interacts with this Fruit. Will notify its observers.
Public Member Functions inherited from logic::CollectibleEntityModel
 CollectibleEntityModel (float normalizedX, float normalizedY)
 Subclass of EntityModel to be used by collectible entities.
Public Member Functions inherited from logic::EntityModel
 EntityModel (float normalizedX, float normalizedY)
 Base class for entities.
 ~EntityModel () override=default
float getX () const
float getY () const
Public Member Functions inherited from logic::Subject
virtual ~Subject ()=default
void attach (const std::shared_ptr< Observer > &observer)
 Attaches an observer to this Subject.
void notify (Events event)
 Call the Observer update function with the provided event.

Additional Inherited Members

Protected Attributes inherited from logic::EntityModel
float x
float y
Protected Attributes inherited from logic::Subject
std::list< std::weak_ptr< Observer > > observers

Constructor & Destructor Documentation

◆ FruitModel()

FruitModel::FruitModel ( float normalizedX,
float normalizedY )
explicit

Constructs a Fruit model. Fruit can be eaten by Pacman which initiates the Ghosts frightened mode.

Parameters
normalizedXNormalized X spawn coordinate
normalizedYNormalized Y spawn coordinate

Member Function Documentation

◆ collect()

Events FruitModel::collect ( )
nodiscardoverridevirtual

To be called when Pacman interacts with this Fruit. Will notify its observers.

Returns
Event that the World should notify its Observers about.

Implements logic::CollectibleEntityModel.


The documentation for this class was generated from the following files: