Exemplo n.º 1
0
        /// <summary>
        /// Creates a shiny new jet
        /// </summary>
        /// <param name="id">the factory id on the underside of this jet</param>
        /// <param name="content">The content manager to use</param>
        /// <param name="newPosition">The position to spawn the jet</param>
        public TwinJet(uint id, ContentManager content, Vector2 newPosition)
            : base(id)
        {
            //Setting the health
            this.Health = FullHealth;

            //Setting alive to 'true'
            _isAlive = true;

            //Initializing the states
            _myVisualState   = TwinJetVisualState.HEALTHY;
            _myBehaviorState = TwinJetBehaviouralState.INTRO;
            _myFireState     = TwinJetFireState.STAGE1;
            _myGunState      = GunState.REST;
            _oldGunState     = GunState.LEFT;

            //Initializing rotation
            _myRotation = 0;

            //Setting the flight pattern to null
            _myPattern = null;

            //Setting position and velocity
            _position = newPosition;
            _velocity = Vector2.Zero;

            //Marking the intro as still occurring
            _isIntroOver = false;

            //Setup firerates
            _timerGunFireRate     = 0;
            _timerMissileFireRate = 0;

            //Bring in the spritesheet
            _spriteSheet = content.Load <Texture2D>("Spritesheets/newshi.shp.000000");

            //Setting up Sprite Bounds for the jet and gun
            _spriteBounds[(int)TwinJetVisualState.HEALTHY]      = new Rectangle(98, 143, 93, 80);
            _spriteBounds[(int)TwinJetVisualState.DAMAGED]      = new Rectangle(2, 143, 93, 53);
            _spriteBounds[(int)TwinJetVisualState.GUNDESTROYED] = new Rectangle(2, 143, 93, 53);
            _spriteBounds[(int)TwinJetVisualState.EXPLODING]    = Rectangle.Empty;
            _spriteBounds[(int)TwinJetVisualState.DEAD]         = Rectangle.Empty;

            _spriteGunBounds[(int)GunState.LEFT]      = new Rectangle(62, 196, 21, 21);
            _spriteGunBounds[(int)GunState.REST]      = new Rectangle(38, 196, 21, 20);
            _spriteGunBounds[(int)GunState.RIGHT]     = new Rectangle(14, 196, 21, 21);
            _spriteGunBounds[(int)GunState.DESTROYED] = new Rectangle(38, 196, 21, 11);

            //Calls the on entry method to initialize some things
            onEntry();
        }
Exemplo n.º 2
0
        /// <summary>
        /// Sets the current flight pattern to the new pattern
        /// </summary>
        /// <param name="newPattern">The new pattern to use</param>
        public void SetPattern(BossFlightPattern newPattern)
        {
            _myPattern = newPattern;

            onEntry();
        }