Beispiel #1
0
 public void Update(IHandleHealth entity)
 {
     foreach (var healthUnit in _healthUnits)
     {
         healthUnit.Update();
     }
 }
Beispiel #2
0
        public void Initialize(IHandleHealth entity)
        {
            //ToDo pass max health initializer into ctor
            _currentHealth = _maxHealth;

            _healthContainer.Initialize(entity);

            entity.Healed  += OnHealed;
            entity.Damaged += OnDamaged;
        }
Beispiel #3
0
        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();
        }
Beispiel #4
0
 public void Initialize(IHandleHealth entity)
 {
     //Do nothing
 }
Beispiel #5
0
 public void Update(IHandleHealth entity)
 {
     //Do nothing
 }
Beispiel #6
0
 public void Draw(IHandleHealth entity, IGameTime gameTime)
 {
     _healthContainer.Draw();
 }
Beispiel #7
0
 public void Update(IHandleHealth entity, IGameTime gameTime)
 {
     _healthContainer.Update(entity);
 }