Exemplo n.º 1
0
        public XmasSnowflakeBranch(Boss boss, Sprite sprite) : base(sprite)
        {
            Speed = 1500f;
            _boss = boss;

            _canRushTimer = new CountdownTimer(1f + (_boss.Game.GameManager.Random.NextDouble() * 3f));
            _rushTimer    = new CountdownTimer(5f);
            _rushTimer.Stop();

            _rushing = false;
            _canRush = false;

            _angularSpeed = 2f + ((float)_boss.Game.GameManager.Random.NextDouble() * 3f);

            if (_boss.Game.GameManager.Random.NextDouble() > 0.5f)
            {
                _angularSpeed *= -1;
            }

            _destroyed = false;

            _canRushTimer.Completed += (sender, args) =>
            {
                _canRush = true;
                _rushTimer.Start();
            };

            _rushTimer.Completed += (sender, args) =>
            {
                if (!_destroyed && !TargetingPosition)
                {
                    RushToPlayer();
                }
            };

            Sprite.Origin = new Vector2(0.5f * Sprite.TextureRegion.Width, 0.5f * Sprite.TextureRegion.Height);

            // Physics
            var bbWidth         = sprite.TextureRegion.Width / 4f;
            var bbLocalPosition = new Vector2((sprite.TextureRegion.Width / 2f) - (bbWidth / 2f), 0f);
            var startX          = -sprite.TextureRegion.Width / 2f;
            var startY          = -sprite.TextureRegion.Height / 2f;
            var vertices        = new List <Vector2>()
            {
                new Vector2(startX, startY),
                new Vector2(startX + bbWidth, startY),
                new Vector2(startX + bbWidth, startY + sprite.TextureRegion.Height),
                new Vector2(startX, startY + sprite.TextureRegion.Height)
            };

            _boundingBox = new CollisionConvexPolygon(this, bbLocalPosition, vertices);
            _boss.AddHitBox(_boundingBox);

            _branchPlayerLine = new Line(Position(), _boss.GetPlayerPosition());
        }
Exemplo n.º 2
0
        public XmasCandyBar(Boss boss, CustomSpriterAnimator animator)
        {
            _boss     = boss;
            _animator = animator;

            _animator.Progress           = 0;
            _animator.Speed              = 1;
            _animator.AnimationFinished += AnimationFinishedHandler;

            _boundingBox = new SpriterCollisionConvexPolygon(this, "body2.png");
            _boss.AddHitBox(_boundingBox);

            _animator.Play("StretchInBorderMoving");
        }
Exemplo n.º 3
0
        public override void Start()
        {
            Boss.CurrentAnimator.StretchOut = true;
            Boss.ClearHitBoxes();

            Boss.AddHitBox(new SpriterCollisionCircle(Boss, "body4.png", new Vector2(1800f, 0f), 0.2f));
            Boss.AddHitBox(new SpriterCollisionCircle(Boss, "body4.png", new Vector2(1600f, 800f), 0.2f));
            Boss.AddHitBox(new SpriterCollisionCircle(Boss, "body4.png", new Vector2(1100f, 1400f), 0.2f));
            Boss.AddHitBox(new SpriterCollisionCircle(Boss, "body4.png", new Vector2(400f, 1800f), 0.2f));

            Boss.AddHitBox(new SpriterCollisionCircle(Boss, "body4.png", new Vector2(1800f, 0f), 0.2f));
            Boss.AddHitBox(new SpriterCollisionCircle(Boss, "body4.png", new Vector2(1600f, -800f), 0.2f));
            Boss.AddHitBox(new SpriterCollisionCircle(Boss, "body4.png", new Vector2(1100f, -1400f), 0.2f));
            Boss.AddHitBox(new SpriterCollisionCircle(Boss, "body4.png", new Vector2(400f, -1800f), 0.2f));

            Boss.AddHitBox(new SpriterCollisionCircle(Boss, "body4.png", new Vector2(-1800f, 0f), 0.2f));
            Boss.AddHitBox(new SpriterCollisionCircle(Boss, "body4.png", new Vector2(-1600f, 800f), 0.2f));
            Boss.AddHitBox(new SpriterCollisionCircle(Boss, "body4.png", new Vector2(-1100f, 1400f), 0.2f));
            Boss.AddHitBox(new SpriterCollisionCircle(Boss, "body4.png", new Vector2(-400f, 1800f), 0.2f));

            Boss.AddHitBox(new SpriterCollisionCircle(Boss, "body4.png", new Vector2(-1800f, 0f), 0.2f));
            Boss.AddHitBox(new SpriterCollisionCircle(Boss, "body4.png", new Vector2(-1600f, -800f), 0.2f));
            Boss.AddHitBox(new SpriterCollisionCircle(Boss, "body4.png", new Vector2(-1100f, -1400f), 0.2f));
            Boss.AddHitBox(new SpriterCollisionCircle(Boss, "body4.png", new Vector2(-400f, -1800f), 0.2f));

            Boss.CurrentAnimator.Scale = new Vector2(1f);

            base.Start();

            Boss.Speed = GameConfig.BossDefaultSpeed * 0.5f;
            Boss.CurrentAnimator.AnimationFinished += AnimationFinishedHandler;
            Boss.CurrentAnimator.Play("CircleAppears");
            Boss.CurrentAnimator.Speed = _maxRotationSpeed;

            Boss.Position(Boss.GetPlayerPosition());

            Boss.StartShootTimer     = false;
            Boss.ShootTimerTime      = _maxShootTimeFrequence;
            Boss.ShootTimerFinished += ShootTimerFinished;
        }