Beispiel #1
0
        private void SetUpCameraEntity(int i)
        {
            var entity = browseEntities[i];
            var camera = Instantiate(template).GetComponent <Camera>();

            entityManager.SetComponentData(entity, new Position(template.transform.position));
            entityManager.SetComponentData(entity, new IntId(i));

            entityManager.SetSharedComponentData(entity, new CameraInstance {
                camera = camera
            });

            CameraUtils.SetUpCamera(ref camera, i, playerPool.ActivePlayerCount);
        }
Beispiel #2
0
        protected override void SetUp(GameObject gameObject, int size)
        {
            for (int i = 0; i < entities.Length; i++)
            {
                var template = GameObject.Instantiate(gameObject);
                var camera   = template.GetComponent <Camera>();
                var entity   = entities[i];

                entityManager.SetComponentData(entity, new IntId {
                    value = i
                });
                entityManager.SetSharedComponentData(entity, new CameraInstance {
                    camera = template.GetComponent <Camera>()
                });

                CameraUtils.SetUpCamera(ref camera, i, size);

                ECSUtils.RemoveComponentWrappers(template, typeof(CameraInstanceComponent));
            }
        }