Esempio n. 1
0
        public void Start()
        {
            Timer = new Timer();
            Timer.AutoReset = false;
            Timer.Elapsed += OnEnd;

            Timer.Interval = 10000;
            switch (Type)
            {
                case DOUBLE_EXPLOSION_RADIUS:
                {
                    Cannon.Weapon.ExplosionRadius *= 2;
                    Cannon.AimAssistance.UpdateReticle();
                    Cannon.AimAssistance.UpdateReticlePosition();
                    foreach (AimAssistance a in Cannon.AimAssistanceExtras)
                    {
                        a.UpdateReticle();
                        a.UpdateReticlePosition();
                    }
                    break;
                }
                case AIM_SPEED_INCREASE:
                {
                    Cannon.AimSpeed *= 1.5f;
                    Cannon.RotateSpeedMax *= 1.5f;
                    Cannon.RotateAcc *= 3f;
                    Cannon.RotationDelayTimer.Interval /= 2f;

                    Timer.Interval = 20000;
                    break;
                }
                case TRIPLE_CANNON:
                case OCTUPLE_CANNON:
                {
                    int amount = Type == TRIPLE_CANNON ? 3 : 8;
                    for (int b = 1; b < amount; b++)
                    {
                        var barrel = new Sprite(((Sprite)Cannon.Model).Texture);
                        barrel.Scale = new Vector2f(0.5f, 0.5f);
                        barrel.Origin = new Vector2f(26, 30);
                        if (amount == 3)
                            barrel.Rotation = b == 1 ? 45 : -45;
                        else
                            barrel.Rotation = 45 * b;
                        Cannon.PowerupEffect.AddChild(barrel);

                        var aa = new AimAssistance(Game, Cannon);
                        aa.Position = Cannon.Position;
                        aa.RotationOffset = barrel.Rotation;
                        Game.Layer_OtherAbove.AddChildAt(aa, 0);
                        Cannon.AimAssistanceExtras.Add(aa);

                        if (Cannon.AimAssistance.IsAiming())
                        {
                            aa.AimStart();
                            aa.SetReticlePosition(Cannon.AimAssistance.GetReticlePosition());
                        }
                    }
                    break;
                }
            }

            Game.HUD.AddPowerup(Type, Timer.Interval);

            Timer.Start();
        }
Esempio n. 2
0
        public override void OnAdded()
        {
            base.OnAdded();

            AimAssistance = new AimAssistance(Game, this);
            AimAssistance.SetPosition(Position);
            Game.Layer_OtherAbove.AddChildAt(AimAssistance, 0);
        }