本文整理汇总了C#中Entitas.Pool类的典型用法代码示例。如果您正苦于以下问题:C# Pool类的具体用法?C# Pool怎么用?C# Pool使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Pool类属于Entitas命名空间,在下文中一共展示了Pool类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: animatingComponent
static void animatingComponent(Pool pool)
{
var e = pool.animatingEntity;
var isAnimating = pool.isAnimating;
pool.isAnimating = true;
pool.isAnimating = false;
}
示例2: ReactiveSystem
ReactiveSystem(Pool pool, IReactiveExecuteSystem subSystem, TriggerOnEvent[] triggers)
{
_subsystem = subSystem;
var ensureComponents = subSystem as IEnsureComponents;
if (ensureComponents != null) {
_ensureComponents = ensureComponents.ensureComponents;
}
var excludeComponents = subSystem as IExcludeComponents;
if (excludeComponents != null) {
_excludeComponents = excludeComponents.excludeComponents;
}
_clearAfterExecute = (subSystem as IClearReactiveSystem) != null;
var triggersLength = triggers.Length;
var groups = new Group[triggersLength];
var eventTypes = new GroupEventType[triggersLength];
for (int i = 0; i < triggersLength; i++) {
var trigger = triggers[i];
groups[i] = pool.GetGroup(trigger.trigger);
eventTypes[i] = trigger.eventType;
}
_observer = new GroupObserver(groups, eventTypes);
_buffer = new List<Entity>();
}
示例3: SetPool
public void SetPool(Pool pool)
{
_pool = pool;
_asteroids = pool.GetGroup(Matcher.Asteroid);
_levels = pool.GetGroup(Matcher.Level);
_players = pool.GetGroup(Matcher.Player);
}
示例4: CreateSystems
private Systems CreateSystems(Pool pool)
{
#if (UNITY_EDITOR)
return new DebugSystems()
#else
return new Systems()
#endif
.Add(pool.CreateSystem<TickingSystem>())
.Add(pool.CreateSystem<PositionUpdatingSystem>())
.Add(pool.CreateSystem<RenderForceSystem>())
.Add(pool.CreateSystem<BulletCollisionSystem>())
.Add(pool.CreateSystem<AddViewSystem>())
.Add(pool.CreateSystem<LevelStartingSystem>())
.Add(pool.CreateSystem<SpaceshipControlsSystem>())
.Add(pool.CreateSystem<AddRigidbodySystem>())
.Add(pool.CreateSystem<AgingSystem>())
.Add(pool.CreateSystem<MaxAgeSystem>())
.Add(pool.CreateSystem<AsteroidSplittingSystem>())
.Add(pool.CreateSystem<RenderRotationSystem>())
.Add(pool.CreateSystem<GunFiringSystem>())
.Add(pool.CreateSystem<GunCooldownSystem>())
.Add(pool.CreateSystem<LevelEndingSystem>())
.Add(pool.CreateSystem<SpaceshipRespawningSystem>())
.Add(pool.CreateSystem<SpaceshipCollisionSystem>())
.Add(pool.CreateSystem<InputDestructionSystem>())
.Add(pool.CreateSystem<BoundsWrappingSystem>())
.Add(pool.CreateSystem<RenderPositionSystem>())
.Add(pool.CreateSystem<RemoveViewSystem>())
.Add(pool.CreateSystem<DestroyingSystem>());
}
示例5: Init
public void Init(Pool pool, Entity entity)
{
_pool = pool;
_entity = entity;
_entity.OnEntityReleased += onEntityReleased;
Update();
}
示例6: moveSystem
static void moveSystem(Pool pool) {
var entities = pool.GetEntities(Matcher.AllOf(Matcher.Move, Matcher.Position));
foreach (var entity in entities) {
var move = entity.move;
var pos = entity.position;
entity.ReplacePosition(pos.x, pos.y + move.speed);
}
}
示例7: SetPool
public void SetPool(Pool pool)
{
_pool = pool;
_pool.GetGroup(Matcher.SpaceshipDeathroes).OnEntityRemoved += OnDeaththroesRemoved;
_waiting = _pool.GetGroup(Matcher.AllOf(Matcher.WaitingForSpace, Matcher.Spaceship));
_asteroids = pool.GetGroup(Matcher.AllOf(Matcher.Asteroid, Matcher.CollisionRadius));
_games = _pool.GetGroup(Matcher.AllOf(Matcher.Game, Matcher.Bounds));
_lives = _pool.GetGroup(Matcher.Lives);
}
示例8: Init
public void Init(Pool pool, Entity entity)
{
_pool = pool;
_entity = entity;
_unfoldedComponents = new bool[_pool.totalComponents];
_entity.OnComponentRemoved += onComponentRemoved;
UnfoldAllComponents();
}
示例9: groupExample
static void groupExample(Pool pool) {
pool.GetGroup(Matcher.Position).GetEntities();
// ----------------------------
pool.GetGroup(Matcher.Position).OnEntityAdded += (group, entity) => {
// Do something
};
}
示例10: ReactiveSystem
ReactiveSystem(Pool pool, IReactiveExecuteSystem subSystem, IMatcher[] triggers, GroupEventType[] eventTypes)
{
_subsystem = subSystem;
var groups = new Group[triggers.Length];
for (int i = 0, triggersLength = triggers.Length; i < triggersLength; i++) {
groups[i] = pool.GetGroup(triggers[i]);
}
_observer = new GroupObserver(groups, eventTypes);
_buffer = new List<Entity>();
}
示例11: Init
public void Init(Pool pool, Entity entity, Type[] componentTypes) {
_pool = pool;
_entity = entity;
_componentTypes = componentTypes;
componentToAdd = -1;
_unfoldedComponents = new bool[_pool.totalComponents];
_entity.OnEntityReleased += onEntityReleased;
Update();
UnfoldAllComponents();
}
示例12: Init
public void Init(Pool pool, Entity entity, int debugIndex)
{
_pool = pool;
_entity = entity;
_debugIndex = debugIndex;
_unfoldedComponents = new bool[_pool.totalComponents];
_entity.OnComponentAdded += onEntityChanged;
_entity.OnComponentRemoved += onEntityChanged;
updateName();
UnfoldAllComponents();
}
示例13: groupObserverExample
static void groupObserverExample(Pool pool)
{
var group = pool.GetGroup(Matcher.Position);
var observer = group.CreateObserver(GroupEventType.OnEntityAdded);
// ----------------------------
foreach (var e in observer.collectedEntities) {
// do something
}
observer.ClearCollectedEntities();
// ----------------------------
observer.Deactivate();
}
示例14: Start
public void Start()
{
pool = Pools.pool;
pool.GetGroup(EntitysToBeViewed).OnEntityAdded += (group, entity, index, component) => OnEntityAdded(entity);
pool.GetGroup(EntitysToBeViewed).OnEntityRemoved +=
(group, entity, index, component) => OnEntityRemoved(entity);
pool.GetGroup(Matcher.GameState).OnEntityAdded +=
(group, entity, index, component) => OnGameStateUpdated(entity.gameState.GameState);
tableContents = new Dictionary<int, GameObject>();
}
示例15: ReactiveSystem
ReactiveSystem(Pool pool, IReactiveExecuteSystem subSystem, IMatcher[] triggers, GroupEventType[] eventTypes)
{
_subsystem = subSystem;
var ensureComponents = subSystem as IEnsureComponents;
if (ensureComponents != null) {
_ensureComponents = ensureComponents.ensureComponents;
}
var excludeComponents = subSystem as IExcludeComponents;
if (excludeComponents != null) {
_excludeComponents = excludeComponents.excludeComponents;
}
var groups = new Group[triggers.Length];
for (int i = 0, triggersLength = triggers.Length; i < triggersLength; i++) {
groups[i] = pool.GetGroup(triggers[i]);
}
_observer = new GroupObserver(groups, eventTypes);
_buffer = new List<Entity>();
}