Esempio n. 1
0
 // Fades a sprite to a given alpha value over a period of time, and applies a sliding motion to the sprite transform
 public void FadeSprite(SpriteController spriteController, float targetAlpha, float duration, Vector2 slideOffset)
 {
     commandQueue.AddCommand(new FadeSpriteCommand(spriteController, targetAlpha, duration, slideOffset));
 }
Esempio n. 2
0
 // Sets sprite alpha to 1 immediately
 public void ShowSprite(SpriteController spriteController)
 {
     commandQueue.AddCommand(new FadeSpriteCommand(spriteController, 1f, 0f, Vector2.zero));
 }
Esempio n. 3
0
 // Plays the named animation on a object with a SpriteController component
 public void PlayAnimation(SpriteController spriteController, string animationName)
 {
     commandQueue.AddCommand(new PlayAnimationCommand(spriteController, animationName));
 }
        public PlayAnimationCommand(SpriteController _spriteController,
		                            string _animationName)
        {
            if (_spriteController == null)
            {
                Debug.LogError("Sprite controller must not be null.");
                return;
            }

            spriteController = _spriteController;
            animationName = _animationName;
        }
        public FadeSpriteCommand(SpriteController _spriteController,
		                         float _targetAlpha,
		                         float _fadeDuration,
		                         Vector2 _slideOffset)
        {
            if (_spriteController == null)
            {
                Debug.LogError("Sprite controller must not be null.");
                return;
            }

            spriteController = _spriteController;
            targetAlpha = _targetAlpha;
            fadeDuration = _fadeDuration;
            slideOffset = _slideOffset;
        }
 void Start()
 {
     spriteController = GetComponent<SpriteController>();
 }