Example #1
0
        /// <summary>
        /// Checks to see if the Jet that was killed is finished exploding
        /// if so, transition to the dead state
        /// </summary>
        private bool checkIfFinishedExploding()
        {
            //TODO:
            //Will probably do some call to the explosion anim class here

            if (_explosionAnimator.IsStopped)
            {
                _myVisualState = JetMinionVisualState.DEAD;

                return(true);
            }
            return(false);
        }
Example #2
0
        /// <summary>
        /// Checks if this Jet is even alive,
        /// if not then initiate death
        /// </summary>
        private void checkIfIsAlive()
        {
            //Only needs to occur in these two states since the transition between healthy and damaged is based on
            //health as well

            if (_myVisualState == JetMinionVisualState.DAMAGED ||
                _myBehaviourState == JetMinionBehaviourState.RETREAT)
            {
                if (_health <= 0)
                {
                    _myVisualState = JetMinionVisualState.EXPLODING;
                    onEntry();
                }
            }
        }
Example #3
0
        /// <summary>
        /// Checks if this Jet has taken a lot of damage (indicated by DamageThreshold),
        /// if so then change the sprite to a more damaged one
        /// </summary>
        private void checkIfDamaged()
        {
            switch (_myVisualState)
            {
            //Really only need to check this if the current visual state is Healthy

            case JetMinionVisualState.HEALTHY:

                if (Health < DamageThreshold)
                {
                    _myVisualState = JetMinionVisualState.DAMAGED;
                }

                break;
            }
        }
Example #4
0
        /// <summary>
        /// Initializes the values of this Jet
        /// </summary>
        /// <param name="content"></param>
        /// <param name="position"></param>
        private void Initiailize(ContentManager content, Vector2 position)
        {
            //Setting Health
            _health = FullHealth;

            //Initializing States
            _myVisualState = JetMinionVisualState.HEALTHY;
            _myBehaviourState = JetMinionBehaviourState.IDLE;
            _myGunState = GunState.REST;
            _oldGunState = GunState.RIGHT;

            //Setting the initial position of the ship
            _position = position;

            //Setting up the initial direction
            _isMovingLeft = true;

            //Setting up the timers
            _timerLife = TotalLifeTime;
            _timerFire = HealthyFireRate;
            _timerExplosion = TotalExplosionTime;

            //Setting up the Explosion Animator
            _explosionAnimator = new ExplodeAnim(ExplosionType.SINGLE, 0.2f, new Rectangle((int)position.X, (int)position.Y, _spriteBounds[1].Width, _spriteBounds[1].Height));

            _spriteSheet = content.Load<Texture2D>("Spritesheets/newshi.shp.000000");
            _explosionSpriteSheet = content.Load<Texture2D>("Spritesheets/newsh6.shp.000000");

            #region Initializing _spriteBounds

            _spriteBounds[(int)JetMinionVisualState.HEALTHY].X = 98;
            _spriteBounds[(int)JetMinionVisualState.HEALTHY].Y = 143;
            _spriteBounds[(int)JetMinionVisualState.HEALTHY].Width = 93;
            _spriteBounds[(int)JetMinionVisualState.HEALTHY].Height = 80;

            _spriteBounds[(int)JetMinionVisualState.DAMAGED].X = 2;
            _spriteBounds[(int)JetMinionVisualState.DAMAGED].Y = 143;
            _spriteBounds[(int)JetMinionVisualState.DAMAGED].Width = 93;
            _spriteBounds[(int)JetMinionVisualState.DAMAGED].Height = 53;

            //This makes returning bounds easier, no check required
            _spriteBounds[(int)JetMinionVisualState.EXPLODING] = Rectangle.Empty;
            _spriteBounds[(int)JetMinionVisualState.DEAD] = Rectangle.Empty;

            #endregion

            #region Initializing _spriteGun

            _spriteGun[(int)GunState.LEFT].X = 62;
            _spriteGun[(int)GunState.LEFT].Y = 196;
            _spriteGun[(int)GunState.LEFT].Width = 21;
            _spriteGun[(int)GunState.LEFT].Height = 21;

            _spriteGun[(int)GunState.REST].X = 38;
            _spriteGun[(int)GunState.REST].Y = 196;
            _spriteGun[(int)GunState.REST].Width = 21;
            _spriteGun[(int)GunState.REST].Height = 20;

            _spriteGun[(int)GunState.RIGHT].X = 14;
            _spriteGun[(int)GunState.RIGHT].Y = 196;
            _spriteGun[(int)GunState.RIGHT].Width = 21;
            _spriteGun[(int)GunState.RIGHT].Height = 21;

            #endregion
        }
Example #5
0
        /// <summary>
        /// Checks if this Jet is even alive,
        /// if not then initiate death
        /// </summary>
        private void checkIfIsAlive()
        {
            //Only needs to occur in these two states since the transition between healthy and damaged is based on
            //health as well

            if (_myVisualState == JetMinionVisualState.DAMAGED ||
                _myBehaviourState == JetMinionBehaviourState.RETREAT)
            {
                if (_health <= 0)
                {
                    _myVisualState = JetMinionVisualState.EXPLODING;
                    onEntry();
                }
            }
        }
Example #6
0
        /// <summary>
        /// Checks to see if the Jet that was killed is finished exploding
        /// if so, transition to the dead state
        /// </summary>
        private bool checkIfFinishedExploding()
        {
            //TODO:
            //Will probably do some call to the explosion anim class here

            if (_explosionAnimator.IsStopped)
            {
                _myVisualState = JetMinionVisualState.DEAD;

                return true;
            }
            return false;
        }
Example #7
0
        /// <summary>
        /// Checks if this Jet has taken a lot of damage (indicated by DamageThreshold),
        /// if so then change the sprite to a more damaged one
        /// </summary>
        private void checkIfDamaged()
        {
            switch (_myVisualState)
            {
                //Really only need to check this if the current visual state is Healthy

                case JetMinionVisualState.HEALTHY:

                    if (Health < DamageThreshold)
                    {
                        _myVisualState = JetMinionVisualState.DAMAGED;
                    }

                    break;
            }
        }
Example #8
0
        /// <summary>
        /// Initializes the values of this Jet
        /// </summary>
        /// <param name="content"></param>
        /// <param name="position"></param>
        private void Initiailize(ContentManager content, Vector2 position)
        {
            //Setting Health
            _health = FullHealth;

            //Initializing States
            _myVisualState    = JetMinionVisualState.HEALTHY;
            _myBehaviourState = JetMinionBehaviourState.IDLE;
            _myGunState       = GunState.REST;
            _oldGunState      = GunState.RIGHT;

            //Setting the initial position of the ship
            _position = position;

            //Setting up the initial direction
            _isMovingLeft = true;

            //Setting up the timers
            _timerLife      = TotalLifeTime;
            _timerFire      = HealthyFireRate;
            _timerExplosion = TotalExplosionTime;

            //Setting up the Explosion Animator
            _explosionAnimator = new ExplodeAnim(ExplosionType.SINGLE, 0.2f, new Rectangle((int)position.X, (int)position.Y, _spriteBounds[1].Width, _spriteBounds[1].Height));

            _spriteSheet          = content.Load <Texture2D>("Spritesheets/newshi.shp.000000");
            _explosionSpriteSheet = content.Load <Texture2D>("Spritesheets/newsh6.shp.000000");

            #region Initializing _spriteBounds

            _spriteBounds[(int)JetMinionVisualState.HEALTHY].X      = 98;
            _spriteBounds[(int)JetMinionVisualState.HEALTHY].Y      = 143;
            _spriteBounds[(int)JetMinionVisualState.HEALTHY].Width  = 93;
            _spriteBounds[(int)JetMinionVisualState.HEALTHY].Height = 80;

            _spriteBounds[(int)JetMinionVisualState.DAMAGED].X      = 2;
            _spriteBounds[(int)JetMinionVisualState.DAMAGED].Y      = 143;
            _spriteBounds[(int)JetMinionVisualState.DAMAGED].Width  = 93;
            _spriteBounds[(int)JetMinionVisualState.DAMAGED].Height = 53;

            //This makes returning bounds easier, no check required
            _spriteBounds[(int)JetMinionVisualState.EXPLODING] = Rectangle.Empty;
            _spriteBounds[(int)JetMinionVisualState.DEAD]      = Rectangle.Empty;

            #endregion

            #region Initializing _spriteGun

            _spriteGun[(int)GunState.LEFT].X      = 62;
            _spriteGun[(int)GunState.LEFT].Y      = 196;
            _spriteGun[(int)GunState.LEFT].Width  = 21;
            _spriteGun[(int)GunState.LEFT].Height = 21;

            _spriteGun[(int)GunState.REST].X      = 38;
            _spriteGun[(int)GunState.REST].Y      = 196;
            _spriteGun[(int)GunState.REST].Width  = 21;
            _spriteGun[(int)GunState.REST].Height = 20;

            _spriteGun[(int)GunState.RIGHT].X      = 14;
            _spriteGun[(int)GunState.RIGHT].Y      = 196;
            _spriteGun[(int)GunState.RIGHT].Width  = 21;
            _spriteGun[(int)GunState.RIGHT].Height = 21;

            #endregion
        }