Example #1
0
        public override void FireSecondary()
        {
            int numShots = _roundsLoaded;

            _roundsLoaded = 0;
            _isReloading  = true;
            _tick         = _weaponDef.magazineReloadTime;
            int numPellets = _weaponDef.primaryPrjCount * numShots;

            Console.WriteLine($"Fire {numShots} shots ({numPellets} pellets)");

            Transform t = _launchNode.GlobalTransform;

            // fill all angles, although we may be using less anyway.
            ZqfGodotUtils.FillSpreadAngles(t, _secondarySpread, 2000, 1200);
            for (int i = 0; i < numPellets; ++i)
            {
                PointProjectile prj = Main.i.factory.SpawnProjectile(_secondaryPrjDef.prefabPath);
                if (prj == null)
                {
                    Console.WriteLine($"Got no prj instance"); return;
                }
                prj.Launch(t.origin, _secondarySpread[i], _secondaryPrjDef, _ignoreBody);
                _tick = _weaponDef.secondaryRefireTime;
            }
        }
Example #2
0
        virtual public void FirePrimary()
        {
            if (_primaryPrjDef == null)
            {
                return;
            }
            Transform t = _launchNode.GlobalTransform;

            ZqfGodotUtils.FillSpreadAngles(t, _primarySpread, 2000, 1200);
            for (int i = 0; i < _primarySpread.Count; ++i)
            {
                PointProjectile prj = Main.i.factory.SpawnProjectile(_primaryPrjDef.prefabPath);
                if (prj == null)
                {
                    Console.WriteLine($"Got no prj instance"); return;
                }
                //prj.Launch(_launchNode.GlobalTransform, _primaryPrjDef, _ignoreBody);

                prj.Launch(t.origin, _primarySpread[i], _primaryPrjDef, _ignoreBody);
                _tick = _weaponDef.primaryRefireTime;
            }
        }
Example #3
0
        virtual public void FireSecondary(AttackSource src)
        {
            if (_secondaryPrjDef == null)
            {
                return;
            }
            Transform t = _launchNode.GlobalTransform;

            ZqfGodotUtils.FillSpreadAngles(
                t, _secondarySpread, _weaponDef.secondarySpread.x, _weaponDef.secondarySpread.y);
            for (int i = 0; i < _secondarySpread.Count; ++i)
            {
                PointProjectile prj = Main.i.factory.SpawnProjectile(_secondaryPrjDef.prefabPath);
                if (prj == null)
                {
                    Console.WriteLine($"Got no prj instance"); return;
                }
                //prj.Launch(_launchNode.GlobalTransform, _primaryPrjDef, _ignoreBody);

                prj.Launch(t.origin, _secondarySpread[i], _secondaryPrjDef, src.ignoreBody, src.team);
                _tick        = _weaponDef.secondaryRefireTime;
                _lastTickMax = _tick;
            }
        }