public override void Update(int t)
        {
            var world = The.World;

            _angle = XY.DirectionAngle(_p, The.Player.Position);
            _r     = XY.Distance(_p, The.Player.Position);
            for (int i = 0; i < 8; i++)
            {
                world.Spawn(
                    new DeathRay(
                        _p,
                        0 + Mathf.PI / _danmakuInterval * t + Mathf.PI / 4 * i,
                        3,
                        Color.Red
                        )
                    );
            }
            if (t % 6 == 0)
            {
                for (int i = 0; i < 8; i++)
                {
                    The.World.Spawn(
                        new FadePetalBullet(
                            new XY(_p.X + Mathf.Cos(Mathf.PI / _danmakuInterval * t + i * Mathf.PI / 4) * _r, _p.Y + Mathf.Sin(Mathf.PI / _danmakuInterval * t + i * Mathf.PI / 4) * _r),
                            XY.DirectionAngle(_p, new XY(_p.X + Mathf.Cos(Mathf.PI / _danmakuInterval * t + i * Mathf.PI / 4) * _r, _p.Y + Mathf.Sin(Mathf.PI / _danmakuInterval * t + i * Mathf.PI / 4) * _r)),
                            Color.Red,
                            Mathf.PI / 4 / (Mathf.PI / _danmakuInterval)
                            )
                        );
                }
            }
        }
Esempio n. 2
0
        public DelayedExplosin()
        {
            var world = _.World;

            for (int i = 0; i < _n; i++)
            {
                coordinate[i] = new XY(-9000, -9000);
            }

            for (int i = 0; i < _n; i++)
            {
                bool g        = false;
                int  attempts = 0;
                while (g == false && attempts < 25)
                {
                    var a = _.Random.Point(World.Box);
                    g = Check(a, i);
                    attempts++;
                }
            }

            for (int j = 0; j < _n; j++)
            {
                world.Spawn(new DDEBullet(_.Player.Position,
                                          new XY(XY.DirectionAngle(_.Player.Position,
                                                                   coordinate[j])).WithLength(XY.Distance(_.Player.Position, coordinate[j])) / 60));
            }
        }
        public ExplosiveRocket(XY p0, int tExplosion, XY target, Color color)
        {
            _p          = _p0 = p0;
            _tExplosion = tExplosion;
//            _v          = (target - p0).WithLength (v);
            _target = target;
//            _tExplosion = Mathf.CeilToInt ((target - p0).Length / v);
            _smokeColor = (_color = color) * 0.2f;
            _rotation   = XY.DirectionAngle(_p0, _target);
        }
        protected override void Update(int t)
        {
            if (t < _t)
            {
                P = _p + _v * t;
            }
            if (t == _t)
            {
                _p = new XY(P.X, P.Y + 100);
                P  = new XY(_p.X, _p.Y - 100);
            }
            if (t > _t)
            {
                P = new XY(
                    _p.X + 100 * Mathf.Cos(-Mathf.PI / 2 - (t - _t) * Mathf.PI / _spindelay) * _side,
                    _p.Y + 100 * Mathf.Sin(-Mathf.PI / 2 - (t - _t) * Mathf.PI / _spindelay * _side)
                    );
            }

            if (t == _t + _spindelay)
            {
                _p = new XY(P.X, P.Y);
                P  = _p;
            }
            if (t > _t + _spindelay)
            {
                P = _p - _v * (t - _t - _spindelay);
            }

            if (_shoot && t % _.Difficulty.Choose(120, 60, 45, 45) == 0)
            {
                _.World.Spawn(
                    new LinearPetalBullet(
                        P,
                        _.Difficulty.Choose(2f, 2f, 3f, 4f) * new XY(XY.DirectionAngle(P, _.Player.Position)),
                        Color.Red,
                        Color.Orange,
                        3f
                        )
                    );
            }

            if (_shoot == false && _.Difficulty >= Difficulty.Hard &&
                t % _.Difficulty.Choose(9999, 9999, 180, 120) == 0)
            {
                AlternateShoot(t);
            }
            if (t > 30 && !Geom.CircleOverBox(new Circle(P, 10 + 2), World.Box))
            {
                Despawn();
            }
        }