Example #1
0
        public Snowball(XmasSnowman boss, CustomSpriterAnimator animator, Vector2 position)
        {
            _boss            = boss;
            _animator        = animator.Clone();
            _initialPosition = position;

            Position(_initialPosition);

            _randomScale    = (float)(1f + _boss.Game.GameManager.Random.NextDouble() * 1.75f);
            _animator.Scale = new Vector2(_randomScale);

            // Physics
            _boundingBox = CreateBoundingBox();
            _boss.AddHitBox(_boundingBox);
            _body = CreateBody(_animator.Scale.X);

            _body.IgnoreGravity = true;
            _body.OnCollision  += OnCollision;

            // Animations
            _animator.Play("Spawn");

            // Swap body and ribbon with random textures
            var randomIndex = _boss.Game.GameManager.Random.Next(1, 7);

            if (randomIndex > 1)
            {
                _animator.AddTextureSwap("Graphics/Sprites/Bosses/XmasGift/body", Assets.GetTexture2D("Graphics/Sprites/Bosses/XmasGift/body" + randomIndex));
                _animator.AddTextureSwap("Graphics/Sprites/Bosses/XmasGift/ribbon", Assets.GetTexture2D("Graphics/Sprites/Bosses/XmasGift/ribbon" + randomIndex));
            }

            _animator.AnimationFinished += AnimationFinishedHandler;
        }
Example #2
0
        public Gift(XmasGift boss, CustomSpriterAnimator animator)
        {
            _boss     = boss;
            _animator = animator.Clone();

            var randomScale = (float)(0.42f + _boss.Game.GameManager.Random.NextDouble() * 1.15f);

            _animator.Scale = new Vector2(randomScale);

            // Physics
            _boundingBox = _boss.CreateBoundingBox(this, randomScale);
            _boss.AddHitBox(_boundingBox);

            var randomSpawnBounds = new Rectangle(
                (int)(270 * randomScale), 0,
                (int)(GameConfig.VirtualResolution.X - (270 * randomScale)), 300
                );

            _body = _boss.CreateGiftBody(_boss.Game.GameManager.GetRandomPosition(false, randomSpawnBounds), _animator.Scale.X);

            _animator.Play("NoAnimation");

            // Swap body and ribbon with random textures
            var randomIndex = _boss.Game.GameManager.Random.Next(1, 7);

            if (randomIndex > 1)
            {
                _animator.AddTextureSwap("Graphics/Sprites/Bosses/XmasGift/body", Assets.GetTexture2D("Graphics/Sprites/Bosses/XmasGift/body" + randomIndex));
                _animator.AddTextureSwap("Graphics/Sprites/Bosses/XmasGift/ribbon", Assets.GetTexture2D("Graphics/Sprites/Bosses/XmasGift/ribbon" + randomIndex));
            }
        }
Example #3
0
        public void Init(bool topBullet)
        {
            _used = true;

            Sprite       = new Sprite(Assets.GetTexture2D("Graphics/Sprites/Bullets/bullet1"));
            Sprite.Alpha = 0f;
            Sprite.Scale = new Vector2(2.5f);

            _game.SpriteBatchManager.BossBullets.Add(this);

            if (!topBullet)
            {
                _hitbox = new CollisionCircle(this, Vector2.Zero, Sprite.BoundingRectangle.Width / 2f);
                _game.GameManager.CollisionWorld.AddBossBulletHitbox(_hitbox);
            }
        }
Example #4
0
        public Bullet(XmasHell game, Vector2 position, float rotation, float speed)
        {
            _game = game;
            var defaultBulletTexture = BulletTypeUtils.BulletTypeToTexture(BulletType.Type2);

            Sprite = new Sprite(defaultBulletTexture)
            {
                Position = position,
                Rotation = rotation
            };
            Speed = speed;
            Used  = true;

            Hitbox = new CollisionCircle(this, Vector2.Zero, defaultBulletTexture.Width / 2f);
            _game.GameManager.CollisionWorld.AddPlayerBulletHitbox(Hitbox);

            _game.SpriteBatchManager.GameSprites.Add(Sprite);
        }
Example #5
0
        public Hat(XmasSnowman boss, CustomSpriterAnimator animator, Vector2 position)
        {
            _boss     = boss;
            _animator = animator.Clone();
            _speed    = 200;

            _initialPosition = position;
            _scaleDownLaser  = true;

            Position(_initialPosition);

            // Physics
            _boundingBox = new SpriterCollisionCircle(this, "hat.png", Vector2.Zero, 0.7f);

            _boss.AddHitBox(_boundingBox);

            // Animations
            _animator.Play("Idle");

            ChangeHorizontalPosition();
            ShootLaser();

            _boss.Game.SpriteBatchManager.AddSpriterAnimator(_animator, Layer.FRONT);
        }
Example #6
0
 public void RemoveBossBulletHitbox(CollisionElement element)
 {
     _bossBulletHitboxes.Remove(element);
 }
Example #7
0
 public void RemovePlayerBulletHitbox(CollisionElement element)
 {
     _playerBulletHitboxes.Remove(element);
 }
Example #8
0
 public void RemoveBossHitBox(CollisionElement element)
 {
     BossHitboxes.Remove(element);
 }
Example #9
0
 public void AddBossBulletHitbox(CollisionElement element)
 {
     _bossBulletHitboxes.Add(element);
 }
Example #10
0
 public void AddPlayerBulletHitbox(CollisionElement element)
 {
     _playerBulletHitboxes.Add(element);
 }
Example #11
0
 public void AddBossHitBox(CollisionElement element)
 {
     BossHitboxes.Add(element);
 }
Example #12
0
 public void RemoveHitBox(CollisionElement hitBox)
 {
     Game.GameManager.CollisionWorld.RemoveBossHitBox(hitBox);
     HitBoxes.Remove(hitBox);
 }
Example #13
0
 public void AddHitBox(CollisionElement hitBox)
 {
     Game.GameManager.CollisionWorld.AddBossHitBox(hitBox);
     HitBoxes.Add(hitBox);
 }
 public abstract bool Intersects(CollisionElement collisionElement);