Skip to content

Commit

Permalink
updated documentation and readme
Browse files Browse the repository at this point in the history
  • Loading branch information
Doraku committed Jun 23, 2019
1 parent b65f7fe commit 7ba16de
Show file tree
Hide file tree
Showing 37 changed files with 210 additions and 103 deletions.
21 changes: 21 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,27 @@ EntitySet set = world.GetEntities().WithAny<Example, int>().Build();
Span<Example> components = world.GetAllComponents<Example>();
```

There is also some special rules which will make the EntitySet react to some events
```C#
// this set when enumerated will give all the entities on which an Example component has been added for the first time
EntitySet set = world.GetEntities().WhenAdded<Example>().Build();

// this set when enumerated will give all the entities on which the Example component has been explicitly changed with Entity.Set<Example> method
EntitySet set = world.GetEntities().WhenChanged<Example>().Build();

// this set when enumerated will give all the entities on which the Example component has been removed
EntitySet set = world.GetEntities().WhenRemoved<Example>().Build();

// this set when enumerated will give all the entities on which the Example component has been added or changed
EntitySet set = world.GetEntities().WhenAdded<Example>().WhenChanged<Example>().Build();

// this set when enumerated will give all the entities with an int component on which the Example component has been changed, the order is important
EntitySet set = world.GetEntities().With<int>().WhenChanged<Example>().Build();
```

Note that if such a rule is used, the method `Complete` of the EntitySet needs to be called once every Entity has been processed to clear the EntitySet of its content.
Calling this method on an EntitySet created with only static filtering will do nothing.

Although there is no obligation, a set of base classes are provided to help the creation of systems:
<a name='Overview_System_ISystem'></a>
### ISystem<T>
Expand Down
3 changes: 2 additions & 1 deletion documentation/api/DefaultEcs-Entity-Disable-T-().md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
#### [DefaultEcs](./DefaultEcs.md 'DefaultEcs')
### [DefaultEcs](./DefaultEcs.md#DefaultEcs 'DefaultEcs').[Entity](./DefaultEcs-Entity.md 'DefaultEcs.Entity')
## Disable&lt;T&gt;() `method`
Disables the current [Entity](./DefaultEcs-Entity.md 'DefaultEcs.Entity') component of type [T](#DefaultEcs-Entity-Disable-T-()-T 'DefaultEcs.Entity.Disable&lt;T&gt;().T') so it does not appear in [EntitySet](./DefaultEcs-EntitySet.md 'DefaultEcs.EntitySet').
Disables the current [Entity](./DefaultEcs-Entity.md 'DefaultEcs.Entity') component of type [T](#DefaultEcs-Entity-Disable-T-()-T 'DefaultEcs.Entity.Disable&lt;T&gt;().T') so it does not appear in [EntitySet](./DefaultEcs-EntitySet.md 'DefaultEcs.EntitySet').
Does nothing if current [Entity](./DefaultEcs-Entity.md 'DefaultEcs.Entity') does not have a component of type [T](#DefaultEcs-Entity-Disable-T-()-T 'DefaultEcs.Entity.Disable&lt;T&gt;().T').
### Type parameters

<a name='DefaultEcs-Entity-Disable-T-()-T'></a>
Expand Down
6 changes: 6 additions & 0 deletions documentation/api/DefaultEcs-EntitySet-Complete().md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#### [DefaultEcs](./DefaultEcs.md 'DefaultEcs')
### [DefaultEcs](./DefaultEcs.md#DefaultEcs 'DefaultEcs').[EntitySet](./DefaultEcs-EntitySet.md 'DefaultEcs.EntitySet')
## Complete() `method`
Clears current instance of its entities if it was created with some reactive filter ([WhenAdded&lt;T&gt;()](./DefaultEcs-EntitySetBuilder-WhenAdded-T-().md 'DefaultEcs.EntitySetBuilder.WhenAdded&lt;T&gt;()'), [WhenChanged&lt;T&gt;()](./DefaultEcs-EntitySetBuilder-WhenChanged-T-().md 'DefaultEcs.EntitySetBuilder.WhenChanged&lt;T&gt;()') or [WhenRemoved&lt;T&gt;()](./DefaultEcs-EntitySetBuilder-WhenRemoved-T-().md 'DefaultEcs.EntitySetBuilder.WhenRemoved&lt;T&gt;()')).
Does nothing if it was created from a static filter.
This method need to be called after current instance content has been processed in a update cycle.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#### [DefaultEcs](./DefaultEcs.md 'DefaultEcs')
### [DefaultEcs](./DefaultEcs.md#DefaultEcs 'DefaultEcs').[EntitySetObserverEvents](./DefaultEcs-EntitySetObserverEvents.md 'DefaultEcs.EntitySetObserverEvents')
## OnEntityAdded `event`
### [DefaultEcs](./DefaultEcs.md#DefaultEcs 'DefaultEcs').[EntitySet](./DefaultEcs-EntitySet.md 'DefaultEcs.EntitySet')
## EntityAdded `event`
Event called when an [Entity](./DefaultEcs-Entity.md 'DefaultEcs.Entity') is added to the [EntitySet](./DefaultEcs-EntitySet.md 'DefaultEcs.EntitySet').
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#### [DefaultEcs](./DefaultEcs.md 'DefaultEcs')
### [DefaultEcs](./DefaultEcs.md#DefaultEcs 'DefaultEcs').[EntitySetObserverEvents](./DefaultEcs-EntitySetObserverEvents.md 'DefaultEcs.EntitySetObserverEvents')
## OnEntityRemoved `event`
### [DefaultEcs](./DefaultEcs.md#DefaultEcs 'DefaultEcs').[EntitySet](./DefaultEcs-EntitySet.md 'DefaultEcs.EntitySet')
## EntityRemoved `event`
Event called when an [Entity](./DefaultEcs-Entity.md 'DefaultEcs.Entity') is removed from the [EntitySet](./DefaultEcs-EntitySet.md 'DefaultEcs.EntitySet').
4 changes: 4 additions & 0 deletions documentation/api/DefaultEcs-EntitySet.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,12 @@
### [DefaultEcs](./DefaultEcs.md#DefaultEcs 'DefaultEcs')
## EntitySet `type`
Represents a sub-selection of [Entity](./DefaultEcs-Entity.md 'DefaultEcs.Entity') instances from a [World](./DefaultEcs-World.md 'DefaultEcs.World').
### Events
- [EntityAdded](./DefaultEcs-EntitySet-EntityAdded.md 'DefaultEcs.EntitySet.EntityAdded')
- [EntityRemoved](./DefaultEcs-EntitySet-EntityRemoved.md 'DefaultEcs.EntitySet.EntityRemoved')
### Properties
- [Count](./DefaultEcs-EntitySet-Count.md 'DefaultEcs.EntitySet.Count')
### Methods
- [Complete()](./DefaultEcs-EntitySet-Complete().md 'DefaultEcs.EntitySet.Complete()')
- [Dispose()](./DefaultEcs-EntitySet-Dispose().md 'DefaultEcs.EntitySet.Dispose()')
- [GetEntities()](./DefaultEcs-EntitySet-GetEntities().md 'DefaultEcs.EntitySet.GetEntities()')

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#### [DefaultEcs](./DefaultEcs.md 'DefaultEcs')
### [DefaultEcs](./DefaultEcs.md#DefaultEcs 'DefaultEcs').[EntitySetBuilder](./DefaultEcs-EntitySetBuilder.md 'DefaultEcs.EntitySetBuilder')
## WhenAdded(System.Type[]) `method`
Makes a rule to obsverve [Entity](./DefaultEcs-Entity.md 'DefaultEcs.Entity') when all component of the given types are added.
### Parameters

<a name='DefaultEcs-EntitySetBuilder-WhenAdded(System-Type--)-componentTypes'></a>
`componentTypes`

The types of component.
### Returns
The current [EntitySetBuilder](./DefaultEcs-EntitySetBuilder.md 'DefaultEcs.EntitySetBuilder').
12 changes: 12 additions & 0 deletions documentation/api/DefaultEcs-EntitySetBuilder-WhenAdded-T-().md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#### [DefaultEcs](./DefaultEcs.md 'DefaultEcs')
### [DefaultEcs](./DefaultEcs.md#DefaultEcs 'DefaultEcs').[EntitySetBuilder](./DefaultEcs-EntitySetBuilder.md 'DefaultEcs.EntitySetBuilder')
## WhenAdded&lt;T&gt;() `method`
Makes a rule to observe [Entity](./DefaultEcs-Entity.md 'DefaultEcs.Entity') when a component of type [T](#DefaultEcs-EntitySetBuilder-WhenAdded-T-()-T 'DefaultEcs.EntitySetBuilder.WhenAdded&lt;T&gt;().T') is added.
### Type parameters

<a name='DefaultEcs-EntitySetBuilder-WhenAdded-T-()-T'></a>
`T`

The type of component.
### Returns
The current [EntitySetBuilder](./DefaultEcs-EntitySetBuilder.md 'DefaultEcs.EntitySetBuilder').
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#### [DefaultEcs](./DefaultEcs.md 'DefaultEcs')
### [DefaultEcs](./DefaultEcs.md#DefaultEcs 'DefaultEcs').[EntitySetBuilder](./DefaultEcs-EntitySetBuilder.md 'DefaultEcs.EntitySetBuilder')
## WhenChanged(System.Type[]) `method`
Makes a rule to obsverve [Entity](./DefaultEcs-Entity.md 'DefaultEcs.Entity') when all component of the given types are changed.
### Parameters

<a name='DefaultEcs-EntitySetBuilder-WhenChanged(System-Type--)-componentTypes'></a>
`componentTypes`

The types of component.
### Returns
The current [EntitySetBuilder](./DefaultEcs-EntitySetBuilder.md 'DefaultEcs.EntitySetBuilder').
12 changes: 12 additions & 0 deletions documentation/api/DefaultEcs-EntitySetBuilder-WhenChanged-T-().md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#### [DefaultEcs](./DefaultEcs.md 'DefaultEcs')
### [DefaultEcs](./DefaultEcs.md#DefaultEcs 'DefaultEcs').[EntitySetBuilder](./DefaultEcs-EntitySetBuilder.md 'DefaultEcs.EntitySetBuilder')
## WhenChanged&lt;T&gt;() `method`
Makes a rule to observe [Entity](./DefaultEcs-Entity.md 'DefaultEcs.Entity') when a component of type [T](#DefaultEcs-EntitySetBuilder-WhenChanged-T-()-T 'DefaultEcs.EntitySetBuilder.WhenChanged&lt;T&gt;().T') is changed.
### Type parameters

<a name='DefaultEcs-EntitySetBuilder-WhenChanged-T-()-T'></a>
`T`

The type of component.
### Returns
The current [EntitySetBuilder](./DefaultEcs-EntitySetBuilder.md 'DefaultEcs.EntitySetBuilder').
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#### [DefaultEcs](./DefaultEcs.md 'DefaultEcs')
### [DefaultEcs](./DefaultEcs.md#DefaultEcs 'DefaultEcs').[EntitySetBuilder](./DefaultEcs-EntitySetBuilder.md 'DefaultEcs.EntitySetBuilder')
## WhenRemoved(System.Type[]) `method`
Makes a rule to obsverve [Entity](./DefaultEcs-Entity.md 'DefaultEcs.Entity') when all component of the given types are removed.
### Parameters

<a name='DefaultEcs-EntitySetBuilder-WhenRemoved(System-Type--)-componentTypes'></a>
`componentTypes`

The types of component.
### Returns
The current [EntitySetBuilder](./DefaultEcs-EntitySetBuilder.md 'DefaultEcs.EntitySetBuilder').
12 changes: 12 additions & 0 deletions documentation/api/DefaultEcs-EntitySetBuilder-WhenRemoved-T-().md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#### [DefaultEcs](./DefaultEcs.md 'DefaultEcs')
### [DefaultEcs](./DefaultEcs.md#DefaultEcs 'DefaultEcs').[EntitySetBuilder](./DefaultEcs-EntitySetBuilder.md 'DefaultEcs.EntitySetBuilder')
## WhenRemoved&lt;T&gt;() `method`
Makes a rule to observe [Entity](./DefaultEcs-Entity.md 'DefaultEcs.Entity') when a component of type [T](#DefaultEcs-EntitySetBuilder-WhenRemoved-T-()-T 'DefaultEcs.EntitySetBuilder.WhenRemoved&lt;T&gt;().T') is removed.
### Type parameters

<a name='DefaultEcs-EntitySetBuilder-WhenRemoved-T-()-T'></a>
`T`

The type of component.
### Returns
The current [EntitySetBuilder](./DefaultEcs-EntitySetBuilder.md 'DefaultEcs.EntitySetBuilder').
7 changes: 6 additions & 1 deletion documentation/api/DefaultEcs-EntitySetBuilder.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,12 @@
Represent an helper object to create an [EntitySet](./DefaultEcs-EntitySet.md 'DefaultEcs.EntitySet') to retrieve specific subset of [Entity](./DefaultEcs-Entity.md 'DefaultEcs.Entity').
### Methods
- [Build()](./DefaultEcs-EntitySetBuilder-Build().md 'DefaultEcs.EntitySetBuilder.Build()')
- [Build(DefaultEcs.IEntitySetObserver)](./DefaultEcs-EntitySetBuilder-Build(DefaultEcs-IEntitySetObserver).md 'DefaultEcs.EntitySetBuilder.Build(DefaultEcs.IEntitySetObserver)')
- [WhenAdded&lt;T&gt;()](./DefaultEcs-EntitySetBuilder-WhenAdded-T-().md 'DefaultEcs.EntitySetBuilder.WhenAdded&lt;T&gt;()')
- [WhenAdded(System.Type[])](./DefaultEcs-EntitySetBuilder-WhenAdded(System-Type--).md 'DefaultEcs.EntitySetBuilder.WhenAdded(System.Type[])')
- [WhenChanged&lt;T&gt;()](./DefaultEcs-EntitySetBuilder-WhenChanged-T-().md 'DefaultEcs.EntitySetBuilder.WhenChanged&lt;T&gt;()')
- [WhenChanged(System.Type[])](./DefaultEcs-EntitySetBuilder-WhenChanged(System-Type--).md 'DefaultEcs.EntitySetBuilder.WhenChanged(System.Type[])')
- [WhenRemoved&lt;T&gt;()](./DefaultEcs-EntitySetBuilder-WhenRemoved-T-().md 'DefaultEcs.EntitySetBuilder.WhenRemoved&lt;T&gt;()')
- [WhenRemoved(System.Type[])](./DefaultEcs-EntitySetBuilder-WhenRemoved(System-Type--).md 'DefaultEcs.EntitySetBuilder.WhenRemoved(System.Type[])')
- [With&lt;T&gt;()](./DefaultEcs-EntitySetBuilder-With-T-().md 'DefaultEcs.EntitySetBuilder.With&lt;T&gt;()')
- [With(System.Type[])](./DefaultEcs-EntitySetBuilder-With(System-Type--).md 'DefaultEcs.EntitySetBuilder.With(System.Type[])')
- [WithAny(System.Type[])](./DefaultEcs-EntitySetBuilder-WithAny(System-Type--).md 'DefaultEcs.EntitySetBuilder.WithAny(System.Type[])')
Expand Down
7 changes: 0 additions & 7 deletions documentation/api/DefaultEcs-EntitySetObserverEvents.md

This file was deleted.

This file was deleted.

This file was deleted.

7 changes: 0 additions & 7 deletions documentation/api/DefaultEcs-IEntitySetObserver.md

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#### [DefaultEcs](./DefaultEcs.md 'DefaultEcs')
### [DefaultEcs.System](./DefaultEcs.md#DefaultEcs-System 'DefaultEcs.System').[AEntitySystem&lt;T&gt;](./DefaultEcs-System-AEntitySystem-T-.md 'DefaultEcs.System.AEntitySystem&lt;T&gt;')
## EntityAdded `event`
Event called when an [Entity](./DefaultEcs-Entity.md 'DefaultEcs.Entity') is added to the inner [EntitySet](./DefaultEcs-EntitySet.md 'DefaultEcs.EntitySet').
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#### [DefaultEcs](./DefaultEcs.md 'DefaultEcs')
### [DefaultEcs.System](./DefaultEcs.md#DefaultEcs-System 'DefaultEcs.System').[AEntitySystem&lt;T&gt;](./DefaultEcs-System-AEntitySystem-T-.md 'DefaultEcs.System.AEntitySystem&lt;T&gt;')
## EntityRemoved `event`
Event called when an [Entity](./DefaultEcs-Entity.md 'DefaultEcs.Entity') is removed from the inner [EntitySet](./DefaultEcs-EntitySet.md 'DefaultEcs.EntitySet').
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#### [DefaultEcs](./DefaultEcs.md 'DefaultEcs')
### [DefaultEcs.System](./DefaultEcs.md#DefaultEcs-System 'DefaultEcs.System').[AEntitySystem&lt;T&gt;](./DefaultEcs-System-AEntitySystem-T-.md 'DefaultEcs.System.AEntitySystem&lt;T&gt;')
## PostUpdate(T) `method`
Performs a post-update treatment.
### Parameters

<a name='DefaultEcs-System-AEntitySystem-T--PostUpdate(T)-state'></a>
`state`

The state to use.
Loading

0 comments on commit 7ba16de

Please sign in to comment.