Example #1
0
        public override void ProcessBlock(float deltaTime, BlockAccessor block, ECSWorld world)
        {
            var cameras   = block.GetReadOnlyComponentData <CameraFollow>();
            var positions = block.GetComponentData <Position>();

            for (int i = 0; i < block.length; i++)
            {
                var followTarget = cameras[i].entityToFollow;
                try
                {
                    if (world.EntityExists(followTarget))
                    {
                        var pos = world.ComponentManager.GetComponent <Position>(followTarget);
                        positions[i].value = pos.value - vec3.UnitZ * cameras[i].zDistance;
                    }
                }
                catch (ComponentNotFoundException) { }
            }
        }