コード例 #1
0
ファイル: Dynamite.cs プロジェクト: Bajena/Miner
 public override void Initialize()
 {
     base.Initialize();
     var explosionWaitTimer = new TimerComponent(this, _timeToExplosion, false);
     explosionWaitTimer.Tick += WaitForExplosionFinished;
     explosionWaitTimer.Start();
     Components.Add("ExplosionWaitTimer", explosionWaitTimer);
 }
コード例 #2
0
ファイル: GasBottle.cs プロジェクト: Bajena/Miner
        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);
        }
コード例 #3
0
ファイル: Player.cs プロジェクト: Bajena/Miner
        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();
        }