Exemple #1
0
 public AnimationRunner(Animation subject)
 {
     this._subject = subject;
     _currentCue = subject.First;
     _remainingTimeAtThisCue = _currentCue.Duration;
     _isEnd = false;
 }
Exemple #2
0
        public AnimationSequence(Animation animation, AnimationPurposeEnum purpose, HorizontalDirectionEnum facing)
        {
            _animation = animation;
            _purpose = purpose;
            _facing = facing;

            _destPoint = new PointF(0f, 0f);

            _triggerAnimationSeqs = new ArrayList();
            _waitToTrigger = false;
            _isStarted = false;
            _isEnd = false;

            _triggerWhenBegin = false;
            _triggerWhenEnd = false;
        }
Exemple #3
0
        public ArmyAnimations(Animation standingRight, Animation standingLeft, 
            Animation standingRightActive, Animation standingLeftActive,
            Animation standingRightHover, Animation standingLeftHover, 
            Animation startMovingRight, Animation startMovingLeft,
            Animation stopMovingRight, Animation stopMovingLeft,
            Animation movingRight, Animation movingLeft,
            Animation attackStraightRightBegin, Animation attackStraightRightEnd,
            Animation attackStraightLeftBegin, Animation attackStraightLeftEnd,
            Animation shootStraightRightBegin, Animation shootStraightRightEnd,
            Animation shootStraightLeftBegin, Animation shootStraightLeftEnd,
            Animation defendRight, Animation defendLeft,
            Animation gettingHitRight, Animation gettingHitLeft,
            Animation deathRight, Animation deathLeft)
        {
            this._standingRight = standingRight;
            this._standingRightActive = standingRightActive;
            this._standingRightHover = standingRightHover;
            this._standingLeft = standingLeft;
            this._standingLeftActive = standingLeftActive;
            this._standingLeftHover = standingLeftHover;
            this._startMovingRight = startMovingRight;
            this._startMovingLeft = startMovingLeft;
            this._stopMovingRight = stopMovingRight;
            this._stopMovingLeft = stopMovingLeft;
            this._movingRight = movingRight;
            this._movingLeft = movingLeft;

            this._attackStraightRightBegin = attackStraightRightBegin;
            this._attackStraightRightEnd = attackStraightRightEnd;
            this._attackStraightLeftBegin = attackStraightLeftBegin;
            this._attackStraightLeftEnd = attackStraightLeftEnd;

            this._shootStraightRightBegin = shootStraightRightBegin;
            this._shootStraightRightEnd = shootStraightRightEnd;
            this._shootStraightLeftBegin = shootStraightLeftBegin;
            this._shootStraightLeftEnd = shootStraightLeftEnd;

            this._defendRight = defendRight;
            this._defendLeft = defendLeft;

            this._gettingHitRight = gettingHitRight;
            this._gettingHitLeft = gettingHitLeft;

            this._deathRight = deathRight;
            this._deathLeft = deathLeft;
        }
Exemple #4
0
        public static Animation CreateAnimation(Controller controller, string path, string prefix, string suffix,
            string[] nos, Point pt, Size sz,
            AnimationCueDirectionEnum lastCueDirection, int duration)
        {
            AnimationCue[] cues = new AnimationCue[nos.Length];
            for (int i = 0; i < nos.Length; i++)
            {
                AnimationCueDirectionEnum cueDirection = AnimationCueDirectionEnum.MoveToNext;
                if (i == nos.Length - 1) cueDirection = lastCueDirection;

                cues[i] = new AnimationCue(controller.TextureStore.GetTexture(controller.Device, string.Format(@"{0}\{1}{2}{3}.png", path, prefix, nos[i], suffix)),
                    cueDirection, BasicEngine.TurnTimeSpan.Ticks * duration, pt, sz);
            }

            Animation animation = new Animation(cues);
            return animation;
        }
Exemple #5
0
        public void SetAnimation(AnimationPurposeEnum purpose, HorizontalDirectionEnum facing)
        {
            if (purpose == AnimationPurposeEnum.StandingStill)
            {
                if (facing == HorizontalDirectionEnum.Right)
                {
                    Animation animation = null;
                    if (this._isBeginTurn)
                        animation = this._animations._standingRightActive;
                    else
                        animation = this._animations._standingRight;

                    if (this._currentAnimation != animation)
                    {
                        this._currentAnimation = animation;
                        this._currentAnimationRunner = this._currentAnimation.CreateRunner();
                    }
                }
                else if (facing == HorizontalDirectionEnum.Left)
                {
                    Animation animation = null;
                    if (this._isBeginTurn)
                        animation = this._animations._standingLeftActive;
                    else
                        animation = this._animations._standingLeft;

                    if (this._currentAnimation != animation)
                    {
                        this._currentAnimation = animation;
                        this._currentAnimationRunner = this._currentAnimation.CreateRunner();
                    }
                }
            }
            else if (purpose == AnimationPurposeEnum.Moving)
            {
                if (facing == HorizontalDirectionEnum.Right)
                {
                    if (this._currentAnimation != this._animations._movingRight)
                    {
                        this._currentAnimation = this._animations._movingRight;
                        this._currentAnimationRunner = this._currentAnimation.CreateRunner();
                    }
                }
                else if (facing == HorizontalDirectionEnum.Left)
                {
                    if (this._currentAnimation != this._animations._movingLeft)
                    {
                        this._currentAnimation = this._animations._movingLeft;
                        this._currentAnimationRunner = this._currentAnimation.CreateRunner();
                    }
                }
            }
            else if (purpose == AnimationPurposeEnum.Hover)
            {
                if (facing == HorizontalDirectionEnum.Right)
                {
                    if (this._currentAnimation != this._animations._standingRightHover)
                    {
                        this._currentAnimation = this._animations._standingRightHover;
                        this._currentAnimationRunner = this._currentAnimation.CreateRunner();
                    }
                }
                else if (facing == HorizontalDirectionEnum.Left)
                {
                    if (this._currentAnimation != this._animations._standingLeftHover)
                    {
                        this._currentAnimation = this._animations._standingLeftHover;
                        this._currentAnimationRunner = this._currentAnimation.CreateRunner();
                    }
                }
            }
        }