public void Constructor_OptionalParameters()
        {
            var x = new Rifle(model: "FAMAS");
            x.Output();

            var y = new Rifle();
            y.Output();

            // Infinite Loop do NOT comment this in!!
            //GetAttackPower();
        }
Esempio n. 2
0
        public string AddGun(string type, string name, int bulletsCount)
        {
            IGun gun;

            if (type == "Pistol")
            {
                gun = new Pistol(name, bulletsCount);
            }
            else if (type == "Rifle")
            {
                gun = new Rifle(name, bulletsCount);
            }
            else
            {
                throw new ArgumentException("Invalid gun type!");
            }

            gunRepository.Add(gun);

            return($"Successfully added gun {gun.Name}.");
        }
Esempio n. 3
0
        public string AddGun(string type, string name, int bulletsCount)
        {
            IGun gun;

            if (type == "Pistol")
            {
                gun = new Pistol(name, bulletsCount);
            }
            else if (type == "Rifle")
            {
                gun = new Rifle(name, bulletsCount);
            }
            else
            {
                throw new ArgumentException(ExceptionMessages.InvalidGunType);
            }

            this.guns.Add(gun);

            return($"Successfully added gun {gun.Name}.");
        }
Esempio n. 4
0
        public string AddGun(string type, string name, int bulletsCount)
        {
            IGun gun;

            if (type == nameof(Pistol))
            {
                gun = new Pistol(name, bulletsCount);
            }
            else if (type == nameof(Rifle))
            {
                gun = new Rifle(name, bulletsCount);
            }
            else
            {
                throw new ArgumentException(ExceptionMessages.InvalidGunType);
            }

            guns.Add(gun);

            return(string.Format(OutputMessages.SuccessfullyAddedGun, name));
        }
Esempio n. 5
0
        public string AddGun(string type, string name, int bulletsCount)
        {
            if (type != "Pistol" && type != "Rifle")
            {
                throw new ArgumentException(ExceptionMessages.InvalidGunType);
            }

            IGun gun;

            if (type == "Pistol")
            {
                gun = new Pistol(name, bulletsCount);
            }
            else
            {
                gun = new Rifle(name, bulletsCount);
            }

            this.guns.Add(gun);
            return(string.Format(OutputMessages.SuccessfullyAddedGun, name));
        }
        public string AddGun(string type, string name)
        {
            IGun gun;

            if (type == "Pistol")
            {
                gun = new Pistol(name);
            }
            else if (type == "Rifle")
            {
                gun = new Rifle(name);
            }
            else
            {
                return("Invalid gun type!");
            }

            this.guns.Add(gun);

            return($"Successfully added {name} of type: {type}");
        }
Esempio n. 7
0
        public string AddGun(string type, string name)
        {
            IGun gun = null;

            if (type == "Pistol")
            {
                gun = new Pistol(name);
            }
            else if (type == "Rifle")
            {
                gun = new Rifle(name);
            }
            else
            {
                return("Invalid gun type!");
            }

            this.gunRepository.Add(gun);

            return($"Successfully added {gun.Name} of type: {gun.GetType().Name}");
        }
Esempio n. 8
0
        public string AddGun(string type, string name)
        {
            if (type != "Pistol" && type != "Rifle")
            {
                return("Invalid gun type!");
            }

            if (type == "Pistol")
            {
                Pistol gun = new Pistol(name);
                this.gunRepository.Add(gun);
            }

            if (type == "Rifle")
            {
                Rifle gun = new Rifle(name);
                this.gunRepository.Add(gun);
            }

            return($"Successfully added {name} of type: {type}");
        }
Esempio n. 9
0
        public string AddGun(string type, string name)
        {
            if (type != "Rifle" && type != "Pistol")
            {
                return("Invalid gun type!");
            }

            if (type == "Rifle")
            {
                var riffle = new Rifle(name);
                this.gunRepository.Add(riffle);
            }

            else if (type == "Pistol")
            {
                var pistol = new Pistol(name);
                this.gunRepository.Add(pistol);
            }

            return($"Successfully added {name} of type: {type}");
        }
Esempio n. 10
0
        public string AddGun(string type, string name, int bulletsCount)
        {
            if (type == "Pistol")
            {
                Pistol pistol = new Pistol(name, bulletsCount);

                guns.Add(pistol);

                return(string.Format(OutputMessages.SuccessfullyAddedGun, name));
            }
            else if (type == "Rifle")
            {
                Rifle rifle = new Rifle(name, bulletsCount);

                guns.Add(rifle);

                return(string.Format(OutputMessages.SuccessfullyAddedGun, name));
            }

            throw new ArgumentException(ExceptionMessages.InvalidGunType);
        }
        public string AddGun(string type, string name)
        {
            if (type != "Pistol" && type != "Rifle")
            {
                return("Invalid gun type!");
            }

            IGun gun = null;

            if (type == "Pistol")
            {
                gun = new Pistol(name);
            }
            else
            {
                gun = new Rifle(name);
            }

            this.gunRepository.Enqueue(gun);

            return($"Successfully added {name} of type: {type}");
        }
Esempio n. 12
0
        static void Main(string[] args)
        {
            // IScenario scenario = new ConsoleScenario();
            // scenario.Setup();
            // scenario.Run();
            Elf elfo = new Elf("El Elfo");
            Wizard wizard = new Wizard("El Mago");
            Troll troll = new Troll("El Troll");

            Coraza coraza = new Coraza();
            Cuchillo cuchillo = new Cuchillo();
            Magic magic = new Magic();
            Martillo martillo = new Martillo();
            Palo palo = new Palo();
            Rifle rifle = new Rifle();
            RifleConCuchillo rifleConCuchillo = new RifleConCuchillo();
            Robes robes = new Robes();

            List<IGema> Gemas = new List<IGema>();
            Gemas.Add(new GemaAmarilla());
            Gemas.Add(new GemaCeleste());
            Gemas.Add(new GemaRoja());

            GuanteDePoder guanteDePoder  = new GuanteDePoder(Gemas);         

            elfo.AddItem(magic);
            elfo.AddItem(robes);
            wizard.AddItem(guanteDePoder);
            troll.AddItem(rifleConCuchillo);

            AttackEncounter attackEncounter = new AttackEncounter(elfo,wizard);
            ConsoleReporter consoleReporter = new ConsoleReporter();
            attackEncounter.Reporter = consoleReporter;
            attackEncounter.DoEncounter();
            AttackEncounter attackEncounter1 = new AttackEncounter(wizard, troll);
            attackEncounter1.Reporter = consoleReporter;
            attackEncounter1.DoEncounter();

        }
Esempio n. 13
0
    public void WeaponSelect()
    {
        switch (Weapon)
        {
        case ("Sniper"):

            Sniper newSniper = new Sniper(Name, FireRate, Range, GunEnd);
            break;

        case ("Rifle"):
            Rifle newRifle = new Rifle(Name, FireRate, Range, GunEnd);
            break;

        case ("SMG"):
            SMG newSMG = new SMG(Name, FireRate, Range, GunEnd);
            break;

        case ("Shotgun"):
            Shotgun newGun = new Shotgun(Name, FireRate, Range, GunEnd);
            break;
        }
    }
Esempio n. 14
0
 private IEnumerator fireSingleShotRifleRoutine(Rifle rifle)
 {
     if (rifle.loaded)
     {
         print("Bang!");
         RaycastHit raycastHit;
         Vector3    rayDirection;
         animalNoiseAlert(rifle.noiseDistance);
         rifle.loaded = false;
         if (rifle.aimed) //Add inaccuracy
         {
             rayDirection = new Vector3(Random.Range(-0.01f, 0.01f), Random.Range(-0.01f, 0.01f), 1);
         }
         else
         {
             rayDirection = new Vector3(Random.Range(-0.05f, 0.05f), Random.Range(-0.05f, 0.05f), 1);
         }
         rayDirection = playerCamera.transform.TransformDirection(rayDirection);
         Ray ray = new Ray(playerCamera.transform.position, rayDirection);
         if (Physics.Raycast(ray, out raycastHit))
         {
             Debug.DrawLine(playerCamera.transform.position, raycastHit.point, Color.red, 10);
             print("Hit: " + raycastHit.transform.name);
             if (raycastHit.collider.tag == "Animal")
             {
                 raycastHit.collider.transform.parent.gameObject.GetComponent <AnimalHealth>().dealDamage(rifle.damage);
             }
         }
         playerCamera.transform.GetChild(0).GetChild(0).GetChild(1).GetComponent <ParticleSystem>().Play();
         yield return(new WaitForSeconds(rifle.reloadTime));
     }
     else
     {
         print("click!");
         yield return(new WaitForSeconds(rifle.clickTime));
     }
     working = false;
 }
Esempio n. 15
0
        public void PlaceDifferentSetOfItemsOnGround()
        {
            var world = new World(11, 11);
            var items = new List <Item>();
            var knife = new Knife();

            knife.Count++;
            var bandage = new Bandage();

            bandage.Count += 4;
            items.Add(knife);
            items.Add(bandage);
            world.PlaceItem(items, new Point(0, 0));
            var drop     = new List <Item>();
            var sKnife   = new Knife();
            var sBandage = new Bandage();

            sBandage.Count++;
            var rifle = new Rifle();

            drop.Add(sKnife);
            drop.Add(sBandage);
            drop.Add(rifle);
            world.PlaceItem(drop, new Point(0, 0));
            var expected = new List <Item> {
                new Knife {
                    Count = 3
                }, new Bandage {
                    Count = 7
                }, new Rifle()
            };
            var actual = world.GroundItem[new Point(0, 0)];

            Assert.IsTrue(expected.Count == actual.Count &&
                          expected[0].Count == actual[0].Count &&
                          expected[1].Count == actual[1].Count &&
                          expected[2].Count == actual[2].Count);
        }
Esempio n. 16
0
    private void InitNewInventory()
    {
        AddColor(Colors.Blue);
        AddColor(Colors.Red);
        SetBulletColor(Colors.Blue);       // Weapon Index
        Weapon weap = new SingleShooter(); //....................1,0

        weap.Init(this, singleSocket);
        AddWeapon(weap);

        AddWeapon(weap);      //------------------------------------------singleShooter added twice.
        weap = new Shotgun(); //..................................2
        weap.Init(this, singleSocket);
        AddWeapon(weap);
        weap = new Rifle(); //....................................3
        weap.Init(this, singleSocket);
        AddWeapon(weap);
        weap = new TheMiddleFingerGun(); //.......................4
        weap.Init(this, singleSocket);
        AddWeapon(weap);
        weap = new TheEraser();//.................................5
        weap.Init(this, singleSocket);
        AddWeapon(weap);
        weap = new BurstShooter();//..............................6
        weap.Init(this, dualWieldSockets);
        AddWeapon(weap);

        weap = new MeleeMode();//..............................7
        weap.Init(this, dualWieldSockets);
        AddWeapon(weap);

        weap = new TripleSingleShooter();//.......................8
        weap.Init(this, singleSocket);
        AddWeapon(weap);
        weap = new LaserSurgeryGun();//...........................9
        weap.Init(this, singleSocket);
        AddWeapon(weap);
    }
Esempio n. 17
0
        public string AddGun(string type, string name, int bulletsCount)
        {
            if (!Enum.TryParse(type, out GunType gunType))
            {
                throw new ArgumentException(ExceptionMessages.InvalidGunType);
            }

            IGun gun = null;

            switch (gunType)
            {
            case GunType.Pistol:
                gun = new Pistol(name, bulletsCount);
                break;

            case GunType.Rifle:
                gun = new Rifle(name, bulletsCount);
                break;
            }
            _guns.Add(gun);

            return(string.Format(OutputMessages.SuccessfullyAddedGun, name));
        }
Esempio n. 18
0
        public object Create(params object[] info)
        {
            IGun gun = null;

            string gunType = info[0].ToString();
            string gunName = info[1].ToString();

            if (gunType == "Pistol")
            {
                gun = new Pistol(gunName);
            }

            else if (gunType == "Rifle")
            {
                gun = new Rifle(gunName);
            }
            else
            {
                throw new ArgumentException("Invalid gun type!");
            }

            return(gun);
        }
Esempio n. 19
0
    static void Main(string[] args)
    {
        IGun             playerGun;
        Rifle            rifle    = new Rifle();
        HolographicSight sight    = new HolographicSight();
        DotSight         dotSight = new DotSight();

        playerGun = rifle;     // Player mengambil Rifle
        playerGun.Reload();
        playerGun.Shoot();     // Shoot();
        Console.WriteLine("Ammo Left : {0}", rifle.Ammo);
        playerGun.FiringMode();
        playerGun.Shoot();     // Shoot();
        Console.WriteLine("Ammo Left : {0}", rifle.Ammo);

        rifle.Sight = sight;
        playerGun.Scope();
        rifle.Sight = dotSight;
        playerGun.Scope();
        playerGun.Shoot();

        Console.ReadKey();
    }
        public string AddGun(string type, string name)
        {
            IGun gun = null;

            switch (type)
            {
            case "Pistol":
                gun = new Pistol(name);
                break;

            case "Rifle":
                gun = new Rifle(name);
                break;
            }

            if (gun == null)
            {
                return($"Invalid gun type!");
            }

            this.guns.Add(gun);
            return($"Successfully added {name} of type: {type}");
        }
Esempio n. 21
0
        static void Main(string[] args)
        {
            IForceOrganization forceOrganization = new CounterTerrorism();
            Rifle rifle = new Rifle();

            Dot50Bmg dot50Bmg = new Dot50Bmg();

            dot50Bmg.BulletDiameter = 50;

            Dot38 dot38 = new Dot38();

            forceOrganization.Weapon = rifle;
            forceOrganization.Shoot(dot50Bmg);


            Pistol9mm pistol9mm = new Pistol9mm();
            _9mmLuger _9mmLuger = new _9mmLuger();

            _9mmLuger.Weight = 115;

            forceOrganization.Weapon = pistol9mm;
            forceOrganization.Shoot(_9mmLuger);
        }
Esempio n. 22
0
        public string AddGun(string type, string name, int bulletsCount)
        {
            IGun gun = null;

            switch (type)
            {
            case "Pistol":
                gun = new Pistol(name, bulletsCount);
                break;

            case "Rifle":
                gun = new Rifle(name, bulletsCount);
                break;

            default:
                throw new ArgumentException(ExceptionMessages.InvalidGunType);
                // exc message-a se razlichava s tova ot faila
            }


            gunRepository.Add(gun);
            return(String.Format(OutputMessages.SuccessfullyAddedGun, name));
        }
Esempio n. 23
0
    /// <summary>
    /// OnTriggerEnter is called when the Collider other enters the trigger
    /// </summary>
    /// <param name="other">Collider of the colliding game object</param>
    private void OnTriggerEnter(Collider other)
    {
        // If the player has touched the exit
        if (other.gameObject.CompareTag("Player"))
        {
            // Get the rifle script
            Rifle rifleScript = other.gameObject.GetComponentInChildren <Rifle>();

            // Check that the player has killed all the ragdolls
            if (rifleScript.botsKilled == 19)
            {
                // Save the time and go to the next scene
                Cursor.visible   = true;
                Cursor.lockState = CursorLockMode.None;

                finalTime = timer.currentTime;

                WriteString();

                SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex + 1);
            }
        }
    }
Esempio n. 24
0
    public static IWeapon SwitchWeapon(int index)
    {
        GameObject weaponInstance = GameObject.FindGameObjectWithTag("Weapons");

        switch (index)
        {
        case 0:
            Pistol pistol = weaponInstance.GetComponent <Pistol>();
            SelectedWeapon = Weapons.Pistol;
            return(pistol);

        case 1:
            Shotgun shotgun = weaponInstance.GetComponent <Shotgun>();
            SelectedWeapon = Weapons.Shotgun;
            return(shotgun);

        case 2:
            Rifle rifle = weaponInstance.GetComponent <Rifle>();
            SelectedWeapon = Weapons.Rifle;
            return(rifle);

        case 3:
            AssaultRifle ar = weaponInstance.GetComponent <AssaultRifle>();
            SelectedWeapon = Weapons.AssaultRifle;
            return(ar);

        case 4:
            Flamethrower flamethrower = weaponInstance.GetComponent <Flamethrower>();
            SelectedWeapon = Weapons.Flamethrower;
            return(flamethrower);

        default:
            Pistol defaultPistol = weaponInstance.GetComponent <Pistol>();
            SelectedWeapon = Weapons.Pistol;
            return(defaultPistol);
        }
    }
Esempio n. 25
0
        public string AddGun(string type, string name)
        {
            IGun gun = null;

            if (type == "Pistol")
            {
                gun = new Pistol(name);
            }
            else if (type == "Rifle")
            {
                gun = new Rifle(name);
            }

            if (gun == null)
            {
                return($"Invalid gun type!");
            }
            else
            {
                gunRepository.Add(gun);

                return($"Successfully added {name} of type: {type}");
            }
        }
        public string AddGun(string type, string name)
        {
            switch (type)
            {
            case "Pistol":
            {
                Pistol pistol = new Pistol(name);
                this.guns.Add(pistol);

                return($"Successfully added {name} of type: {type}");
            }

            case "Rifle":
            {
                Rifle rifle = new Rifle(name);
                this.guns.Add(rifle);

                return($"Successfully added {name} of type: {type}");
            }

            default:
                return("Invalid gun type!");
            }
        }
Esempio n. 27
0
    public void Init()
    {
        if (!enabled)
        {
            return;
        }
        stateIcon = GetComponentInChildren <StateIcon>();
        stateIcon.Init();
        navigator = GetComponent <Navigator>();
        navigator.Init();

        health     = new Health();
        rifle      = GetComponentInChildren <Rifle>();
        enemySight = GetComponent <EnemySight>();

        enemySight.SetOnPlayerSightedListener(() => {
            if (personality != null)
            {
                personality.OnPlayerSeen(Player.Instance.transform.position);
            }
        });
        sosSprite = Resources.Load <Sprite>("StateIcons\\sos");
        ChoosePersonality();
    }
        public TableLoader(Stream table)
        {
            using var text = new StreamReader(table, Encoding.UTF8, true, 4096, true);
            CsvReader     csv   = new CsvReader(text, ";");
            List <string> units = new List <string>();

            while (csv.Read())
            {
                if (csv.FieldsCount == 0)
                {
                    continue;
                }
                if (csv[0] == "ammo")
                {
                    if (csv.FieldsCount < 6)
                    {
                        Ammunition = new Ammunition(
                            ballisticCoefficient: new BallisticCoefficient(csv[1]),
                            weight: new Measurement <WeightUnit>(csv[2]),
                            muzzleVelocity: new Measurement <VelocityUnit>(csv[3]));
                    }
                    else
                    {
                        Ammunition = new Ammunition(
                            weight: new Measurement <WeightUnit>(csv[2]),
                            ballisticCoefficient: new BallisticCoefficient(csv[1]),
                            muzzleVelocity: new Measurement <VelocityUnit>(csv[3]),
                            bulletDiameter: new Measurement <DistanceUnit>(csv[4]),
                            bulletLength: new Measurement <DistanceUnit>(csv[5]));
                    }
                }
                else if (csv[0] == "rifle")
                {
                    if (csv.FieldsCount < 5)
                    {
                        Rifle = new Rifle(
                            sight: new Sight(sightHeight: new Measurement <DistanceUnit>(csv[1]), Measurement <AngularUnit> .ZERO, Measurement <AngularUnit> .ZERO),
                            zero: new ZeroingParameters(distance: new Measurement <DistanceUnit>(csv[2]), null, null),
                            rifling: null);
                    }
                    else
                    {
                        Rifle = new Rifle(
                            sight: new Sight(sightHeight: new Measurement <DistanceUnit>(csv[1]), Measurement <AngularUnit> .ZERO, Measurement <AngularUnit> .ZERO),
                            zero: new ZeroingParameters(distance: new Measurement <DistanceUnit>(csv[2]), null, null),
                            rifling: new Rifling(new Measurement <DistanceUnit>(csv[3]), csv[4] == "left" ? TwistDirection.Left : TwistDirection.Right));
                    }
                }
                else if (csv[0] == "wind")
                {
                    Wind = new Wind(new Measurement <VelocityUnit>(csv[1]), new Measurement <AngularUnit>(csv[2]));
                }
                else if (csv[0] == "atmosphere")
                {
                    Atmosphere = new Atmosphere(
                        altitude: new Measurement <DistanceUnit>(csv[4]),
                        pressure: new Measurement <PressureUnit>(csv[3]),
                        temperature: new Measurement <TemperatureUnit>(csv[1]),
                        humidity: double.Parse(csv[2], CultureInfo.InvariantCulture) / 100.0);
                }
                else if (csv[0] == "shot")
                {
                    ShotParameters = new ShotParameters()
                    {
                        ShotAngle = new Measurement <AngularUnit>(csv[1]),
                        CantAngle = new Measurement <AngularUnit>(csv[2]),
                    };
                }
                else
                {
                    if (char.IsDigit(csv[0][0]))
                    {
                        if (units.Count == 0)
                        {
                            throw new InvalidOperationException("The header with the unit names for the table is not found");
                        }

                        var distance = new Measurement <DistanceUnit>(csv[0] + units[0]);
                        var drop     = new Measurement <DistanceUnit>(csv[1] + units[1]);
                        var windage  = new Measurement <DistanceUnit>(csv[3] + units[3]);
                        var velocity = new Measurement <VelocityUnit>(csv[5] + units[5]);
                        var mach     = double.Parse(csv[6], CultureInfo.InvariantCulture);
                        var energy   = new Measurement <EnergyUnit>(csv[7] + units[7]);
                        var time     = double.Parse(csv[8], CultureInfo.InvariantCulture);

                        mTrajectory.Add(new TrajectoryPoint(
                                            time: TimeSpan.FromSeconds(time),
                                            distance: distance,
                                            velocity: velocity,
                                            mach: mach,
                                            drop: drop,
                                            windage: windage,
                                            energy: energy,
                                            optimalGameWeight: Measurement <WeightUnit> .ZERO
                                            ));
                    }
                    else
                    {
                        for (int i = 0; i < csv.FieldsCount; i++)
                        {
                            units.Add(csv[i]);
                        }
                    }
                }
            }
        }
        //may RNG bless us with no problems
        public static void chooseCalc()
        {
            Console.WriteLine("Pick your weapon of choice:");
            Console.WriteLine("1. Amprex \n2. Boltor \n3. Boltor Prime \n4. Boltor Telos \n5. Braton MK-1 \n6. Braton Prime \n7. Braton Vandal \n8. Burston \n9. Burston Prime \n10. Buzlok \n11. Dera \n12. Dera Vandal \n13. Flux Rifle \n14. Glaxion \n15. Gorgon \n16. Gorgon Prisma \n17. Gorgon Wraith \n18. Grakata \n19. Grakata Prisma \n20. Grinlok \n21. Harpak \n22. Hema \n23. Hind \n24. Ignis \n25. Ignis Wraith \n26. Karak \n27. Karak Wraith \n28. Latron \n29. Latron Prime \n30. Latron Wraith \n31. Mutalist Quanta \n32. Opticor \n33. Paracyst \n34. Quanta\n35. Quanta Vandal \n36. Soma \n37. Soma Prime \n38. Stradavar \n39. Supra \n40.Sybaris \n41. Sybaris Dex \n42. Synapse\n43. Tenora \n44. Tetra\n45. Tetra Prisma \n46. Tiberon");
            int choice = Convert.ToInt32(Console.ReadLine());

            switch (choice)
            {
            case 1:
                Rifle Amprex = new Rifle();
                Amprex.WeaponName     = "Amprex";
                Amprex.TriggerType    = "Held";
                Amprex.impactDMG      = 0;
                Amprex.slashDMG       = 0;
                Amprex.punctureDMG    = 0;
                Amprex.coldDMG        = 0;
                Amprex.electricityDMG = 7.5;
                Amprex.heatDMG        = 0;
                Amprex.toxinDMG       = 0;
                Amprex.statusChance   = 20;
                Amprex.critChance     = 50;
                Amprex.critMultiplier = 2;
                Amprex.firstDisplay();
                break;

            case 2:
                Rifle Boltor = new Rifle();
                Boltor.WeaponName     = "Boltor";
                Boltor.TriggerType    = "Auto";
                Boltor.impactDMG      = 2.5;
                Boltor.slashDMG       = 20;
                Boltor.punctureDMG    = 2.5;
                Boltor.coldDMG        = 0;
                Boltor.electricityDMG = 0;
                Boltor.heatDMG        = 0;
                Boltor.toxinDMG       = 0;
                Boltor.statusChance   = 10;
                Boltor.critChance     = 5;
                Boltor.critMultiplier = 1.5;
                Boltor.firstDisplay();
                break;

            case 3:
                Rifle BoltorP = new Rifle();
                BoltorP.WeaponName     = "Boltor";
                BoltorP.TriggerType    = "Auto";
                BoltorP.impactDMG      = 5.5;
                BoltorP.slashDMG       = 49.5;
                BoltorP.punctureDMG    = 0;
                BoltorP.coldDMG        = 0;
                BoltorP.electricityDMG = 0;
                BoltorP.heatDMG        = 0;
                BoltorP.toxinDMG       = 0;
                BoltorP.statusChance   = 10;
                BoltorP.critChance     = 5;
                BoltorP.critMultiplier = 2;
                BoltorP.firstDisplay();
                break;

            // Change values after this point
            case 4:
                Rifle BoltorT = new Rifle();
                BoltorT.WeaponName     = "Boltor Telos";
                BoltorT.TriggerType    = "Auto";
                BoltorT.impactDMG      = 5.5;
                BoltorT.slashDMG       = 49.5;
                BoltorT.punctureDMG    = 0;
                BoltorT.coldDMG        = 0;
                BoltorT.electricityDMG = 0;
                BoltorT.heatDMG        = 0;
                BoltorT.toxinDMG       = 0;
                BoltorT.statusChance   = 10;
                BoltorT.critChance     = 5;
                BoltorT.critMultiplier = 2;
                BoltorT.firstDisplay();
                break;

            case 5:
                Rifle BratonMK = new Rifle();
                BratonMK.WeaponName     = "Braton MK-1";
                BratonMK.TriggerType    = "Auto";
                BratonMK.impactDMG      = 5.5;
                BratonMK.slashDMG       = 49.5;
                BratonMK.punctureDMG    = 0;
                BratonMK.coldDMG        = 0;
                BratonMK.electricityDMG = 0;
                BratonMK.heatDMG        = 0;
                BratonMK.toxinDMG       = 0;
                BratonMK.statusChance   = 10;
                BratonMK.critChance     = 5;
                BratonMK.critMultiplier = 2;
                BratonMK.firstDisplay();
                break;

            case 6:
                Rifle BratonP = new Rifle();
                BratonP.WeaponName     = "Braton Prime";
                BratonP.TriggerType    = "Auto";
                BratonP.impactDMG      = 5.5;
                BratonP.slashDMG       = 49.5;
                BratonP.punctureDMG    = 0;
                BratonP.coldDMG        = 0;
                BratonP.electricityDMG = 0;
                BratonP.heatDMG        = 0;
                BratonP.toxinDMG       = 0;
                BratonP.statusChance   = 10;
                BratonP.critChance     = 5;
                BratonP.critMultiplier = 2;
                BratonP.firstDisplay();
                break;


            default:
                Console.WriteLine("Reverting you back to last menu.");
                PrimaryInnerChoice.extensionChoice();
                break;
            }
        }
Esempio n. 30
0
        bool UpdateParticles(bool spawn)
        {
            if (!Main.Settings.sprayParticles)
            {
                return(false);
            }

            IMyCamera camera = MyAPIGateway.Session?.Camera;

            if (camera == null)
            {
                return(false);
            }

            MatrixD matrix = Rifle.WorldMatrix;

            if (Vector3D.DistanceSquared(camera.WorldMatrix.Translation, matrix.Translation) > SprayMaxViewDistSq)
            {
                return(false);
            }

            bool paused = Main.IsPaused;

            if (!paused && spawn)
            {
                Particle particle = Main.ToolHandler.GetPooledParticle();
                particle.Init(matrix, ParticleColor);
                Particles.Add(particle);
            }

            if (Particles.Count > 0)
            {
                //const double NozzlePosX = 0.06525;
                //const double NozzlePosZ = 0.16;
                //Vector3D muzzleWorldPos = matrix.Translation + matrix.Up * NozzlePosX + matrix.Forward * NozzlePosZ;
                Vector3D muzzleWorldPos = Rifle.GetMuzzlePosition();

                for (int i = Particles.Count - 1; i >= 0; i--)
                {
                    Particle p = Particles[i];

                    MyTransparentGeometry.AddPointBillboard(SprayMaterial, p.Color, muzzleWorldPos + p.RelativePosition, p.Radius, p.Angle, blendType: SprayBlendType);

                    if (!paused)
                    {
                        if (--p.Life <= 0 || p.Color.A <= 0)
                        {
                            Particles.RemoveAtFast(i);
                            Main.ToolHandler.ReturnParticleToPool(p);
                            continue;
                        }

                        if (p.Angle > 0)
                        {
                            p.Angle += (p.Life * 0.001f);
                        }
                        else
                        {
                            p.Angle -= (p.Life * 0.001f);
                        }

                        p.RelativePosition += p.VelocityPerTick;
                        p.VelocityPerTick  *= 1.3f;
                        p.Radius           *= MyUtils.GetRandomFloat(1.25f, 1.45f);

                        if (p.Life <= 20)
                        {
                            p.Color *= 0.7f;
                        }
                    }
                }
            }

            return(true);
        }
 private static int GetAttackPower()
 {
     var x = new Rifle(attackPower: GetAttackPower());
     return x.AttackPower;
 }
Esempio n. 32
0
 // Implement this method in a buddy class to set properties that are specific to 'Rifle' (if any)
 partial void Merge(Rifle entity, ItemDTO dto, object state);
Esempio n. 33
0
    void Start()
    {
        //Grab a component and keep a reference to it
        cc = GetComponent<CharacterController> ();
        if (cc == null) {
            Debug.Log ("No CharacterController found.");
        }

        rifleScript = gun.gameObject.GetComponent<Rifle>();

        mouseScript = gameObject.GetComponent<MouseLook>();
        mouseCameraScript = camera1.transform.gameObject.GetComponent<MouseLook>();
        moveScript = gameObject.GetComponent<FPSInputController>();
        try {
            if (mouseScript == null || mouseCameraScript == null || moveScript == null) {
                throw new ArgumentNullException("Missing scripts.");
            }
        } catch (ArgumentNullException e) {
            Debug.LogWarning(e.Message);
        }

        pauseMenu.SetActive(false);

        bulletsInClip = 30; bulletsRemaining = maxAmmo;
        playerHealth = 100; canFire = true; alive = true; doublePower = false;
        paused = false; invincible = false;
        healthSlider.value = playerHealth;
        SetAmmoText(); reloadText.SetActive(false); noAmmoText.SetActive(false);

        scoreScript = gameManager.GetComponent<GameManager>();
        spawnScript = spawnManager.GetComponent<SpawnManager>();

        if (gameObject.tag == "Player2") {
            team = "Red";
            teamScore = scoreScript.redScore;
            gameObject.transform.position = redSpawn.position;
        } else {
            team = "Blue";
            teamScore = scoreScript.blueScore;
            gameObject.transform.position = blueSpawn.position;
        }
    }