Recast  1
Game with custom magic
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
EnergyNode Class Reference

#include <EnergyNode.hpp>

Inheritance diagram for EnergyNode:
Inheritance graph
Collaboration diagram for EnergyNode:
Collaboration graph

Public Member Functions

 EnergyNode (float x, float y, float z, float energy)
 
 EnergyNode (NodeType type, float x, float y, float z, float energy)
 
virtual bool isEnergyNode ()
 
float getEnergy () const
 
virtual float transferEnergy (SpellNode *from, float count)
 
- Public Member Functions inherited from SpellNode
 SpellNode (NodeType type, float x, float y, float z)
 
 ~SpellNode ()
 
void connectNode (SpellNode *otherNode)
 
void tick (IEventListener &listener, SpellNode *callable)
 
bool inTick () const
 
float getDistance (const SpellNode *otherNode) const
 
NodeType getType () const
 
void iterrator (std::function< void(SpellNode *)> next)
 
std::set< SpellNode * > & getConnectedNodes ()
 
float getX () const
 
float getY () const
 
float getZ () const
 

Protected Member Functions

virtual void onTick (IEventListener &listener, SpellNode *callable)
 

Protected Attributes

float energy = 0
 
- Protected Attributes inherited from SpellNode
float x
 
float y
 
float z
 
std::set< SpellNode * > connectedNodes
 
bool nowInTick
 
NodeType type
 

Additional Inherited Members

- Static Public Member Functions inherited from SpellNode
static void write (Parcel &in, SpellNode *obj)
 
static SpellNoderead (Parcel &out)
 

Constructor & Destructor Documentation

EnergyNode::EnergyNode ( float  x,
float  y,
float  z,
float  energy 
)
inline
EnergyNode::EnergyNode ( NodeType  type,
float  x,
float  y,
float  z,
float  energy 
)
inline

Member Function Documentation

float EnergyNode::getEnergy ( ) const
inline

Here is the caller graph for this function:

virtual bool EnergyNode::isEnergyNode ( )
inlinevirtual

Reimplemented from SpellNode.

void EnergyNode::onTick ( IEventListener listener,
SpellNode callable 
)
protectedvirtual

Каждый тик мы рапределяем почти равномерно энергию между всеми дочерними нодами. Энергия переливается только в том случае, если её где-то меньше чем в текущей ноде. По умолчанию размер пакета = (Энергия текущего пакета - Энергия дочернего пакета) * 0.1 (10% от транзакции) Каждая передача энергии сопровождается потерей. В контексте проекта это называется налог на энергию (energy tax). Это приводит к тому, что энергия не вечна и рано или поздно пропадет из плетения.

Parameters
listenerВся передача событий из заклинания наружу происходит с помощью Event'ов
callableВызывающая нода. Пока не пригождается, но мало ли. Может быть NULL

Reimplemented from SpellNode.

Here is the call graph for this function:

float EnergyNode::transferEnergy ( SpellNode from,
float  count 
)
virtual

Here is the call graph for this function:

Here is the caller graph for this function:

Member Data Documentation

float EnergyNode::energy = 0
protected

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