Example #1
0
        /// <summary>
        /// This demo has just one camera, but it would be simple to create a camera for each player for a split
        /// screen scenario.
        /// <param name="playerID"></param>
        /// <param name="gameObject"></param>
        void BuildCameraEntity(EntityInitializer playerID, GameObject camera)
        {
            //implementors can be attatched at run time, while not? Check the player spawner engine to
            //read more about implementors
            var implementor = camera.AddComponent <CameraImplementor>();

            implementor.offset = camera.transform.position - playerID.Get <CameraTargetEntityViewComponent>().targetComponent.position;

            _entityFactory.BuildEntity <CameraEntityDescriptor>((uint)playerID.EGID.entityID, ECSGroups.Camera
                                                                , new[] { implementor });
        }