/// <summary> /// Notifies the specified subject. /// </summary> /// <param name="subject">The subject.</param> public void Notify(ObservedSubject subject) { if (subject is UI) { if ((subject as UI).NumberOfLife != this.numberOfLifes) { this.numberOfLifes = (subject as UI).NumberOfLife; } } else if (subject is Bullet) { numberOfLifes -= 1; this.NotifyAllObservers(); } else if (subject is Bonus) { if ((subject as Bonus).Type != BonusType.none) { if ((subject as Bonus).Type == BonusType.invincible) { if ((subject as Bonus).BonusTime > 0) { this.invincible = true; } else { this.invincible = false; } } Game1.bonusList.Remove(subject as Bonus); currentBonus = (subject as Bonus); } } }
/// <summary> /// Initializes the specified image. /// </summary> /// <param name="image">The image.</param> /// <param name="position">The position.</param> public void Initialize(Texture2D image, Vector2 position) { this.image = image; this.position = position; FillObject2DInfo(); this.currentBonus = new Bonus(image, Vector2.Zero, BonusType.none); bullets = new Bullet[MAX_BULLETS]; }