public void Update(IHandleHealth entity) { foreach (var healthUnit in _healthUnits) { healthUnit.Update(); } }
public void Initialize(IHandleHealth entity) { //ToDo pass max health initializer into ctor _currentHealth = _maxHealth; _healthContainer.Initialize(entity); entity.Healed += OnHealed; entity.Damaged += OnDamaged; }
public void Initialize(IHandleHealth entity) { _drawPosition = new Rectangle(_gameContext.GameGraphics.ScreenBounds.X + 10, _gameContext.GameGraphics.ScreenBounds.Y + 10, 0, 0); var healthUnits = new List <IHealthUnit>(); for (int i = 0; i < entity.MaxHealth / PlayerHealthUnit.HEALTH_PIECES_PER_UNIT; i++) { //ToDo use creation strategy var texture = _gameContext.AssetManager.GetTexture(GameConstants.PlayerConstants.PlayerShip1Constants.Textures.RedLifeIconTextureName); var drawRect = new Rectangle(_drawPosition.X, _drawPosition.Y, texture.Width, texture.Height); var healthUnit = new PlayerHealthUnit(_gameContext, texture, drawRect); healthUnit.Initialize(); healthUnits.Add(healthUnit); _drawPosition.X += drawRect.Width; } _healthUnits = healthUnits.ToArray(); }
public void Initialize(IHandleHealth entity) { //Do nothing }
public void Update(IHandleHealth entity) { //Do nothing }
public void Draw(IHandleHealth entity, IGameTime gameTime) { _healthContainer.Draw(); }
public void Update(IHandleHealth entity, IGameTime gameTime) { _healthContainer.Update(entity); }