public override Entity Create(EntityManager entityManager, BundledResourceManager resourceManager,
                                      GameWorld world, ushort type)
        {
            var e = ClientCharacterUtilities.CreateCharacter(entityManager, float3.zero);

            entityManager.AddComponentData(e, new NewServerEntity()
            {
                Tick = 1
            });
            //    entityManager.AddComponentData(e, new UpdateUI());
            return(e);
        }
Example #2
0
        private Entity CreateCharacter(float3 position, bool isLocal, int id)
        {
            var e = ClientCharacterUtilities.CreateCharacter(EntityManager, position);

            EntityManager.SetComponentData(e, new ReplicatedEntityData
            {
                // 玩家信息
                Id = id,
                PredictingPlayerId = isLocal ? 0 : id
            });
            EntityManager.AddComponentData(e, new ServerEntity());

            if (!isLocal)
            {
                return(e);
            }

            //  EntityManager.AddComponentData(e, new UpdateUI());
            EntityManager.AddComponentData(e, new LocalCharacter());
            EntityManager.AddComponentData(e, new Connection());

            return(e);
        }