/// <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 ); } }
public override void Remove( EntityPlayer player ) { }
public override void Apply( EntityPlayer player ) { base.Apply( player ); player.AddWeapon( new WeaponBFG() ); }
/// <summary> /// This is called at the end of the power ups duration. /// </summary> /// <param name="player"></param> public abstract void Remove( EntityPlayer player );
/// <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; }
public override void Apply( EntityPlayer player ) { base.Apply( player ); player.AddHealth( 25.0f ); }
/// <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 ); }