コード例 #1
0
ファイル: Jetpack.cs プロジェクト: DuckKnightDuel/Adam
        public void Update(Player.Player player, GameTime gameTime)
        {
            if (player.IsJumping)
            {
                _effectTimer += gameTime.ElapsedGameTime.TotalMilliseconds;
                _currentFuel -= _depletionRate;
                if (_loopInstance.State == SoundState.Stopped)
                    _loopInstance.Play();

                if (_effectTimer > 100 && InputHelper.IsLeftMousePressed() && HasFuel)
                {
                    Particle eff = new Particle();
                    eff.CreateJetPackSmokeParticle(player);
                    _particles.Add(eff);
                    _effectTimer = 0;
                }
            }
            else
                _currentFuel += _refuelingRate;

            if (_currentFuel <= 0)
            {
                HasFuel = false;
            }
            else HasFuel = true;

            if (_currentFuel > _maxFuel)
                _currentFuel = _maxFuel;

            foreach (var eff in _particles)
            {
                eff.Update(gameTime);
                if (eff.ToDelete)
                {
                    _particles.Remove(eff);
                    break;
                }
            }

            if (InputHelper.IsLeftMouseReleased() || !HasFuel)
                _loopInstance.Stop();
        }
コード例 #2
0
ファイル: JetpackPowerUp.cs プロジェクト: DuckKnightDuel/Adam
        public override void Update()
        {
            GameWorld gameWorld = GameWorld.Instance;
            _gameTime = gameWorld.GameTime;

            _animation.UpdateRectangle(DrawRectangle);
            _animation.Update(_gameTime);

            Hover();

            EffectTimer += _gameTime.ElapsedGameTime.TotalMilliseconds;
            if (EffectTimer > 100)
            {
                Particle eff = new Particle();
                eff.CreateJetPackSmokeParticle(this);
                GameWorld.Instance.Particles.Add(eff);
                EffectTimer = 0;
            }

            base.Update();
        }
コード例 #3
0
ファイル: CDPlayer.cs プロジェクト: DuckKnightDuel/Adam
        public override void Update()
        {
            GameWorld gameWorld = GameWorld.Instance;
            GameTime gameTime = gameWorld.GameTime;

            Velocity.Y += .3f;
            if (Velocity.Y > 5f)
                Velocity.Y = 5f;

            EffectTimer += gameTime.ElapsedGameTime.TotalMilliseconds;
            if (EffectTimer > 500)
            {
                Particle eff = new Particle();
                eff.CreateMusicNotesEffect(this);
                GameWorld.Instance.Particles.Add(eff);
                EffectTimer = 0;
            }

            base.Update();
        }
コード例 #4
0
ファイル: Liquid.cs プロジェクト: DuckKnightDuel/Adam
        public void Update(Tile t)
        {
            GameWorld gameWorld = GameWorld.Instance;
            this.Player = GameWorld.Instance.Player;

            if (CollRectangle.Intersects(GameWorld.Instance.Player.GetCollRectangle()))
            {
                Player.TakeDamage(this, Player.MaxHealth);
            }

            //if (!isOnTop)
            //    return;

            if (_currentType == Type.Lava)
            {
                if (GameWorld.Instance.TileArray[GetTileIndex() - GameWorld.Instance.WorldData.LevelWidth].Id == 0)
                {
                    _particleTimer += GameWorld.Instance.GetGameTime().ElapsedGameTime.TotalSeconds;
                    if (_particleTimer > _restartTime)
                    {
                        Particle par = new Particle();
                        par.CreateLavaParticle(this, gameWorld);
                        gameWorld.Particles.Add(par);
                        _particleTimer = 0;
                    }
                }
            }
        }