コード例 #1
0
        /// <summary>
        /// Counts down the power up depending on the duration.
        /// At the end of the duration, the Remove-method is called.
        /// </summary>
        /// <param name="gameTime"></param>
        /// <param name="player"></param>
        public void UpdateEffect( GameTime gameTime, EntityPlayer player, List<PowerUp> powerUps )
        {
            _updateTimer += gameTime.ElapsedGameTime.Milliseconds * 0.001f;

            if( _updateTimer >= _effectDuration )
            {
                Remove( player );
                powerUps.Remove( this );
            }
        }
コード例 #2
0
 public override void Remove( EntityPlayer player )
 {
 }
コード例 #3
0
        public override void Apply( EntityPlayer player )
        {
            base.Apply( player );

            player.AddWeapon( new WeaponBFG() );
        }
コード例 #4
0
 /// <summary>
 /// This is called at the end of the power ups duration.
 /// </summary>
 /// <param name="player"></param>
 public abstract void Remove( EntityPlayer player );
コード例 #5
0
 /// <summary>
 /// This is called at the beginning of the power ups duration.
 /// </summary>
 /// <param name="player"></param>
 public virtual void Apply( EntityPlayer player )
 {
     _updateTimer = 0f;
 }
コード例 #6
0
 public override void Apply( EntityPlayer player )
 {
     base.Apply( player );
     player.AddHealth( 25.0f );
 }
コード例 #7
0
        /// <summary>
        /// Loads the contents of the mapfile to the model.
        /// </summary>
        /// <param name="fileName"></param>
        public void Load( String fileName )
        {
            _bodies.Clear();
            _powerUps.Clear();

            float x = _game.Window.ClientBounds.Width / 2;
            float y = _game.Window.ClientBounds.Height / 2;
            _player = new EntityPlayer( new Vector2( x, y ) );

            XmlReaderSettings settings = new XmlReaderSettings();

            using( XmlReader reader = XmlReader.Create( "Content/maps/" + fileName, settings ) )
                _map = IntermediateSerializer.Deserialize<Map>( reader, null );
        }