Beispiel #1
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;
        }
Beispiel #2
0
        public StandardCharacter()
        {
            _moveSpeed = 5;
            _moveSpeedX = _moveSpeed;     // animation move speed
            _moveSpeedY = _moveSpeed;     // animation move speed\

            _currentFacingDirection = HorizontalDirectionEnum.Right;

            _command = new Idle();

            _animations = new Heroes.Core.Battle.Characters.Armies.ArmyAnimations();

            _isBeginTurn = false;
            _isEndTurn = false;

            _isDead = false;

            _currentAnimationSeq = null;
        }
Beispiel #3
0
        public void Initalize()
        {
            if (_armySide == ArmySideEnum.Attacker)
            {
                _currentFacingDirection = HorizontalDirectionEnum.Right;
                _currentAnimationPt = new Point(0, 0);
            }
            else
            {
                _currentFacingDirection = HorizontalDirectionEnum.Left;
                _currentAnimationPt = new Point(800 - _rect.Width, 0);
                _rect.X = (int)_currentAnimationPt.X;
            }

            Action action = CreateStandingAction(this, _currentFacingDirection);
            SetAnimation(action._currentAnimationSeq);
        }
Beispiel #4
0
        public Action CreateStandingAction(Hero character, HorizontalDirectionEnum facing)
        {
            Action action = new Action(ActionTypeEnum.Standing);

            Animation animation = null;
            if (facing == HorizontalDirectionEnum.Right)
            {
                if (this._sex == SexEnum.Male)
                    animation = this._animations._standingRightMale;
                else
                    animation = this._animations._standingRightFemale;
            }
            else
            {
                if (this._sex == SexEnum.Male)
                    animation = this._animations._standingLeftMale;
                else
                    animation = this._animations._standingLeftFemale;
            }

            AnimationSequence seq = new AnimationSequence(animation, AnimationPurposeEnum.StandingStill, facing);
            action._animationSeqs.Add(seq);
            action._currentAnimationSeq = seq;

            return action;
        }
Beispiel #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();
                    }
                }
            }
        }
Beispiel #6
0
        public Action CreateStandingAction(StandardCharacter character, HorizontalDirectionEnum facing, bool isActive)
        {
            // no standing for dead character
            if (character._isDead) return null;

            Action action = new Action(ActionTypeEnum.Standing);

            Animation animation = null;
            if (facing == HorizontalDirectionEnum.Right)
            {
                if (isActive)
                    animation = _animations._standingRightActive;
                else
                    animation = _animations._standingRight;
            }
            else
            {
                if (isActive)
                    animation = _animations._standingLeftActive;
                else
                    animation = _animations._standingLeft;
            }

            if (animation == null)
            {
                Debug.WriteLine("");
            }

            AnimationSequence seq = new AnimationSequence(animation, AnimationPurposeEnum.StandingStill, facing);
            action._animationSeqs.Add(seq);
            action._currentAnimationSeq = seq;

            return action;
        }
Beispiel #7
0
        public Action CreateGettingHitAction(HorizontalDirectionEnum facing)
        {
            Action action = new Action(ActionTypeEnum.GettingHit);

            Animation animation = null;
            if (facing == HorizontalDirectionEnum.Right)
            {
                animation = _animations._gettingHitRight;
            }
            else
            {
                animation = _animations._gettingHitLeft;
            }

            AnimationSequence seq = new AnimationSequence(animation, AnimationPurposeEnum.GettingHit, facing);
            action._animationSeqs.Add(seq);
            action._currentAnimationSeq = seq;

            return action;
        }
Beispiel #8
0
        public Action CreateFirstStandingAction(StandardCharacter character, HorizontalDirectionEnum facing)
        {
            Action action = new Action(ActionTypeEnum.Standing);

            Animation animation = null;
            if (facing == HorizontalDirectionEnum.Right)
            {
                animation = _animations._firstStandingRight;
            }
            else
            {
                animation = _animations._firstStandingLeft;
            }

            AnimationSequence seq = new AnimationSequence(animation, AnimationPurposeEnum.StandingStill, facing);
            action._animationSeqs.Add(seq);
            action._currentAnimationSeq = seq;

            return action;
        }