A new enemy that teleports when hit could force another branch into an enemy inheritance tree. A data-flow approach asks a simpler question: what data does teleporting read, what does it change, and which system needs the result? Gameplay becomes a sequence of transformations from input data to output data, rather than a chain of object relationships. section 1.3
In a survival game, each system needs a different slice of enemy data:
- Movement reads position, direction, and velocity to produce a new position. section 1.3
- Tracking reads enemy and player positions to produce a new direction. Teleporting reads position, damage, and teleport-on-hit state to produce a position. section 1.3
- Rendering reads the resulting position and a Unity GameObject, moves the GameObject, and lets Unity render it there. section 1.3
Listing 1.7 Class holding all the data for our enemies
public class EnemyData
{
public Vector2[] Position;
public Vector2[] Direction;
public float[] Velocity;
public bool[] TeleportOnHit;
}The EnemyData listing stores positions, directions, velocities, and teleport-on-hit flags in separate arrays. This makes each kind of runtime data available together, while systems can process only what they need. section 1.3
Composing an enemy from behavior objects avoids a rigid inheritance tree, but the behaviors still need overlapping, different data. Splitting them into ever-smaller objects adds references and relationships without grouping positions or velocities in memory. Separating data from logic instead makes a feature’s required data, transformation, and path through the game explicit. Use that clarity where it helps; data flow is an architectural guide, not a reason to multiply systems without a need. section 1.3 section 1.1



