Exemplo n.º 1
0
        static void ConfigureCameraForSequence(Camera camera, SwfClipAsset.Sequence sequence)
        {
            var bounds = CalculateBoundsForSequence(sequence);

            camera.orthographic     = true;
            camera.orthographicSize = Mathf.Max(
                Mathf.Abs(bounds.extents.x),
                Mathf.Abs(bounds.extents.y));
            camera.transform.position = new Vector3(
                bounds.center.x,
                bounds.center.y,
                -10.0f);
        }
Exemplo n.º 2
0
        static Bounds CalculateBoundsForSequence(SwfClipAsset.Sequence sequence)
        {
            var bounds = sequence != null && sequence.Frames != null && sequence.Frames.Count > 0
                                ? sequence.Frames
                         .Where(p => !!p.CachedMesh)
                         .Select(p => p.CachedMesh.bounds)
                                : new Bounds[0];
            var result = bounds.Any() ? bounds.First() : new Bounds();

            foreach (var bound in bounds)
            {
                result.Encapsulate(bound);
            }
            return(result);
        }