예제 #1
0
        public Boss(IMotion motion, BossGun topGun, BossGun middleGun, BossGun bottomGun)
            : base(motion)
        {
            ShooterLevel      level    = ShooterLevel.Current;
            AnimationSequence sequence = new AnimationSequence();

            sequence.AddSprites(new ImageElement[] {
                level.LoadImage("images/shooter/boss/boss.png", false)
            }, 0, 133);
            sequence.Delay = 200;
            sequence.Loop  = true;
            AnimationSequences[DefaultAnimation] = sequence;

            _topGun    = topGun;
            _middleGun = middleGun;
            _bottomGun = bottomGun;

            sequence = new AnimationSequence();
            sequence.AddSprites(new ImageElement[] {
                level.LoadImage("images/shooter/boss/boss.png", false)
            }, 0, 133);
            sequence.Delay = 500;
            sequence.Loop  = true;
            AnimationSequences[ExplosionAnimation] = sequence;

            StartAnimation(DefaultAnimation);

            Life = 300;
        }
예제 #2
0
        public Boss(IMotion motion, BossGun topGun, BossGun middleGun, BossGun bottomGun)
            : base(motion)
        {
            ShooterLevel level = ShooterLevel.Current;
            AnimationSequence sequence = new AnimationSequence();
            sequence.AddSprites(new ImageElement[]{
                    level.LoadImage("images/shooter/boss/boss.png", false)
                }, 0, 133);
            sequence.Delay = 200;
            sequence.Loop = true;
            AnimationSequences[DefaultAnimation] = sequence;

            _topGun = topGun;
            _middleGun = middleGun;
            _bottomGun = bottomGun;

            sequence = new AnimationSequence();
            sequence.AddSprites(new ImageElement[]{
                    level.LoadImage("images/shooter/boss/boss.png", false)
                }, 0, 133);
            sequence.Delay = 500;
            sequence.Loop = true;
            AnimationSequences[ExplosionAnimation] = sequence;

            StartAnimation(DefaultAnimation);

            Life = 300;
        }
예제 #3
0
 public override void Init(Scene level)
 {
     _dinos = new List <Dino>();
     _level = (ShooterLevel)level;
     BigSaucer.PreloadImages();
     Pteranodon.PreloadImages();
     Gun.PreloadImages();
     Boss.PreloadImages();
     BossGun.PreloadImages();
 }
예제 #4
0
        public override void Load()
        {
            int position = 1000;

            while (position < _length)
            {
                if (_dinos.Count * (100 - position * 50 / _length) < position)
                {
                    float pick = Math.Random() * 100;

                    if (pick < 45)
                    {
                        float altitude = _level.Buildings.GunEmplacement(position - 5, position + 5);

                        Gun gun = new Gun(new StraightMotion(new Vector2D(0, 0)));
                        gun.Location = new Vector3D(position, altitude + 5, ShooterLevel.GunZ);
                        gun.KilledEvent += _killedEventHandler;
                        _dinos.Add(gun);
                    }
                    else if (pick < 80)
                    {
                        float altitude = 50 + Math.Random() * (_level.Buildings.MaxAltitude(position - 600, position) - 100);

                        for (int i = 0; i < 4; i++)
                        {
                            Pteranodon pteranodon = new Pteranodon(new SineMotion(-0.1f, altitude, 0.05f, 15));
                            pteranodon.Location = new Vector3D(position + i * 25, 0, ShooterLevel.DinosZ);
                            pteranodon.KilledEvent += _killedEventHandler;
                            _dinos.Add(pteranodon);
                        }
                    }
                    else
                    {
                        float altitude = 50 + Math.Random() * (_level.Buildings.MaxAltitude(position - 600, position) - 100);

                        BigSaucer saucer = new BigSaucer(new StraightMotion(new Vector2D(-0.05f, 0)));
                        saucer.Location = new Vector3D(position, altitude, ShooterLevel.DinosZ);
                        saucer.KilledEvent += _killedEventHandler;
                        _dinos.Add(saucer);
                    }
                }

                position += 100;
            }

            BossGun topGun = new BossGun(null);
            topGun.Location.Z--;
            _dinos.Add(topGun);

            BossGun bottomGum = new BossGun(null);
            bottomGum.StartAnimation("Gun2");
            bottomGum.Location.Z--;
            _dinos.Add(bottomGum);

            BossGun middleGun = new BossGun(null);
            middleGun.StartAnimation("Gun3");
            middleGun.Location.Z--;
            _dinos.Add(middleGun);

            Boss boss = new Boss(new TimeIndexedSineMotion(-0.05f, 300, 0.0005f, 80), topGun, middleGun, bottomGum);
            boss.Location = new Vector3D(position, 300, ShooterLevel.DinosZ);
            boss.KilledEvent += _killedEventHandler;
            _dinos.Add(boss);
        }
예제 #5
0
        public override void Update()
        {
            base.Update();

            if (_explosions != null)
            {
                foreach (GameObject gameObject in _explosions)
                {
                    gameObject.Update();
                }
            }

            if (Dead && !_dead)
            {
                _dead = true;
                TimeIndexedSineMotion motion = (TimeIndexedSineMotion)Motion;
                motion.Amplitude = 0;
                _explosions      = new List <GameObject>();
                for (int i = 0; i < 10; i++)
                {
                    Explosion explosion = new Explosion();
                    explosion.Location = new Vector3D(Location.X + Math.Random() * 300, Location.Y - 133 + Math.Random() * 266, 10);
                    _explosions.Add(explosion);
                }

                ShooterLevel.Current.Win();
            }

            if (Dead)
            {
                return;
            }

            if (Location.X <= 500)
            {
                TimeIndexedSineMotion motion = (TimeIndexedSineMotion)Motion;
                motion.Speed = ShooterLevel.Current.BaseSpeed;
            }

            if (_topGun != null)
            {
                _topGun.Location.X = Location.X + 220;
                _topGun.Location.Y = Location.Y - 132;

                if (_topGun.Dead)
                {
                    _topGun = null;
                }
            }

            if (_bottomGun != null)
            {
                _bottomGun.Location.X = Location.X + 220;
                _bottomGun.Location.Y = Location.Y + 132;

                if (_bottomGun.Dead)
                {
                    _bottomGun = null;
                }
            }

            if (_middleGun != null)
            {
                _middleGun.Location.X = Location.X + 4;
                _middleGun.Location.Y = Location.Y;

                if (_middleGun.Dead)
                {
                    _middleGun = null;
                }
            }

            if (_topGun == null && _middleGun == null && _bottomGun == null)
            {
                ShooterLevel level = ShooterLevel.Current;
                if (!Dead && level.Ticks >= _lastShot + FireRate)
                {
                    _lastShot = level.Ticks;

                    new BasicPlasmaBall(Location, new StraightMotion(new Vector2D(Math.Random() * -0.1f, 0.05f - Math.Random() * 0.1f)));
                    new BasicPlasmaBall(Location, new StraightMotion(new Vector2D(Math.Random() * -0.1f, 0.05f - Math.Random() * 0.1f)));
                    new BasicPlasmaBall(Location, new StraightMotion(new Vector2D(Math.Random() * -0.1f, 0.05f - Math.Random() * 0.1f)));
                }
            }
            else
            {
                Life = 300;
            }
        }
예제 #6
0
        public override void Load()
        {
            int position = 1000;

            while (position < _length)
            {
                if (_dinos.Count * (100 - position * 50 / _length) < position)
                {
                    float pick = Math.Random() * 100;

                    if (pick < 45)
                    {
                        float altitude = _level.Buildings.GunEmplacement(position - 5, position + 5);

                        Gun gun = new Gun(new StraightMotion(new Vector2D(0, 0)));
                        gun.Location     = new Vector3D(position, altitude + 5, ShooterLevel.GunZ);
                        gun.KilledEvent += _killedEventHandler;
                        _dinos.Add(gun);
                    }
                    else if (pick < 80)
                    {
                        float altitude = 50 + Math.Random() * (_level.Buildings.MaxAltitude(position - 600, position) - 100);

                        for (int i = 0; i < 4; i++)
                        {
                            Pteranodon pteranodon = new Pteranodon(new SineMotion(-0.1f, altitude, 0.05f, 15));
                            pteranodon.Location     = new Vector3D(position + i * 25, 0, ShooterLevel.DinosZ);
                            pteranodon.KilledEvent += _killedEventHandler;
                            _dinos.Add(pteranodon);
                        }
                    }
                    else
                    {
                        float altitude = 50 + Math.Random() * (_level.Buildings.MaxAltitude(position - 600, position) - 100);

                        BigSaucer saucer = new BigSaucer(new StraightMotion(new Vector2D(-0.05f, 0)));
                        saucer.Location     = new Vector3D(position, altitude, ShooterLevel.DinosZ);
                        saucer.KilledEvent += _killedEventHandler;
                        _dinos.Add(saucer);
                    }
                }

                position += 100;
            }

            BossGun topGun = new BossGun(null);

            topGun.Location.Z--;
            _dinos.Add(topGun);

            BossGun bottomGum = new BossGun(null);

            bottomGum.StartAnimation("Gun2");
            bottomGum.Location.Z--;
            _dinos.Add(bottomGum);

            BossGun middleGun = new BossGun(null);

            middleGun.StartAnimation("Gun3");
            middleGun.Location.Z--;
            _dinos.Add(middleGun);

            Boss boss = new Boss(new TimeIndexedSineMotion(-0.05f, 300, 0.0005f, 80), topGun, middleGun, bottomGum);

            boss.Location     = new Vector3D(position, 300, ShooterLevel.DinosZ);
            boss.KilledEvent += _killedEventHandler;
            _dinos.Add(boss);
        }
예제 #7
0
        public override void Update()
        {
            base.Update();

            if (_explosions != null) foreach (GameObject gameObject in _explosions) gameObject.Update();

            if (Dead && !_dead)
            {
                _dead = true;
                TimeIndexedSineMotion motion = (TimeIndexedSineMotion)Motion;
                motion.Amplitude = 0;
                _explosions = new List<GameObject>();
                for (int i = 0; i < 10; i++)
                {
                    Explosion explosion = new Explosion();
                    explosion.Location = new Vector3D(Location.X + Math.Random() * 300, Location.Y - 133 + Math.Random() * 266, 10);
                    _explosions.Add(explosion);
                }

                ShooterLevel.Current.Win();
            }

            if (Dead) return;

            if (Location.X <= 500)
            {
                TimeIndexedSineMotion motion = (TimeIndexedSineMotion)Motion;
                motion.Speed = ShooterLevel.Current.BaseSpeed;
            }

            if (_topGun != null)
            {
                _topGun.Location.X = Location.X + 220;
                _topGun.Location.Y = Location.Y - 132;

                if (_topGun.Dead) _topGun = null;
            }

            if (_bottomGun != null)
            {
                _bottomGun.Location.X = Location.X + 220;
                _bottomGun.Location.Y = Location.Y + 132;

                if (_bottomGun.Dead) _bottomGun = null;
            }

            if (_middleGun != null)
            {
                _middleGun.Location.X = Location.X + 4;
                _middleGun.Location.Y = Location.Y;

                if (_middleGun.Dead) _middleGun = null;
            }

            if (_topGun == null && _middleGun == null && _bottomGun == null)
            {
                ShooterLevel level = ShooterLevel.Current;
                if (!Dead && level.Ticks >= _lastShot + FireRate)
                {
                    _lastShot = level.Ticks;

                    new BasicPlasmaBall(Location, new StraightMotion(new Vector2D(Math.Random() * -0.1f, 0.05f - Math.Random() * 0.1f)));
                    new BasicPlasmaBall(Location, new StraightMotion(new Vector2D(Math.Random() * -0.1f, 0.05f - Math.Random() * 0.1f)));
                    new BasicPlasmaBall(Location, new StraightMotion(new Vector2D(Math.Random() * -0.1f, 0.05f - Math.Random() * 0.1f)));
                }
            }
            else Life = 300;
        }