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 Holly(XmasLog boss, CustomSpriterAnimator animator) { _boss = boss; _animator = animator.Clone(); _angularSpeed = 5f; var hollyLeafPosition = SpriterUtils.GetWorldPosition("holly-leaf.png", boss.CurrentAnimator); Position(hollyLeafPosition); _animator.Play("Growth"); _animator.AnimationFinished += AnimationFinished; // Physics _boundingBoxes = new List <CollisionElement> { new SpriterCollisionCircle(this, "holly-leaf.png", new Vector2(-30, 0), 0.4f, "holly-leaf"), new SpriterCollisionCircle(this, "holly-leaf.png", new Vector2(45, 10), 0.3f, "holly-leaf"), new SpriterCollisionCircle(this, "holly-leaf.png", new Vector2(-30, 0), 0.4f, "holly-leaf_000"), new SpriterCollisionCircle(this, "holly-leaf.png", new Vector2(45, 10), 0.3f, "holly-leaf_000"), new SpriterCollisionCircle(this, "holly-leaf.png", new Vector2(-30, 0), 0.4f, "holly-leaf_001"), new SpriterCollisionCircle(this, "holly-leaf.png", new Vector2(45, 10), 0.3f, "holly-leaf_001"), new SpriterCollisionCircle(this, "holly-balls.png", Vector2.Zero, 0.8f) }; foreach (var boundingBox in _boundingBoxes) { _boss.AddHitBox(boundingBox); } MoveTo(_boss.Game.ViewportAdapter.Center.ToVector2()); }
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 BigArms(XmasSnowman boss, CustomSpriterAnimator animator, bool rightArm) { _boss = boss; _animator = animator.Clone(); _rightArm = rightArm; _verticalDirection = 1; _speed = 200; _initialPosition = new Vector2(GameConfig.VirtualResolution.X / 2f, GameConfig.VirtualResolution.Y / 2f + 300); Position(_initialPosition); // Physics _boundingBoxes = new List <CollisionElement> { new SpriterCollisionConvexPolygon(this, "big-arm.png", new Vector2(177f, 10f), new Vector2(0.1f, 0.95f)), new SpriterCollisionCircle(this, "big-arm.png", new Vector2(-50f, -250f), 0.1f), new SpriterCollisionCircle(this, "big-arm.png", new Vector2(-105f, -295f), 0.1f), new SpriterCollisionCircle(this, "big-arm.png", new Vector2(-160f, -340f), 0.1f), new SpriterCollisionCircle(this, "big-arm.png", new Vector2(50f, -250f), 0.1f), new SpriterCollisionCircle(this, "big-arm.png", new Vector2(105f, -295f), 0.1f), new SpriterCollisionCircle(this, "big-arm.png", new Vector2(160f, -340f), 0.1f), }; foreach (var boundingBox in _boundingBoxes) { _boss.AddHitBox(boundingBox); } // Animations _animator.Play("Idle"); var spriteSize = SpriterUtils.GetSpriterFileSize("big-arm.png", _animator); if (rightArm) { _horizontalDirection = -1; _horizontalLimits = new Point(GameConfig.VirtualResolution.X + 200, GameConfig.VirtualResolution.X + 200 + spriteSize.Y / 2); Rotation(MathHelper.Pi); } else { _horizontalDirection = 1; _horizontalLimits = new Point(-200 - spriteSize.Y / 2, -200); } Position(new Vector2(_horizontalLimits.X, 0)); ChangeHorizontalPosition(); }
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 BabyLog(XmasLog boss, CustomSpriterAnimator animator, Vector2 position) { _boss = boss; _animator = animator.Clone(); Position(position); }