/*private struct AddFollowWayPointsActionJob : IJobForEachWithEntity_EBCC<Action,AddFollowWayPointsAction,CurrentAction> {
     *  public EntityCommandBuffer.ParallelWriter entityCommandBuffer; //Entity command buffer to allow adding/removing components inside the job
     *
     *  public void Execute(Entity entity, int index, DynamicBuffer<Action> actions, ref AddFollowWayPointsAction toAdd, ref CurrentAction current){
     *      int pos = 0; // where the action should be added
     *       // find the index where the action should be added
     *      while(pos < actions.Length && toAdd.priority <= actions[pos].priority){
     *          if(toAdd.priority == actions[pos].priority){ // if the priorities are the same
     *              //compare the times
     *              if(toAdd.timeCreated >= actions[pos].timeCreated){ // if the current action time is greater than the other action's time, this action should go later
     *                  pos++;
     *              }
     *              else
     *                  break;
     *          }
     *          else if(toAdd.priority < actions[pos].priority){ // if this action's priority is smaller than the other action's priority, this action should go later
     *              pos++;
     *          }
     *          else
     *              break;
     *      }
     *      if(pos == 0){ // if the action was added at the start of the buffer
     *          Debug.Log("Added to start!");
     *          if(current.type == ActionType.No_Action)
     *              entityCommandBuffer.AddComponent<ChangeAction>(index,entity, new ChangeAction{}); // tell the system that the current action should be changed
     *      }
     *      else{ //
     *          Debug.Log("Added after start");
     *      }
     *      // Add the action at the correct position
     *      actions.Insert(
     *              pos,
     *              new Action {
     *                  id = toAdd.id,
     *                  priority = toAdd.priority,
     *                  type = ActionType.Follow_WayPoints,
     *                  timeCreated = toAdd.timeCreated,
     *                  dataHolder = toAdd.dataHolder
     *              });
     *
     *      entityCommandBuffer.RemoveComponent<AddFollowWayPointsAction>(index,entity); // remove this component
     *  }
     *
     * }
     *
     * private struct AddGoHomeActionJob : IJobForEachWithEntity_EBCC<Action,AddGoHomeAction,CurrentAction> {
     *  public EntityCommandBuffer.ParallelWriter entityCommandBuffer; //Entity command buffer to allow adding/removing components inside the job
     *
     *  public void Execute(Entity entity, int index, DynamicBuffer<Action> actions, ref AddGoHomeAction toAdd, ref CurrentAction current){
     *      int pos = 0; // where the action should be added
     *       // find the index where the action should be added
     *      while(pos < actions.Length && toAdd.priority <= actions[pos].priority){
     *          if(toAdd.priority == actions[pos].priority){ // if the priorities are the same
     *              //compare the times
     *              if(toAdd.timeCreated >= actions[pos].timeCreated){ // if the current action time is greater than the other action's time, this action should go later
     *                  pos++;
     *              }
     *              else
     *                  break;
     *          }
     *          else if(toAdd.priority < actions[pos].priority){ // if this action's priority is smaller than the other action's priority, this action should go later
     *              pos++;
     *          }
     *          else
     *              break;
     *      }
     *      if(pos == 0){ // if the action was added at the start of the buffer
     *          Debug.Log("Added to start!");
     *          if(current.type == ActionType.No_Action)
     *              entityCommandBuffer.AddComponent<ChangeAction>(index,entity, new ChangeAction{}); // tell the system that the current action should be changed
     *      }
     *      else{ //
     *          Debug.Log("Added after start");
     *      }
     *      // Add the action at the correct position
     *      actions.Insert(
     *              pos,
     *              new Action {
     *                  id = toAdd.id,
     *                  priority = toAdd.priority,
     *                  type = ActionType.Go_Home,
     *                  timeCreated = toAdd.timeCreated,
     *                  dataHolder = toAdd.dataHolder
     *              });
     *
     *      entityCommandBuffer.RemoveComponent<AddGoHomeAction>(index,entity); // remove this component
     *  }
     *
     * }
     *
     * private struct AddGoToAndWaitActionJob : IJobForEachWithEntity_EBCC<Action,AddGoToAndWaitAction,CurrentAction> {
     *  public EntityCommandBuffer.ParallelWriter entityCommandBuffer; //Entity command buffer to allow adding/removing components inside the job
     *  public void Execute(Entity entity, int index, DynamicBuffer<Action> actions, ref AddGoToAndWaitAction toAdd, ref CurrentAction current){
     *      int pos = 0; // where the action should be added
     *       // find the index where the action should be added
     *      while(pos < actions.Length && toAdd.priority <= actions[pos].priority){
     *          if(toAdd.priority == actions[pos].priority){ // if the priorities are the same
     *              //compare the times
     *              if(toAdd.timeCreated >= actions[pos].timeCreated){ // if the current action time is greater than the other action's time, this action should go later
     *                  pos++;
     *              }
     *              else
     *                  break;
     *          }
     *          else if(toAdd.priority < actions[pos].priority){ // if this action's priority is smaller than the other action's priority, this action should go later
     *              pos++;
     *          }
     *          else
     *              break;
     *      }
     *      if(pos == 0){ // if the action was added at the start of the buffer
     *          Debug.Log("Added to start!");
     *          if(current.type == ActionType.No_Action)
     *              entityCommandBuffer.AddComponent<ChangeAction>(index,entity, new ChangeAction{}); // tell the system that the current action should be changed
     *      }
     *      else{ //
     *          Debug.Log("Added after start");
     *      }
     *      // Add the action at the correct position
     *      actions.Insert(
     *              pos,
     *              new Action {
     *                  id = toAdd.id,
     *                  priority = toAdd.priority,
     *                  type = ActionType.Go_And_Wait,
     *                  timeCreated = toAdd.timeCreated,
     *                  dataHolder = toAdd.dataHolder
     *              });
     *
     *      entityCommandBuffer.RemoveComponent<AddGoToAndWaitAction>(index,entity); // remove this component
     *  }
     *
     * }*/


    protected override void OnCreate()
    {
        commandBufferSystem = World.GetOrCreateSystem <EndSimulationEntityCommandBufferSystem>();
        addActionQueryDesc  = new EntityQueryDesc {
            All = new ComponentType[] {
                typeof(Action),
                ComponentType.ReadOnly <CurrentAction>()
            },
            Any = new ComponentType[] {
                ComponentType.ReadOnly <AddFollowWayPointsAction>(),
                ComponentType.ReadOnly <AddGoHomeAction>(),
                ComponentType.ReadOnly <AddGoToAndWaitAction>()
            }
        }; // define what we are looking for in the add action job
        base.OnCreate();
    }
    protected override void OnCreate()
    {
        var queryDesc = new EntityQueryDesc
        {
            All = new[]
            {
                typeof(UnitMovement),
                ComponentType.ReadOnly <Unit>(),
                ComponentType.ReadOnly <Path>()
            }
        };

        _entityQuery = GetEntityQuery(queryDesc);

        _worldQuery = GetEntityQuery(typeof(Grid), typeof(Tilemap));
    }
예제 #3
0
    private EntityQueryDesc CreateQueryFor <T>() where T : IComponentData
    {
        var queryDesc = new EntityQueryDesc
        {
            None = new ComponentType[] { typeof(LbReachCell) },
            All  = new ComponentType[]
            {
                ComponentType.ReadOnly <T>(),
                ComponentType.ReadOnly <LbMovementSpeed>(),
                typeof(Translation),
                ComponentType.ReadWrite <LbDistanceToTarget>()
            }
        };

        return(queryDesc);
    }
예제 #4
0
    protected override void OnCreate()
    {
        base.OnCreate();

        var description = new EntityQueryDesc()
        {
            All = new ComponentType[]
            {
                ComponentType.ReadOnly <Translation>(),
                ComponentType.ReadWrite <MoveData>(),
                ComponentType.ReadOnly <SensorData>(),
            }
        };

        query = this.GetEntityQuery(description);
    }
예제 #5
0
    protected override void OnCreate()
    {
        commandBufferSystem      = World.GetOrCreateSystem <EndSimulationEntityCommandBufferSystem>();
        addContMovementQueryDesc = new EntityQueryDesc { // define query for adding constant movement components
            All = new ComponentType[] {
                ComponentType.ReadOnly <Translation>(),
                ComponentType.ReadOnly <PoliceUnitComponent>(),
                ComponentType.ReadOnly <SelectedPoliceUnit>()
            }
        };



        base.OnCreate();
        this.Enabled = false;
    }
예제 #6
0
        protected override void OnCreate()
        {
            _stepPhysicsWorld  = World.GetOrCreateSystem <StepPhysicsWorld>();
            _buildPhysicsWorld = World.GetOrCreateSystem <BuildPhysicsWorld>();
            _endFixedECBSystem = World.GetOrCreateSystem <EndFixedStepSimulationEntityCommandBufferSystem>();

            var activeSelectionQueryDesc = new EntityQueryDesc
            {
                All  = new[] { ComponentType.ReadOnly <SelectionColliderTag>() },
                None = new[] { ComponentType.ReadOnly <DeleteEntityTag>() }
            };

            _activeSelectionQuery = GetEntityQuery(activeSelectionQueryDesc);

            RequireForUpdate(_activeSelectionQuery);
        }
예제 #7
0
    public static EntityQueryDesc CopyEntityQueryDesc(EntityQueryDesc src)
    {
        var dst = new EntityQueryDesc
        {
            All     = new ComponentType[src.All.Length],
            None    = new ComponentType[src.None.Length],
            Any     = new ComponentType[src.Any.Length],
            Options = src.Options
        };

        src.All.CopyTo(dst.All, 0);
        src.None.CopyTo(dst.None, 0);
        src.Any.CopyTo(dst.Any, 0);

        return(dst);
    }
        protected override void OnCreate()
        {
            var queryDesc = new EntityQueryDesc
            {
                //None = new[] {ComponentType.ReadOnly<Initialized>()},
                All = new[]
                {
                    ComponentType.ReadOnly <DetectorComponent>(),
                    ComponentType.ReadOnly <TriggerEffectVfxComponent>(),
                    ComponentType.ReadOnly <Transform>(),
                    ComponentType.ReadOnly <Translation>()
                }
            };

            _entityQuery = GetEntityQuery(queryDesc);
        }
        protected override void OnCreate()
        {
            base.OnCreate();

            var query = new EntityQueryDesc
            {
                All = new ComponentType[]
                {
                    typeof(SpriteRenderComponent), typeof(LocalToWorld)
                }
            };

            _spriteGroup = GetEntityQuery(query);

            _mesh = MeshUtils.CreateQuad();
        }
        protected override void OnCreate()
        {
            base.OnCreate();
            var agentQueryDesc = new EntityQueryDesc
            {
                All = new ComponentType[]
                {
                    typeof(NavAgent),
                    typeof(EnemyTag)
                }
            };

            _agentQuery = GetEntityQuery(agentQueryDesc);

            _endSimulationEntityCommandBufferSystem = World.DefaultGameObjectInjectionWorld.GetExistingSystem <EndSimulationEntityCommandBufferSystem>();
        }
예제 #11
0
        protected override void OnCreate()
        {
            base.OnCreate();
            var queryDesc = new EntityQueryDesc
            {
                All = new ComponentType[]
                {
                    typeof(Player),
                    typeof(Status)
                }
            };

            _statusQuery = EntityManager.CreateEntityQuery(queryDesc);

            _entityCommandBufferSystem = World.GetExistingSystem <EndSimulationEntityCommandBufferSystem>();
        }
예제 #12
0
        protected override void OnCreate()
        {
            base.OnCreate();
            _gss = EntityManager.World.GetOrCreateSystem <GameStateSystem>();
            _tms = EntityManager.World.GetOrCreateSystem <TurnManagementSystem>();
            _inv = EntityManager.World.GetOrCreateSystem <InventorySystem>();


            ResizeMaps(_gss.View.Width, _gss.View.Height);
            var query = new EntityQueryDesc
            {
                All = new ComponentType[] { ComponentType.ReadOnly <BlockMovement>(), ComponentType.ReadOnly <WorldCoord>() }
            };

            _mapFillQuery = GetEntityQuery(query);
        }
예제 #13
0
        Given_NewCommand_When_CurrentCommandLastInChain_Then_NewCommandShouldBeAddedAsActiveWithPreviousCommandSet_And_PreviousCommandShouldNotBeActiveAndHaveNextCommandSet()
        {
            var query = new EntityQueryDesc
            {
                All = new[]
                {
                    ComponentType.ReadOnly <Command>(),
                    ComponentType.ReadOnly <RegisteredCommandSystemState>(), ComponentType.ReadOnly <Active>()
                }
            };

            var newCommandQuery = _EntityManager.CreateEntityQuery(query);

            var entityCurrentCommand = _EntityManager.CreateEntity();

            _EntityManager.AddComponent <Command>(entityCurrentCommand);
            _EntityManager.AddComponent <Active>(entityCurrentCommand);
            _EntityManager.AddComponent <RegisteredCommandSystemState>(entityCurrentCommand);

            var entityNewCommand = _EntityManager.CreateEntity();

            _EntityManager.AddComponent <Command>(entityNewCommand);

            SystemUpdate();
            var entities = newCommandQuery.ToEntityArray(Allocator.Temp);

            Assert.AreEqual(1, entities.Length);
            Assert.IsTrue(_EntityManager.HasComponent <Active>(entityNewCommand));
            Assert.IsTrue(_EntityManager.HasComponent <PerformDo>(entityNewCommand));
            Assert.IsTrue(_EntityManager.HasComponent <RegisteredCommandSystemState>(entityNewCommand));
            Assert.IsTrue(_EntityManager.HasComponent <PreviousCommand>(entityNewCommand));

            var previousCommand = _EntityManager.GetComponentData <PreviousCommand>(entityNewCommand);

            Assert.AreEqual(entityCurrentCommand, previousCommand.Entity);

            Assert.IsFalse(_EntityManager.HasComponent <Active>(entityCurrentCommand));
            Assert.IsFalse(_EntityManager.HasComponent <PerformDo>(entityCurrentCommand));
            Assert.IsTrue(_EntityManager.HasComponent <RegisteredCommandSystemState>(entityCurrentCommand));
            Assert.IsTrue(_EntityManager.HasComponent <NextCommand>(entityCurrentCommand));
            var nextCommand = _EntityManager.GetComponentData <NextCommand>(entityCurrentCommand);

            Assert.AreEqual(entityNewCommand, nextCommand.Entity);

            entities.Dispose();
            Assert.IsTrue(true);
        }
    protected override void OnCreate()
    {
        entityManager = World.DefaultGameObjectInjectionWorld.EntityManager;

        var tmpQuery = new EntityQueryDesc
        {
            None = new ComponentType[] { typeof(ChangedFrameTag) },
            All  = new ComponentType[] { typeof(RenderMesh) }
        };

        query         = GetEntityQuery(tmpQuery);
        frameTagQuery = GetEntityQuery(typeof(ChangedFrameTag));

        counter          = 0;
        secondCounter    = 0;
        renderMeshFrames = new List <RenderMesh>();
    }
예제 #15
0
    protected override void OnCreate()
    {
        bufferSystem = World.GetOrCreateSystem <BeginPresentationEntityCommandBufferSystem> ();
        var inDesc = new EntityQueryDesc();

        inDesc.All = new ComponentType[] {
            ComponentType.ReadOnly(typeof(Mouseposition_C))
        };
        inEntitites = GetEntityQuery(inDesc);
        var outDect = new EntityQueryDesc();

        outDect.All = new ComponentType[] {
            ComponentType.ReadOnly(typeof(player_C)),
            ComponentType.ReadOnly(typeof(Translation))
        };
        outEntitites = GetEntityQuery(outDect);
    }
예제 #16
0
    protected override void OnCreate()
    {
        var queryDesc = new EntityQueryDesc
        {
            None = new ComponentType[] { ComponentType.ReadOnly <Tag_IsDead>(), ComponentType.ReadOnly <Tag_IsDying>() },
            All  = new ComponentType[] {
                ComponentType.ReadOnly <Tag_Bee>(),
                ComponentType.ReadOnly <C_Shared_Team>(),
                ComponentType.ReadOnly <Translation>(),
                typeof(C_Velocity),
                typeof(C_Random)
            }
        };

        m_yellowGroup = GetEntityQuery(queryDesc);
        m_purpleGroup = GetEntityQuery(queryDesc);
    }
예제 #17
0
        void ManualExamples1()
        {
            {
                #region define-query
                EntityQuery query
                    = GetEntityQuery(typeof(RotationQuaternion),
                                     ComponentType.ReadOnly <RotationSpeed>());
                #endregion
            }
            {
                #region query-desc
                var queryDescription = new EntityQueryDesc
                {
                    None = new ComponentType[] { typeof(Frozen) },
                    All  = new ComponentType[] { typeof(RotationQuaternion),
                                                 ComponentType.ReadOnly <RotationSpeed>() }
                };
                EntityQuery query = GetEntityQuery(queryDescription);
                #endregion
            }
            {
                #region combine-query
                var desc1 = new EntityQueryDesc
                {
                    All = new ComponentType[] { typeof(RotationQuaternion) }
                };

                var desc2 = new EntityQueryDesc
                {
                    All = new ComponentType[] { typeof(RotationSpeed) }
                };

                EntityQuery query
                    = GetEntityQuery(new EntityQueryDesc[] { desc1, desc2 });

                #endregion
            }
            {
                EntityManager entityManager = World.EntityManager;
                #region create-query
                EntityQuery query =
                    entityManager.CreateEntityQuery(typeof(RotationQuaternion),
                                                    ComponentType.ReadOnly <RotationSpeed>());
                #endregion
            }
        }
예제 #18
0
    protected override void OnCreate()
    {
        /*ECSにおいて、クエリの作成はOnCreateで行うのが定石となっています*/

        GlassDesc = new EntityQueryDesc()
        {
            All = new ComponentType[] { typeof(GlassTag), typeof(RigidBody), typeof(GlassComponent) },
        };

        GageDesc = new EntityQueryDesc()
        {
            All = new ComponentType[] { typeof(GageComponent) },
        };

        GlassQuery = GetEntityQuery(GlassDesc);
        GageQuery  = GetEntityQuery(GageDesc);
    }
예제 #19
0
        protected override void OnCreate()
        {
            base.OnCreate();

            var withoutTileLinkBuffer =
                new EntityQueryDesc {
                None = new ComponentType[] { typeof(TileLinkUpdate) }
            };

            _outerNodesQuery = GetEntityQuery(
                TilesBaseQuery,
                withoutTileLinkBuffer
                );
            _outerNodesQuery.SetSharedComponentFilter(
                GridGenerationComponent.OuterNodeLinkingPhase
                );
        }
    protected override void OnCreate()
    {
        var queryDesc = new EntityQueryDesc
        {
            All = new[] { ComponentType.ReadOnly <Initialized>(), ComponentType.ReadOnly <WaterMeshComponent>(), ComponentType.ReadOnly <MeshFilter>() }
        };

        _entityQuery = GetEntityQuery(queryDesc);

        _layout = new[]
        {
            new VertexAttributeDescriptor(VertexAttribute.Position, VertexAttributeFormat.Float32, 3),
            new VertexAttributeDescriptor(VertexAttribute.Normal, VertexAttributeFormat.Float16, 2),
            new VertexAttributeDescriptor(VertexAttribute.Tangent, VertexAttributeFormat.UNorm8, 4),
            new VertexAttributeDescriptor(VertexAttribute.Color, VertexAttributeFormat.UNorm8, 4),
        };
    }
예제 #21
0
    protected override void OnCreate()
    {
        EntityQueryDesc query = new EntityQueryDesc
        {
            Any = new ComponentType[] { typeof(PositioningTag) }
        };

        m_Group = GetEntityQuery(query);


        EntityQueryDesc querySpawner = new EntityQueryDesc
        {
            Any = new ComponentType[] { typeof(Spawner) }
        };

        m_GroupSpawner = GetEntityQuery(querySpawner);
    }
예제 #22
0
    protected override void OnCreate()
    {
        m_EntityCommandBufferSystem = World.GetOrCreateSystem <EndSimulationEntityCommandBufferSystem>();

        var query = new EntityQueryDesc
        {
            //None = new ComponentType[] {typeof(LbArrow)},
            All = new ComponentType[] { typeof(LbPlayer), typeof(LbArrowPosition), typeof(LbArrow) }
        };

        m_PlayerQuery = GetEntityQuery(query);

        m_BoardQuery = GetEntityQuery(typeof(LbBoard));

        _random = new Random();
        _random.InitState();
    }
    protected override void OnCreate()
    {
        commandBufferSystem = World.GetOrCreateSystem <EndSimulationEntityCommandBufferSystem>();

        beginCountQueryDesc = new EntityQueryDesc {
            All = new ComponentType[] {
                ComponentType.ReadOnly <CrowdCollidedWithPolice>(),
                ComponentType.ReadOnly <Crowd>()
            },
            None = new ComponentType[] {
                ComponentType.ReadOnly <CountUntilLeave>(),
                ComponentType.ReadOnly <GoHomeAction>()
            },
        };

        base.OnCreate();
    }
예제 #24
0
        protected override void OnCreate()
        {
            var queryDescription = new EntityQueryDesc()
            {
                None = new ComponentType[]
                {
                    typeof(Static)
                },
                All = new ComponentType[]
                {
                    ComponentType.ReadWrite <Rotation>(),
                    ComponentType.ReadOnly <RotationSpeed>()
                }
            };

            m_Query = GetEntityQuery(queryDescription);
        }
    protected override void OnCreate()
    {
        CommandBufferSystem = World.GetExistingSystem <EndSimulationEntityCommandBufferSystem>();
        ThePlayerGameStatus = GetSingletonEntity <LeoGameStatus>();

        EntityQueryDesc entityQueryDesc = new EntityQueryDesc
        {
            All  = new ComponentType[] { typeof(LeoGameStatus), typeof(ReceiveRpcCommandRequestComponent) },
            None = new ComponentType[] { typeof(SendRpcCommandRequestComponent) }
        };

        entityQueryReceive = GetEntityQuery(entityQueryDesc);

        RequireForUpdate(entityQueryReceive);                                  // 需要有才执行
        RequireSingletonForUpdate <ClientGameStatusReceiveSystemController>(); // 添加控制
        EntityManager.CreateEntity(typeof(ClientGameStatusReceiveSystemController));
    }
        public void Start()
        {
            #region ECS Funcionality: Set up our User Data

            //WebGLMemoryStats.LogMoreStats("NetworkUpdateHandler Start BEFORE");

            //set up data for our player components
            EntityManager entityManager = World.DefaultGameObjectInjectionWorld.EntityManager;

            var eqDesc = new EntityQueryDesc
            {
                All = new ComponentType[]
                {
                    typeof(OurPlayerTag),
                    typeof(NetworkEntityIdentificationComponentData)
                }
            };

            var entities = entityManager.CreateEntityQuery(eqDesc).ToEntityArray(Unity.Collections.Allocator.Temp);

            foreach (var entity in entities)
            {
                var entityIDFromType = entityManager.GetComponentData <NetworkEntityIdentificationComponentData>(entity).current_Entity_Type;

                entityManager.SetComponentData(
                    entity,
                    new NetworkEntityIdentificationComponentData {
                    clientID            = this.client_id,
                    sessionID           = this.session_id,
                    entityID            = (int)entityIDFromType,
                    current_Entity_Type = entityIDFromType
                }
                    );

                if (isTeacher != 0)
                {
                    entityManager.AddComponent <TeacherTag>(entity);
                }
            }

            entities.Dispose();

            //WebGLMemoryStats.LogMoreStats("NetworkUpdateHandler Start AFTER");
            #endregion
        }
예제 #27
0
        public void GetEntityQuery_ComponentTypeArchetypeQueryEquality()
        {
            var query1 = new ComponentType[] { typeof(EcsTestData) };
            var query2 = new EntityQueryDesc {
                All = new ComponentType[] { typeof(EcsTestData) }
            };
            var query3 = new EntityQueryDesc {
                All = new [] { ComponentType.ReadWrite <EcsTestData>() }
            };

            var group1 = EmptySystem.GetEntityQuery(query1);
            var group2 = EmptySystem.GetEntityQuery(query2);
            var group3 = EmptySystem.GetEntityQuery(query3);

            Assert.AreEqual(group1, group2);
            Assert.AreEqual(group2, group3);
            Assert.AreEqual(1, EmptySystem.EntityQueries.Length);
        }
예제 #28
0
    protected override void OnCreate()
    {
        m_entityCommandBufferSystem = World.GetOrCreateSystem <EntityCommandBufferSystem>();

        var queryDesc = new EntityQueryDesc
        {
            All = new ComponentType[] {
                ComponentType.ReadOnly <Tag_Bee>(),
                ComponentType.ReadOnly <C_Shared_Team>(),
                ComponentType.ReadOnly <C_Holding>(),
                ComponentType.ReadOnly <Translation>(),
                typeof(C_Velocity)
            }
        };

        m_yellowGroup = GetEntityQuery(queryDesc);
        m_purpleGroup = GetEntityQuery(queryDesc);
    }
예제 #29
0
    protected override void OnCreate()
    {
        CommandBufferSystem = World.GetExistingSystem <EndSimulationEntityCommandBufferSystem>();
        // 会生成一个字符串You Win 或者 You Lost;等待一段时间后把玩家状态恢复为未准备状态
        EntityQueryDesc entityQueryDesc = new EntityQueryDesc
        {
            All = new ComponentType[] { typeof(ServerGameOverSystemController),
                                        typeof(ReceiveRpcCommandRequestComponent) },
            None = new ComponentType[] { typeof(SendRpcCommandRequestComponent) }
        };

        entityQueryReceive = GetEntityQuery(entityQueryDesc);

        RequireForUpdate(entityQueryReceive);
        //gameOverObject = Resources.Load<GameObject>("HintPrepare");
        //gameOverObject.GetComponent<TextMesh>().text = "";
        //gameOverObject = GameObject.Instantiate(gameOverObject);
    }
예제 #30
0
 void queryFromDescription()
 {
     #region query-from-description
     EntityQueryDesc description = new EntityQueryDesc
     {
         None = new ComponentType[]
         {
             typeof(Frozen)
         },
         All = new ComponentType[]
         {
             typeof(Rotation),
             ComponentType.ReadOnly <RotationSpeed>()
         }
     };
     EntityQuery query = GetEntityQuery(description);
     #endregion
 }