void Update()
        {
            if (!_active)
            {
                return;
            }
            _billboard.Apply(_renderer.transform, _backwards, ref _lastAngleHeight);
            bool inMargin;
            var  orientation = SpriteFacingControl.GetCameraSide(_facing, transform, transform.parent, 5, out inMargin);

            if (_orientation == orientation || (inMargin && (orientation.IsAdjacent(_orientation))))
            {
                return;
            }
            _orientation = orientation;
            var facing = orientation;

            if (_facing.RequiresFlipping())
            {
                facing          = _orientation.GetFlippedSide();
                _renderer.flipX = _orientation.IsFlipped();
            }
            var sprite = _sprite.GetFacingSprite(facing);

            if (sprite != null)
            {
                _renderer.sprite = sprite;
            }
        }
Ejemplo n.º 2
0
        private void UpdateSpriteFrame()
        {
            var facing = _orientation;

            if (_facing == SpriteFacing.EightwayFlipped)
            {
                facing          = _orientation.GetFlippedSide();
                _renderer.flipX = _orientation.IsFlipped();
            }
            var sprite = _sprite.GetSpriteFrame(facing, _spriteAnimator.FrameIndex);

            if (sprite != null)
            {
                _renderer.sprite = sprite;
            }
        }
Ejemplo n.º 3
0
        private void UpdateSpriteFrame()
        {
            var facing = _orientation;

            if (_facing.RequiresFlipping())
            {
                facing          = _orientation.GetFlippedSide();
                _renderer.flipX = _orientation.IsFlipped();
            }
            var sprite = _sprite.GetSpriteFrame(facing, _spriteAnimator.FrameIndex);

            if (sprite == null)
            {
                return;
            }
            _renderer.sprite = sprite;
            if (_spriteCollider != null)
            {
                _spriteCollider.UpdateCollider();
            }
        }