Example #1
0
            protected virtual void UpdateSprite()
            {
                if (_directionalAnimation == null)
                {
                    _renderer.SetSprite(
                        _animation.GetSprite(_animator.FrameIndex), _animation.NormalMap, _animation.EmissiveMap,
                        _animation.GetSpriteCollider(_animator.FrameIndex), _animNode.InstancedIndex, _animNode.ForceReverse);
                    return;
                }
                _lastOrientation = _billboard.Orientation;
                var facing = _billboard.Orientation;

                if (_billboard.Facing.RequiresFlipping())
                {
                    facing = _billboard.Orientation.GetFlippedSide();
                    _renderer.Flip(_billboard.Orientation.IsFlipped());
                }
                var animFacing = _directionalAnimation.GetFacing(facing);

                if (animFacing == null || _animator.FrameIndex >= animFacing.FrameIndices.Length)
                {
                    return;
                }
                var idx = animFacing.FrameIndices[_animator.FrameIndex];

                _renderer.SetSprite(_directionalAnimation.GetSprite(idx), _directionalAnimation.NormalMap, _directionalAnimation.EmissiveMap, _directionalAnimation.GetSpriteCollider(idx), _animNode.InstancedIndex, _animNode.ForceReverse);
            }
            protected override void UpdateSprite()
            {
                if (_animation == null)
                {
                    _animation = Animation as IDirectionalAnimation;
                    if (_animation == null)
                    {
                        return;
                    }
                }
                _lastOrientation = _billboard.Orientation;
                var facing = _billboard.Orientation;

                if (_billboard.Facing.RequiresFlipping())
                {
                    facing = _billboard.Orientation.GetFlippedSide();
                    Renderer.Flip(_billboard.Orientation.IsFlipped());
                }
                var animFacing = _animation.GetFacing(facing);

                if (animFacing == null || Animator.FrameIndex >= animFacing.FrameIndices.Length)
                {
                    return;
                }
                var idx = animFacing.FrameIndices[Animator.FrameIndex];

                Renderer.SetSprite(_animation.GetSprite(idx), _animation.NormalMap, _animation.EmissiveMap, _animation.GetSpriteCollider(idx));
            }