コード例 #1
0
ファイル: BasicLighting.cs プロジェクト: BlueBananasaurus/BP
        public bool Fire(LineSegmentF rayEnlonged, Vector2Object destination)
        {
            if ((Ammo > 0 && GunTimer.Ready == true) || MaxAmmo == 0)
            {
                Vector2 barrel = rayEnlonged.Start + rayEnlonged.NormalizedWithZeroSolution() * GunBarrel;
                Game1.soundElectro.Play(1f, (float)(Globals.GlobalRandom.NextDouble()) / 2f, 0f);
                Ammo--;

                fireRay(barrel, destination);

                if (Owner is Player)
                {
                    for (int i = 0; i < 3; i++)
                    {
                        Game1.mapLive.mapLightings.Add(new Lightning(barrel, destination.Vector2, Game1.Textures["Lightning"], 16, -1));
                    }
                    for (int i = 0; i < 1; i++)
                    {
                        Game1.mapLive.mapLightings.Add(new Lightning(barrel, destination.Vector2, Game1.Textures["LightningBig"], 16, -1));
                    }
                    for (int i = 0; i < 1; i++)
                    {
                        Game1.mapLive.mapLightings.Add(new Lightning(barrel, destination.Vector2, Game1.Textures["lightningChain"], 16, -3, 3f));
                    }
                }

                GunTimer.Reset();

                return(true);
            }

            return(false);
        }
コード例 #2
0
    private void _on_Timer_timeout()
    {
        GD.Print("fire");
        Position2D muzzle = (Position2D)GetNode("Body/Muzzle");

        ShootGun(muzzle);
        GunTimer.Start();
    }
コード例 #3
0
 public void Update()
 {
     GunTimer.Update();
     if (_muzzleAlpha > 0)
     {
         _muzzleAlpha -= Game1.Delta / 50;
     }
     CompareF.DecreaseToZero(ref OffsetKick, 1f);
 }
コード例 #4
0
 private void _on_DetectRadius_body_entered(Godot.Object body)
 {
     if (body is KinematicBody2D player)
     {
         if (player.Name == "TestTankPlayer")
         {
             GunTimer.Start();
             Target = player;
         }
     }
 }
コード例 #5
0
ファイル: Simple.cs プロジェクト: BlueBananasaurus/BP
        public bool Fire(LineSegmentF rayEnlonged, Vector2Object destination)
        {
            Vector2 barrel = rayEnlonged.Start + rayEnlonged.NormalizedWithZeroSolution() * GunBarrel;

            if (GunTimer.Ready == true)
            {
                Sound.PlaySoundSimple(Game1.sound, 1f, (float)(Globals.GlobalRandom.NextDouble() - 0.5f) / 2f, 0f);
                GunTimer.Reset();
                Game1.mapLive.MapProjectiles.Add(new Projectile((short)(Damage + OwnerGun.DamagePlus), CompareF.RotateVector2(rayEnlonged.NormalizedWithZeroSolution(), (float)((Globals.GlobalRandom.NextDouble() - 0.5f) * (Dispersion + OwnerGun.DispersionPlus))) * (VelocityOfProjectile + OwnerGun.VelocityOfProjectile), barrel, Owner));
                return(true);
            }
            return(false);
        }
コード例 #6
0
    public override void _Ready()
    {
        _parent  = GetParent();
        GunTimer = (Timer)GetNode("Timer");
        GunTimer.Start();
        var circle = new CircleShape2D();

        circle.Radius = DetectRadius;
        var radius = (CollisionShape2D)GetNode("DetectRadius/CollisionShape2D");

        radius.Shape = circle;
        _enemyTurret = (Sprite)GetNode("Turret");
    }
コード例 #7
0
        public bool Fire(LineSegmentF rayEnlonged, Vector2Object destination)
        {
            Vector2 barrel = rayEnlonged.Start + rayEnlonged.NormalizedWithZeroSolution() * GunBarrel;

            if (GunTimer.Ready == true)
            {
                Game1.sound.Play(1f, (float)(Globals.GlobalRandom.NextDouble() - 0.5f) / 2f, 0f);
                GunTimer.Reset();
                Game1.mapLive.MapProjectiles.Add(new Projectile(Damage, rayEnlonged.NormalizedWithZeroSolution() * VelocityOfProjectile, barrel, Owner));
                return(true);
            }
            return(false);
        }
コード例 #8
0
ファイル: EnergyLaucher.cs プロジェクト: BlueBananasaurus/BP
        public bool Fire(LineSegmentF rayEnlonged, Vector2Object destination)
        {
            Vector2 barrel = rayEnlonged.Start + rayEnlonged.NormalizedWithZeroSolution() * GunBarrel;

            if (Ammo > 0 && GunTimer.Ready == true)
            {
                Sound.PlaySoundSimple(Game1.soundVortex, (float)((1f / 2f) + Globals.GlobalRandom.NextDouble() / 2f), (float)(Globals.GlobalRandom.NextDouble() - 0.5f) / 2f, 0f);
                Ammo--;
                GunTimer.Reset();
                Game1.mapLive.MapProjectiles.Add(new EnergyBall(rayEnlonged.NormalizedWithZeroSolution() * VelocityOfProjectile, barrel, Owner, Damage));
                Kick(4);
                return(true);
            }
            return(false);
        }
コード例 #9
0
ファイル: FlameThrower.cs プロジェクト: BlueBananasaurus/BP
        public bool Fire(LineSegmentF rayEnlonged, Vector2Object destination)
        {
            Vector2 barrel = rayEnlonged.Start + rayEnlonged.NormalizedWithZeroSolution() * GunBarrel;

            if (Ammo > 0 && GunTimer.Ready == true)
            {
                Game1.soundFlamb.Play((float)((1f / 2f) + Globals.GlobalRandom.NextDouble() / 2f), (float)(Globals.GlobalRandom.NextDouble() - 0.5f) / 2f, 0f);
                GunTimer.Reset();
                Game1.mapLive.MapProjectiles.Add(new FlameProjectile(rayEnlonged.NormalizedWithZeroSolution() * VelocityOfProjectile, barrel, Owner, 16));
                _muzzleAlpha = 1f;
                Ammo--;
                return(true);
            }
            return(false);
        }
コード例 #10
0
ファイル: RocketLauncher.cs プロジェクト: BlueBananasaurus/BP
        public bool Fire(LineSegmentF rayEnlonged, Vector2Object destination)
        {
            Vector2 barrel = rayEnlonged.Start + rayEnlonged.NormalizedWithZeroSolution() * GunBarrel;

            if (Ammo > 0 && GunTimer.Ready == true)
            {
                Ammo--;
                GunTimer.Reset();
                Game1.mapLive.MapProjectiles.Add(new Rocket(rayEnlonged.NormalizedWithZeroSolution() * VelocityOfProjectile, barrel, Owner, 64));
                _muzzleAlpha = 1;
                Kick(8);
                return(true);
            }
            return(false);
        }
コード例 #11
0
        public bool Fire(LineSegmentF rayEnlonged, Vector2Object destination)
        {
            Vector2 barrel = rayEnlonged.Start + rayEnlonged.NormalizedWithZeroSolution() * GunBarrel;

            if (destination != null && destination != null)
            {
                if (Owner is Player)
                {
                    _line = new LineSegmentF(rayEnlonged.Start, destination.Vector2);
                }
                if (Owner is Inpc)
                {
                    _line = new LineSegmentF((Owner as Inpc).Boundary.Origin, destination.Vector2);
                }
            }

            _rotation = rayEnlonged.ToAngle();

            if ((Ammo > 0 && GunTimer.Ready == true) || MaxAmmo == 0)
            {
                Ammo--;
                SetOn();
                fireRay(barrel, destination);

                GunTimer.Reset();

                if (destination != null && destination != null)
                {
                    if (Owner is Player)
                    {
                    }
                    if (Owner is Inpc)
                    {
                        //Game1.PlayerIns.Push(LineSegmentF.SegmentToNormalizedVector((Owner as Enemy).Ray) * 0.02f);
                    }
                }

                return(true);
            }

            return(false);
        }
コード例 #12
0
 public override void _Process(float delta)
 {
     base._Process(delta);
     if (Target != null)
     {
         Vector2 targetDir  = (Target.GlobalPosition - GlobalPosition).Normalized();
         Vector2 currentDir = new Vector2(1, 0).Rotated(EnemyTurret.GlobalRotation);
         EnemyTurret.GlobalRotation = currentDir.LinearInterpolate(targetDir, 75 * delta).Angle();
         if (targetDir.Dot(currentDir) > 0.9)
         {
             if (CanShoot)
             {
                 GD.Print("fire");
                 Position2D muzzle = (Position2D)GetNode("Turret/Muzzle");
                 ShootGun(muzzle);
                 GunTimer.Start();
                 CanShoot = false;
             }
         }
     }
 }
コード例 #13
0
 public void Update()
 {
     GunTimer.Update();
     CompareF.DecreaseToZero(ref OffsetKick, 1f);
 }
コード例 #14
0
ファイル: Shotgun.cs プロジェクト: BlueBananasaurus/BP
 public void Update()
 {
     GunTimer.Update();
 }
コード例 #15
0
 public override void _Ready()
 {
     Parent   = GetParent();
     GunTimer = (Timer)GetNode("Timer");
     GunTimer.Start();
 }
コード例 #16
0
 private void _on_Timer_timeout()
 {
     GunTimer.Start();
     CanShoot = true;
 }