//// <summary>
        /// Adds an animation set to this set
        /// </summary>
        /// <param name="newSet">The new Set to add</param>
        /// <param name="offsetFromPosition">The offset from the explosion sets position to where
        /// the animation should be displayed (useful for piecing together animations that
        /// have been split apart)
        /// </param>
        public void AddAnimSet(AnimSet newSet, Vector2 offsetFromPosition)
        {
            newSet.ChangeAnimType(AnimType.LOOP);
            newSet.Position = _position + offsetFromPosition;

            _spriteList.Add(newSet);
        }
        /// <summary>
        /// Creates an Explosion set with one initial Anim Set
        /// </summary>
        /// <param name="initialSet">The set to start out with</param>
        /// <param name="position">The position of this set</param>
        /// <param name="delayTimer">The optional time delay when starting the animation</param>
        public ExplosionSet(AnimSet initialSet, Vector2 position, float delayTimer = 0)
        {
            _spriteList  = new List <AnimSet>();
            _position    = position;
            _timeToStart = delayTimer;

            _spriteList.Add(initialSet);
        }
Exemple #3
0
        /// <summary>
        /// This gets called whenever there is a transition to a new state
        /// </summary>
        private void onEntry()
        {
            //These are, so far, the only two states that need an onEntry method,
            //but we'll leave the structure here in case more is needed

            switch (_myBehaviourState)
            {
            case JetMinionBehaviourState.FIRE:

                _timerFire = 0;

                break;

            default:
                break;
            }

            switch (_myVisualState)
            {
            case JetMinionVisualState.EXPLODING:

                //TODO:
                //This will probably insantiate the animation class, this
                //way it is only called once when this state is entered

                Vector2 explosionSize = new Vector2(ExplosionLeftSpriteBounds[0].Width, ExplosionRightSpriteBounds[0].Height) * ExplosionScale;

                Rectangle explosionBounds = new Rectangle(0, 0, (int)explosionSize.X, (int)explosionSize.Y);

                AnimSet explosionLeftSide  = new AnimSet(ExplosionLeftSpriteBounds, _explosionSpriteSheet, explosionBounds, AnimType.LOOP, ExplosionIntervalTime);
                AnimSet explosionRightSide = new AnimSet(ExplosionRightSpriteBounds, _explosionSpriteSheet, explosionBounds, AnimType.LOOP, ExplosionIntervalTime);

                ExplosionSet newExplosion = new ExplosionSet(_position);

                newExplosion.AddAnimSet(explosionLeftSide, Vector2.Zero);
                newExplosion.AddAnimSet(explosionRightSide, new Vector2(explosionBounds.Width, 0) * ExplosionScale);

                _explosionAnimator.AddExplosion(newExplosion, Vector2.Zero);

                _explosionAnimator.Start();
                break;

            default:
                break;
            }
        }
        /// <summary>
        /// This gets called whenever there is a transition to a new state
        /// </summary>
        private void onEntry()
        {
            //These are, so far, the only two states that need an onEntry method,
            //but we'll leave the structure here in case more is needed

            switch (_myBehaviourState)
            {
                case JetMinionBehaviourState.FIRE:

                    _timerFire = 0;

                    break;

                default:
                    break;
            }

            switch (_myVisualState)
            {
                case JetMinionVisualState.EXPLODING:

                    //TODO:
                    //This will probably insantiate the animation class, this
                    //way it is only called once when this state is entered

                    Vector2 explosionSize = new Vector2(ExplosionLeftSpriteBounds[0].Width, ExplosionRightSpriteBounds[0].Height) * ExplosionScale;

                    Rectangle explosionBounds = new Rectangle(0, 0, (int)explosionSize.X, (int)explosionSize.Y);

                    AnimSet explosionLeftSide = new AnimSet(ExplosionLeftSpriteBounds, _explosionSpriteSheet, explosionBounds, AnimType.LOOP, ExplosionIntervalTime);
                    AnimSet explosionRightSide = new AnimSet(ExplosionRightSpriteBounds, _explosionSpriteSheet, explosionBounds, AnimType.LOOP, ExplosionIntervalTime);

                    ExplosionSet newExplosion = new ExplosionSet(_position);

                    newExplosion.AddAnimSet(explosionLeftSide, Vector2.Zero);
                    newExplosion.AddAnimSet(explosionRightSide, new Vector2(explosionBounds.Width, 0) * ExplosionScale);

                    _explosionAnimator.AddExplosion(newExplosion, Vector2.Zero);

                    _explosionAnimator.Start();
                    break;

                default:
                    break;
            }
        }
        //// <summary>
        /// Adds an animation set to this set
        /// </summary>
        /// <param name="newSet">The new Set to add</param>
        /// <param name="offsetFromPosition">The offset from the explosion sets position to where
        /// the animation should be displayed (useful for piecing together animations that 
        /// have been split apart)
        /// </param>
        public void AddAnimSet(AnimSet newSet, Vector2 offsetFromPosition)
        {
            newSet.ChangeAnimType(AnimType.LOOP);
            newSet.Position = _position + offsetFromPosition;

            _spriteList.Add(newSet);
        }
        /// <summary>
        /// Creates an Explosion set with one initial Anim Set
        /// </summary>
        /// <param name="initialSet">The set to start out with</param>
        /// <param name="position">The position of this set</param>
        /// <param name="delayTimer">The optional time delay when starting the animation</param>
        public ExplosionSet(AnimSet initialSet, Vector2 position, float delayTimer = 0)
        {
            _spriteList = new List<AnimSet>();
            _position = position;
            _timeToStart = delayTimer;

            _spriteList.Add(initialSet);
        }