コード例 #1
0
ファイル: Player.cs プロジェクト: Noxalus/Danmaku-no-Kyojin
        public override void Initialize()
        {
            _velocity = (float)(Config.PlayerMaxVelocity * Improvements.SpeedData[PlayerData.SpeedIndex].Key);
            _velocitySlowMode = Config.PlayerMaxSlowVelocity;
            _direction = Vector2.Zero;
            Rotation = 0f;
            _distance = Vector2.Zero;

            _lives = 10;//Improvements.LivesNumberData[PlayerData.LivesNumberIndex].Key;

            IsInvincible = false;
            _invincibleTime = Config.PlayerInvicibleTime;

            BulletTime = false;
            BulletFrequence = new TimeSpan(0);
            IsAlive = true;

            _score = 0;
            _bulletTimeTimer = Config.DefaultBulletTimeTimer;
            _hitboxRadius = (float)Math.PI * 1.5f * 2;
            _camera = new Camera2D(_viewport, 1f);

            base.Initialize();
        }
コード例 #2
0
ファイル: Player.cs プロジェクト: kaspal/Danmaku-no-Kyojin
        protected override void LoadContent()
        {
            base.LoadContent();

            Sprite = Game.Content.Load<Texture2D>("Graphics/Entities/ship");
            _bulletSprite = this.Game.Content.Load<Texture2D>("Graphics/Entities/ship_bullet");
            _hitboxSprite = this.Game.Content.Load<Texture2D>("Graphics/Pictures/hitbox");
            Center = new Vector2(Sprite.Width / 2f, Sprite.Height / 2f);
            CollisionBox = new CollisionCircle(this, new Vector2(Sprite.Height / 6f, Sprite.Height / 6f), _hitboxRadius/2f);

            _lifeIcon = Game.Content.Load<Texture2D>("Graphics/Pictures/life");

            _bulletTimeBarLeft = Game.Content.Load<Texture2D>("Graphics/Pictures/bulletTimeBarLeft");
            _bulletTimeBarContent = Game.Content.Load<Texture2D>("Graphics/Pictures/bulletTimeBarContent");
            _bulletTimeBarRight = Game.Content.Load<Texture2D>("Graphics/Pictures/bulletTimeBarRight");

            if (_shootSound == null)
                _shootSound = Game.Content.Load<SoundEffect>(@"Audio/SE/hit");
            if (_deadSound == null)
                _deadSound = Game.Content.Load<SoundEffect>(@"Audio/SE/dead");

            float xLag = Config.Resolution.X / 2;
            if (Config.PlayersNumber > 1)
                xLag /= 2;

            _camera = new Camera2D(_viewport, Config.GameArea.X, Config.GameArea.Y, 1f);
        }