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; }
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)); } }
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); } }
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); }
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); }
public void RemoveBossBulletHitbox(CollisionElement element) { _bossBulletHitboxes.Remove(element); }
public void RemovePlayerBulletHitbox(CollisionElement element) { _playerBulletHitboxes.Remove(element); }
public void RemoveBossHitBox(CollisionElement element) { BossHitboxes.Remove(element); }
public void AddBossBulletHitbox(CollisionElement element) { _bossBulletHitboxes.Add(element); }
public void AddPlayerBulletHitbox(CollisionElement element) { _playerBulletHitboxes.Add(element); }
public void AddBossHitBox(CollisionElement element) { BossHitboxes.Add(element); }
public void RemoveHitBox(CollisionElement hitBox) { Game.GameManager.CollisionWorld.RemoveBossHitBox(hitBox); HitBoxes.Remove(hitBox); }
public void AddHitBox(CollisionElement hitBox) { Game.GameManager.CollisionWorld.AddBossHitBox(hitBox); HitBoxes.Add(hitBox); }
public abstract bool Intersects(CollisionElement collisionElement);