本文整理汇总了C#中Entitas.Pool类的典型用法代码示例。如果您正苦于以下问题:C# Pool类的具体用法?C# Pool怎么用?C# Pool使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Pool类属于Entitas命名空间,在下文中一共展示了Pool类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: animatingComponent
static void animatingComponent(Pool pool)
{
var e = pool.animatingEntity;
var isAnimating = pool.isAnimating;
pool.isAnimating = true;
pool.isAnimating = false;
}
开发者ID:npruehs,项目名称:Entitas-CSharp,代码行数:7,代码来源:ReadmeSnippets.cs
示例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>();
}
开发者ID:robinryf,项目名称:Entitas-CSharp,代码行数:25,代码来源:ReactiveSystem.cs
示例3: SetPool
public void SetPool(Pool pool)
{
_pool = pool;
_asteroids = pool.GetGroup(Matcher.Asteroid);
_levels = pool.GetGroup(Matcher.Level);
_players = pool.GetGroup(Matcher.Player);
}
开发者ID:jyunfan2015,项目名称:Entitasteroids,代码行数:7,代码来源:LevelEndingSystem.cs
示例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>());
}
开发者ID:jyunfan2015,项目名称:Entitasteroids,代码行数:30,代码来源:GameController.cs
示例5: Init
public void Init(Pool pool, Entity entity)
{
_pool = pool;
_entity = entity;
_entity.OnEntityReleased += onEntityReleased;
Update();
}
开发者ID:robinryf,项目名称:Entitas-CSharp,代码行数:7,代码来源:EntityBehaviour.cs
示例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);
}
}
开发者ID:mihail-georgiev,项目名称:Entitas-CSharp,代码行数:8,代码来源:ReadmeSnippets.cs
示例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);
}
开发者ID:jyunfan2015,项目名称:Entitasteroids,代码行数:9,代码来源:SpaceshipRespawningSystem.cs
示例8: Init
public void Init(Pool pool, Entity entity)
{
_pool = pool;
_entity = entity;
_unfoldedComponents = new bool[_pool.totalComponents];
_entity.OnComponentRemoved += onComponentRemoved;
UnfoldAllComponents();
}
开发者ID:namlunoy,项目名称:Entitas-CSharp,代码行数:9,代码来源:EntityBehaviour.cs
示例9: groupExample
static void groupExample(Pool pool) {
pool.GetGroup(Matcher.Position).GetEntities();
// ----------------------------
pool.GetGroup(Matcher.Position).OnEntityAdded += (group, entity) => {
// Do something
};
}
开发者ID:mihail-georgiev,项目名称:Entitas-CSharp,代码行数:9,代码来源:ReadmeSnippets.cs
示例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>();
}
开发者ID:Geroppo,项目名称:Entitas-CSharp,代码行数:10,代码来源:ReactiveSystem.cs
示例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();
}
开发者ID:thebatoust,项目名称:EntitasTurnBasedGame,代码行数:11,代码来源:EntityBehaviour.cs
示例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();
}
开发者ID:fversnel,项目名称:Entitas-CSharp,代码行数:12,代码来源:EntityDebugBehaviour.cs
示例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();
}
开发者ID:npruehs,项目名称:Entitas-CSharp,代码行数:14,代码来源:ReadmeSnippets.cs
示例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>();
}
开发者ID:callumlawson,项目名称:FinalFlight,代码行数:14,代码来源:TableViewVisualizer.cs
示例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>();
}
开发者ID:KevinQiangK,项目名称:Entitas-CSharp,代码行数:18,代码来源:ReactiveSystem.cs
示例16: GetSystems
public static Systems GetSystems(Pool pool)
{
#if (UNITY_EDITOR)
return new DebugSystems()
#else
return new Systems()
#endif
// Initialize
.Add(pool.CreateSystem<RemoveViewSystem>())
.Add(pool.CreateSystem<AddViewSystem>())
.Add(pool.CreateSystem<CreatePilotsSystem>())
.Add(pool.CreateSystem<StartGameSystem>())
.Add(pool.CreateSystem<CreateEventsSystem>())
.Add(pool.CreateSystem<CreateAircraftSystem>())
.Add(pool.CreateSystem<PauseSystem>())
.Add(pool.CreateSystem<TimeSystem>())
.Add(pool.CreateSystem<UINavigationSystem>())
.Add(pool.CreateSystem<EventPredicateCheckingSystem>())
.Add(pool.CreateSystem<EventResolutionSystem>());
}
开发者ID:callumlawson,项目名称:FinalFlight,代码行数:20,代码来源:ActiveSystems.cs
示例17: DrawComponents
public static void DrawComponents(Pool pool, Entity entity)
{
bool[] unfoldedComponents;
if (!_poolToUnfoldedComponents.TryGetValue(pool, out unfoldedComponents)) {
unfoldedComponents = new bool[pool.totalComponents];
for (int i = 0; i < unfoldedComponents.Length; i++) {
unfoldedComponents[i] = true;
}
_poolToUnfoldedComponents.Add(pool, unfoldedComponents);
}
EntitasEditorLayout.BeginVerticalBox();
{
EntitasEditorLayout.BeginHorizontal();
{
EditorGUILayout.LabelField("Components (" + entity.GetComponents().Length + ")", EditorStyles.boldLabel);
if (GUILayout.Button("▸", GUILayout.Width(21), GUILayout.Height(14))) {
for (int i = 0; i < unfoldedComponents.Length; i++) {
unfoldedComponents[i] = false;
}
}
if (GUILayout.Button("▾", GUILayout.Width(21), GUILayout.Height(14))) {
for (int i = 0; i < unfoldedComponents.Length; i++) {
unfoldedComponents[i] = true;
}
}
}
EntitasEditorLayout.EndHorizontal();
EditorGUILayout.Space();
var componentNames = entity.poolMetaData.componentNames;
var index = EditorGUILayout.Popup("Add Component", -1, componentNames);
if (index >= 0) {
var componentType = entity.poolMetaData.componentTypes[index];
var component = (IComponent)Activator.CreateInstance(componentType);
entity.AddComponent(index, component);
}
EditorGUILayout.Space();
EntitasEditorLayout.BeginHorizontal();
{
_componentNameSearchTerm = EditorGUILayout.TextField("Search", _componentNameSearchTerm);
const string clearButtonControlName = "Clear Button";
GUI.SetNextControlName(clearButtonControlName);
if (GUILayout.Button("x", GUILayout.Width(19), GUILayout.Height(14))) {
_componentNameSearchTerm = string.Empty;
GUI.FocusControl(clearButtonControlName);
}
}
EntitasEditorLayout.EndHorizontal();
EditorGUILayout.Space();
var indices = entity.GetComponentIndices();
var components = entity.GetComponents();
for (int i = 0; i < components.Length; i++) {
DrawComponent(unfoldedComponents, entity, indices[i], components[i]);
}
}
EntitasEditorLayout.EndVertical();
}
开发者ID:JamesMcMahon,项目名称:entitas-2d-roguelike,代码行数:64,代码来源:EntityDrawer.cs
示例18: userComponent
static void userComponent(Pool pool, UserComponent component)
{
var e = pool.userEntity;
var name = pool.user.name;
var has = pool.hasUser;
pool.SetUser("John", 42);
pool.SetUser(component);
pool.ReplaceUser("Max", 24);
pool.RemoveUser();
}
开发者ID:npruehs,项目名称:Entitas-CSharp,代码行数:13,代码来源:ReadmeSnippets.cs
示例19: SetPool
public void SetPool(Pool pool)
{
systemPool = pool;
}
开发者ID:callumlawson,项目名称:FinalFlight,代码行数:4,代码来源:CreateEventsSystem.cs
示例20: switchToPool
void switchToPool()
{
if (_pool != null) {
_pool.Reset();
}
var targetPool = _allPools[_poolIndex];
_pool = new Pool(targetPool.totalComponents, 0, targetPool.metaData);
_entity = _pool.CreateEntity();
}
开发者ID:JamesMcMahon,项目名称:entitas-2d-roguelike,代码行数:9,代码来源:BinaryBlueprintInspector.cs
注:本文中的Entitas.Pool类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论