public override void Initialize() { base.Initialize(); var explosionWaitTimer = new TimerComponent(this, _timeToExplosion, false); explosionWaitTimer.Tick += WaitForExplosionFinished; explosionWaitTimer.Start(); Components.Add("ExplosionWaitTimer", explosionWaitTimer); }
public GasBottle(MinerGame game) : base(game) { Type = "GasBottle"; var randTime = new Random().Next(500, 1500); var explosionWaitTimer = new TimerComponent(this,TimeSpan.FromMilliseconds(randTime), false); explosionWaitTimer.Tick += WaitForExplosionFinished; Components.Add("ExplosionWaitTimer", explosionWaitTimer); }
public Player(MinerGame game) : base(game) { Type = "Player"; Oxygen = SettingsManager.Instance.MaxOxygen; Lives = SettingsManager.Instance.StartLives; Points = 0; Dynamite = SettingsManager.Instance.StartDynamite; var oxygenTimer = new TimerComponent(this, TimeSpan.FromSeconds(0.5), true); oxygenTimer.Tick += DecreaseOxygen; Components.Add("OxygenTimer", oxygenTimer); OxygenTimer.Start(); Components.Add("Physics", new PhysicsComponent(this) { HasGravity = true }); Components.Add("WorldCollision", new PlayerWorldCollisionComponent(game,this)); _deathSound = game.Content.Load<SoundEffect>("Sounds/death"); SetupAnimations(); }