Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
SinyavtsevIlya authored Dec 8, 2019
1 parent 08a37ce commit 70ade11
Showing 1 changed file with 0 additions and 45 deletions.
45 changes: 0 additions & 45 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,51 +111,6 @@ example 2:
- Doesn't requere any manual actions from user to trigger generation. Just write the code and see how the new API appears. (Optional)
- Customizable generation snippets.

## Reactive components

Here's how it works - you only create a template (or blueprint) of a component that looks like this:

```csharp
class Score
{
int value;
}
```

The generator parses this class, and creates a completely new component, with reactive properties instead of fields:

```csharp
public partial class ScoreComponent : ComponentEcs
{
int value;

public System.Action<int, int>OnValueChange;

public int Value
{
get { return value; }
set
{
if (this.value == value) return;

var cached = this.value;
this.value = value;
if (_InternalOnValueChange != null)
{
_InternalOnValueChange(0);
}

if (OnValueChange != null)
{
OnValueChange(cached, value);
}
}
}
}
```

When changing the ```value``` property, related entity is added to all ```.OnScoreChange``` collectors.

## Inspiration

The framework is inspired a lot by such projects as [Entitas][Entitas-link], [Actors][Actors-link], [LeoECS][LeoECS-link].
Expand Down

0 comments on commit 70ade11

Please sign in to comment.