Наследование: SectionWeapon
Пример #1
0
        private string ProcessSnipeCommand(string txt)
        {
            var splt1 = txt.Split(' ');

            if (splt1.Length < 2)
            {
                return("Pokemon or location cannot be read");
            }
            var splt2 = splt1[1].Split(',');

            if (splt2.Length < 2)
            {
                return("Location cannot be read");
            }
            var pokemon = getPokemonID(splt1[0]);

            if (pokemon == PokemonId.Missingno)
            {
                return("Pokemon cannot be read");
            }
            var location = getLatLng(splt2[0], splt2[1]);

            Sniper.SendToSnipe(pokemon, location);
            return("Command sent succefully to the bot.");
        }
Пример #2
0
    private DataHeroes()
    {
        if (SaveData.isHaveData(saveDataFileName))
        {
            archerExp = instance.archerExp;
            sniperExp = instance.sniperExp;
            rogueExp = instance.rogueExp;
            dukunExp = instance.dukunExp;

            archerLocked = instance.archerLocked;
            sniperLocked = instance.sniperLocked;
            rogueLocked = instance.rogueLocked;
            dukunLocked = instance.dukunLocked;
        }
        else
        {
            archerExp = 0;
            sniperExp = 0;
            rogueExp = 0;
            dukunExp = 0;

            archerLocked = true;
            sniperLocked = true;
            rogueLocked = true;
            dukunLocked = true;
        }
        archerModel = new Archer(archerExp, archerLocked);
        sniperModel = new Sniper(sniperExp, sniperLocked);
        dukunModel = new Dukun(dukunExp, dukunLocked);
        rogueModel = new Rogue(rogueExp, rogueLocked);
    }
Пример #3
0
    // Update is called once per frame
    void Update()
    {
        Sniper Player = FindObjectOfType <Sniper>();      //Player variable set by finding the player object
        Text   text   = GetComponent <Text>();            //Get the text component of the object

        text.text = "Firing Speed : " + Player.FireSpeed; //Set text to be firing speed : + players firing speed
    }
Пример #4
0
 // Start is called before the first frame update
 void Start()
 {
     s = GetComponent <Sniper>();
     targetAcquired      = s.playerFound;
     currTimeBeforeShoot = -10;
     shootOrigin         = s.rayPoint;
 }
Пример #5
0
    // Update is called once per frame
    void Update()
    {
        Sniper Player = FindObjectOfType <Sniper>(); //Player Variable which is set by finding the player in the world
        Text   text   = GetComponent <Text>();       //Get the text component of the object

        text.text = "Mass : " + Player.Mass + " G";  //Text is equal to Mass + Player mass + G
    }
Пример #6
0
 public void Setup()
 {
     _mockSniperListener = new Mock <ISniperListener>();
     _mockAuction        = new Mock <IAuction>();
     _sniper             = new Sniper(_mockAuction.Object, new Item(ItemId, StopPrice));
     _sniper.AddSniperListener(_mockSniperListener.Object);
 }
Пример #7
0
    // Update is called once per frame
    void Update()
    {
        Sniper sniper = FindObjectOfType <Sniper>();        //As there is only one player you can just find the sniper object

        Physics        = GetComponent <MyPhysics>();        //Gets Physics component from object (Makes sure physics is up to date)
        Transformation = GetComponent <myTransformation>(); //Gets Transformation Component from object (Makes sure transformation is up to date)

        //Checks if timer is more then 0.2, this stops explosions being instant
        if (timeoutDestructor > 0.2f)
        {
            //Checks if the player is creating an explosion
            if (sniper.Explosion == true)
            {
                //If physic object has collided run these scripts
                if (Physics.Collided == true)
                {
                    GameObject go = new GameObject("Explosion");           //Create a new invisble game object called explosion
                    go.AddComponent <Explosion>();                         //Add Explosion
                    go.AddComponent <myTransformation>();                  //Add Transformation

                    TransformationInit Temp;                               //Create an initiation structre for transformation
                    Temp.Translation    = this.Transformation.Translation; //Set translalation
                    Temp.Translation.y -= 20;                              //Decrease height, this makes the explosion more impactfull
                    Temp.Scale          = this.Transformation.Scale;       //Sets scale
                    Temp.Rotation       = this.Transformation.Rotation;    //sets rotation
                    go.GetComponent <myTransformation>().Initialise(Temp); //Sets the transformation to initation structure
                    timeoutDestructor = 10000;                             //Kill the bullet
                }
            }
        }
        //Add Delta Time TO timeout Destructor
        timeoutDestructor += Time.deltaTime;
    }
Пример #8
0
    public override void Execute()
    {
        Sniper  copiedSniper   = _unit.Copy() as Sniper;
        Vector3 randomPosition = new Vector3(Random.Range(-10, 10), Random.Range(5, 20), Random.Range(-10, 10));

        copiedSniper.transform.SetPositionAndRotation(randomPosition, new Quaternion());
    }
Пример #9
0
    private void Start()
    {
        lr         = GetComponentInChildren <LineRenderer>();
        npcManager = GameObject.FindGameObjectWithTag("GameManager").GetComponent <NPCManager>();
        switch (myClasse)
        {
        case classe.GUNNER:
        {
            Alliee a = new Gunner(gameObject, npcManager);
            npcManager.AddAlliee(a);
            me = a;
            break;
        }

        case classe.SNIPER:
        {
            Alliee a = new Sniper(gameObject, npcManager);
            npcManager.AddAlliee(a);
            me = a;
            break;
        }

        case classe.SPECIALIST:
        {
            Alliee a = new Specialist(gameObject, npcManager);
            npcManager.AddAlliee(a);
            me = a;
            break;
        }

        case classe.CANNONFODDER:
        {
            Ennemy e = new CannonFodder(gameObject, npcManager);
            npcManager.AddEnnemy(e);
            me = e;
            break;
        }

        case classe.RUNNER:
        {
            Ennemy e = new Runner(gameObject, npcManager);
            npcManager.AddEnnemy(e);
            me = e;
            break;
        }

        case classe.BOSS:
        {
            Ennemy e = new Boss(gameObject, npcManager);
            npcManager.AddEnnemy(e);
            me = e;
            break;
        }

        default:
            throw new System.ArgumentException("Invalid classe.");
        }
        rb = GetComponent <Rigidbody>();
    }
Пример #10
0
    //private MachineGun machinegun;
    //private Rocket rocket;

    void Start()
    {
        guntype = "sniper";
        pos     = player.transform;
        sniper  = GetComponent <Sniper>();

        // future plans for more waeponry
        //rocket = GetComponent<Rocket>();
        //machinegun = GetComponent<MachineGun>();
    }
Пример #11
0
    private void Start()
    {
        //thread



        PlayerManager = GameObject.Find("Player").GetComponent <PlayerManager>();
        asaultRifle   = GameObject.Find("WeaponManager+Weapons").GetComponent <AsaultRifle>();
        sniper        = GameObject.Find("WeaponManager+Weapons").GetComponent <Sniper>();
    }
Пример #12
0
 void SetComponents()
 {
     gunFireAudioSource = GetComponent <AudioSource>();
     spriteRenderer     = GetComponent <SpriteRenderer>();
     gameObject.AddComponent <PlayerController>();
     gun     = GetComponent <Gun>();
     shotgun = GetComponent <Shotgun>();
     rifle   = GetComponent <Rifle>();
     rpg     = GetComponent <Rpg>();
     sniper  = GetComponent <Sniper>();
 }
Пример #13
0
        public void JoinAuction(Item item)
        {
            var auction = _auctionHouse.AuctionFor(item);

            var sniper = new Sniper(auction, item);

            auction.AddAuctionEventListener(sniper);
            _collector.AddSniper(sniper);

            auction.Join();
        }
Пример #14
0
        static void Main(string[] args)
        {
            //Character character = new Warrior(100, 15, 1, 67);
            //character.PrintHealth(); //virtual zeby uzyc metod z warriora
            //character.PrintAttack(); //nie wirtual zeby uzyc z character
            //character.PrintMana();

            //Warrior warrior = new Warrior(100, 10, 5, 15);
            //warrior.PrintHealth(); //nawet bez wirtual uzyje character
            //warrior.PrintAttack();
            //warrior.PrintMana();

            Character warrior = new Warrior(500, 70, 0, 65);
            Character rouge   = new Rouge(400, 70, 0, 65);
            Character mage    = new Mage(300, 30, 3000, 10);
            Character ranger  = new Ranger(400, 60, 300, 30);

            Paladin     paladin     = new Paladin(700, 70, 100, 30, 50);
            Berserker   berserker   = new Berserker(700, 70, 0, 55);
            Assassin    assassin    = new Assassin(600, 80, 0, 79);
            Gambler     gambler     = new Gambler(600, 50, 0, 40, 3);
            Archmage    archmage    = new Archmage(500, 30, 5000, 60);
            Bloodmage   bloodmage   = new Bloodmage(500, 30, 2000, 60);
            Sniper      sniper      = new Sniper(600, 80, 100, 30);
            BeastMaster beastMaster = new BeastMaster(700, 60, 500, 50); // wip


            Fighting         fighting = new Fighting();
            List <Character> lista    = new List <Character>
            {
                paladin,
                berserker,
                assassin,
                gambler,
                archmage,
                bloodmage,
                sniper,
                beastMaster
            };

            Start start = new Start();

            start.StartingInterface(lista);
            //  if (berserker.GetHealth() <= 0)
            //  {
            //      for (int i = berserker.ImmortalRage(); i > 0; i--)
            //      {
            //          Fight(berserker, assassin, playerOneTurn = !playerOneTurn);
            //      }
            //  }
            Console.ReadKey();
        }
Пример #15
0
    public Sniper FindSniperAt(Node node)
    {
        Sniper sniper = Object.FindObjectOfType <Sniper>();

        if (sniper != null)
        {
            if (sniper.transform.position == node.transform.position)
            {
                return(sniper);
            }
        }
        return(null);
    }
Пример #16
0
    public static void NewClass()
    {
        Sniper.Clear();
        Sniper.level = 0;
        CurrentGame.game.memoryGeneral.humanClassProgress.sniper.level    = 0;
        CurrentGame.game.memoryGeneral.humanClassProgress.sniper.name     = "Sniper";
        CurrentGame.game.memoryGeneral.humanClassProgress.sniper.movement = 5;
        CurrentGame.game.memoryGeneral.humanClassProgress.sniper.classWeapons.classWeapon1.type = "Ranged";
        CurrentGame.game.memoryGeneral.humanClassProgress.sniper.classWeapons.classWeapon1.rank = 3;
        CurrentGame.game.memoryGeneral.humanClassProgress.sniper.classWeapons.classWeapon2.type = "Close";
        CurrentGame.game.memoryGeneral.humanClassProgress.sniper.classWeapons.classWeapon2.rank = 3;
        CurrentGame.game.memoryGeneral.humanClassProgress.sniper.caps = Sniper.Caplist();

        LevelUpClass();
    }
Пример #17
0
        public Logic(ISettings botSettings, LogicInfoObservable infoObservable)
        {
            this.BotSettings = botSettings;
            var clientSettings = new PokemonGo.RocketAPI.Shared.ClientSettings(botSettings.pFHashKey, botSettings.DefaultLatitude, botSettings.DefaultLongitude, botSettings.DefaultAltitude,
                                                                               botSettings.proxySettings.hostName, botSettings.proxySettings.port, botSettings.proxySettings.username, botSettings.proxySettings.password,
                                                                               botSettings.AuthType, botSettings.Username, botSettings.Password, GlobalVars.BotApiSupportedVersion);

            objClient = new Client(clientSettings);
            objClient.setFailure(new ApiFailureStrat(objClient));
            BotStats            = new BotStats();
            navigation          = new Navigation(objClient, botSettings);
            pokevision          = new PokeVisionUtil();
            this.infoObservable = infoObservable;
            Instance            = this;
            sniperLogic         = new  Sniper(objClient, botSettings);
            PokemonGo.RocketAPI.Shared.KeyCollection.Load();
        }
Пример #18
0
 private void TowerSwitchInput()
 {
     if (previewTower != null)
     {
         if (input.KeyPressed(Keys.D1))
         {
             previewTower = new FlameThrower(selectedTower.X, selectedTower.Y, previewTower.HotkeyNumber);
         }
         else if (input.KeyPressed(Keys.D2))
         {
             previewTower = new Shotgun(selectedTower.X, selectedTower.Y, previewTower.HotkeyNumber);
         }
         else if (input.KeyPressed(Keys.D3))
         {
             previewTower = new Sniper(selectedTower.X, selectedTower.Y, previewTower.HotkeyNumber);
         }
     }
 }
Пример #19
0
 public void Create_Guns(string type)
 {
     if (type == "S")
     {
         Sniper temp = WeaponsFacotry.CreateWeapon(type) as Sniper;
         Assert.AreEqual(10, temp.ammo);
         Assert.AreEqual("AWP", temp.name);
         Assert.AreEqual(75, temp.damage);
         Assert.AreEqual(900, temp.cost);
     }
     else if (type == "A")
     {
         Automat temp = WeaponsFacotry.CreateWeapon(type) as Automat;
         Assert.AreEqual(30, temp.ammo);
         Assert.AreEqual("AK-47", temp.name);
         Assert.AreEqual(45, temp.damage);
         Assert.AreEqual(750, temp.cost);
     }
     else if (type == "P")
     {
         Pistol temp = WeaponsFacotry.CreateWeapon(type) as Pistol;
         Assert.AreEqual(7, temp.ammo);
         Assert.AreEqual("Desert Eagle", temp.name);
         Assert.AreEqual(30, temp.damage);
         Assert.AreEqual(500, temp.cost);
     }
     else if (type == "B")
     {
         Bazooka temp = WeaponsFacotry.CreateWeapon(type) as Bazooka;
         Assert.AreEqual(1, temp.ammo);
         Assert.AreEqual("RukyBazuky", temp.name);
         Assert.AreEqual(100, temp.damage);
         Assert.AreEqual(1000, temp.cost);
     }
     else
     {
         Granade temp = WeaponsFacotry.CreateWeapon(type) as Granade;
         Assert.AreEqual(1, temp.ammo);
         Assert.AreEqual("small", temp.name);
         Assert.AreEqual(10, temp.damage);
         Assert.AreEqual(0, temp.cost);
     }
 }
Пример #20
0
    public static void LevelUpClass()
    {
        Sniper.LevelUp();
        CurrentGame.game.memoryGeneral.humanClassProgress.sniper.level     = CurrentGame.game.memoryGeneral.humanClassProgress.sniper.level + 1;
        CurrentGame.game.memoryGeneral.humanClassProgress.sniper.modifiers = Sniper.ModList();

        foreach (string id in CurrentGame.game.memoryGeneral.humanClassProgress.sniper.subbed)
        {
            Unit me = new Unit();
            foreach (Unit u in CurrentGame.game.storeroom.units)
            {
                if (id == u.unitID)
                {
                    u.unitClass.main.human.sniper.modifiers = CurrentGame.game.memoryGeneral.humanClassProgress.sniper.modifiers;
                    u.unitClass.main.human.sniper.level     = CurrentGame.game.memoryGeneral.humanClassProgress.sniper.level;
                }
            }
        }
    }
Пример #21
0
    private void SetCommand()
    {
        _weapons = new Weapon[6];

        _weapons[0]        = new Pistol();
        pistol.coolTime    = FileManager.weaponInfo["pistol_respawn"];
        pistol.divCooltime = 1 / pistol.coolTime;
        Copy_Paste(_weapons[0], pistol);

        _weapons[1]     = new SMG();
        smg.coolTime    = FileManager.weaponInfo["smg_respawn"];
        smg.divCooltime = 1 / smg.coolTime;
        Copy_Paste(_weapons[1], smg);

        _weapons[2]        = new Sniper();
        sniper.coolTime    = FileManager.weaponInfo["sniper_respawn"];
        sniper.divCooltime = 1 / sniper.coolTime;
        Copy_Paste(_weapons[2], sniper);

        _weapons[3]    = new AR();
        ar.coolTime    = FileManager.weaponInfo["ar_respawn"];
        ar.divCooltime = 1 / ar.coolTime;
        Copy_Paste(_weapons[3], ar);

        _weapons[4]    = new SG();
        sg.coolTime    = FileManager.weaponInfo["sg_respawn"];
        sg.divCooltime = 1 / sg.coolTime;
        Copy_Paste(_weapons[4], sg);

        _weapons[5]         = new Grenade();
        grenade.coolTime    = FileManager.weaponInfo["grenade_respawn"];
        grenade.divCooltime = 1 / grenade.coolTime;
        Copy_Paste(_weapons[5], grenade);

        for (i = 0; i < _weapons.Length; i++)
        {
            _weapons[i].Init();
        }
    }
Пример #22
0
        public static void Main(string[] args)
        {
            Console.WriteLine();

            Console.WriteLine("==== Senjata ====");

            Console.WriteLine();

            Senjata senjata;

            senjata = new Pistol();
            senjata.jenis();
            senjata.peluru();
            senjata.caliber();

            Console.WriteLine();

            senjata = new Sniper();
            senjata.jenis();
            senjata.peluru();
            senjata.caliber();
        }
Пример #23
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;
        }
    }
Пример #24
0
        private void AddTower(int x, int y, Utility.TowerType type, int HotKeyNumber)
        {
            Tower tower = null;

            switch (type)
            {
            case Utility.TowerType.FlameThrower:
                tower = new FlameThrower(x, y, HotKeyNumber);
                break;

            case Utility.TowerType.Sniper:
                tower = new Sniper(x, y, HotKeyNumber);
                break;

            case Utility.TowerType.Shotgun:
                tower = new Shotgun(x, y, HotKeyNumber);
                break;

            default: throw new ArgumentException("invalid tower type: " + type);
            }
            Utility.TowerList.Add(tower);
        }
Пример #25
0
 // Update is called once per frame
 void Update()
 {
     displayAmmo.text = " ";
     foreach (Transform child in weaponLoc)
     {
         if (child.gameObject.activeSelf)
         {
             weapon = child;
             if (weapon.name == "Pistol(Clone)")
             {
                 pistol           = weapon.GetComponent <Pistol>();
                 ammo             = pistol.ammo;
                 displayAmmo.text = ammo.ToString();
             }
             if (weapon.name == "Sniper(Clone)")
             {
                 sniper           = weapon.GetComponent <Sniper>();
                 ammo             = sniper.ammo;
                 displayAmmo.text = ammo.ToString();
             }
         }
     }
 }
Пример #26
0
    private void SpawnSniper()
    {
        randomPosition = new Vector3(Random.Range(-10, 10), Random.Range(5, 20), Random.Range(-10, 10));
        if (UseCommander)
        {
            if (object.Equals(SniperCloneSource, null))
            {
                SniperCloneSource      = spawner.SpawnEnemy(EnemyType.Sniper) as Sniper;
                SniperCloneSource.name = "Sniper_SourceCloneForCommander";
                SniperCloneSource.gameObject.SetActive(false);
            }
            commander.SetUnitCommand(new CreateSniperCommand(SniperCloneSource));
            Debug.Log("Create Sniper Command - Added");
        }
        else
        {
            entity = spawner.SpawnEnemy(EnemyType.Sniper);
            AttachCharacterController(entity);

            entity.name = "Sniper_Clone_" + ++incrementorSniper;
            entity.transform.SetPositionAndRotation(randomPosition, new Quaternion());
            (entity as IEnemy).Kill();
        }
    }
Пример #27
0
    private void Awake()
    {
        if (instance)
        {
            Destroy(gameObject);
        }
        else
        {
            instance = this;
        }
        Physics2D.gravity = Vector2.zero;
        init = GetComponent <InitGameManager>();

        pistol             = new Pistol();
        rifts              = new Rifts();
        shotGun            = new ShotGun();
        sniper             = new Sniper();
        aug                = new AUG();
        dualBerretas       = new DualBerretas();
        knife              = new Knife();
        allWeaponsPossible = new List <Gun> {
            pistol,
            shotGun,
            rifts,
            sniper,
            aug,
            dualBerretas,
            knife
        };
        Quaternion quaternion = new Quaternion {
            eulerAngles = new Vector3(0, 0, 90)
        };

        playerTransform = Instantiate(playerPrefab, playerOriginPosition, quaternion);
        hc = playerTransform.GetComponent <HeroController>();
    }
Пример #28
0
    void OnGUI()
    {
        if (Time.time != 0 && Time.timeScale != 0)
        {
            if (player != null)
            {
                if (GameApp.GetInstance().GetGameScene().PlayingState == PlayingState.GamePlaying && player.InputController.EnableShootingInput)
                {
                    Weapon weapon = player.GetWeapon();
                    if (weapon != null)
                    {
                        if (weapon.GetWeaponType() == WeaponType.Sniper)
                        {
                            GUI.DrawTexture(new Rect((Sniper.lockAreaRect.xMin - AutoRect.AutoValue(leftTopReticle.width / 2)), (Sniper.lockAreaRect.yMin - AutoRect.AutoValue(leftTopReticle.height / 2)), AutoRect.AutoValue(leftTopReticle.width), AutoRect.AutoValue(leftTopReticle.height)), leftTopReticle);
                            GUI.DrawTexture(new Rect((Sniper.lockAreaRect.xMax - AutoRect.AutoValue(rightTopReticle.width / 2)), (Sniper.lockAreaRect.yMin - AutoRect.AutoValue(rightTopReticle.height / 2)), AutoRect.AutoValue(rightTopReticle.width), AutoRect.AutoValue(rightTopReticle.height)), rightTopReticle);
                            GUI.DrawTexture(new Rect((Sniper.lockAreaRect.xMin - AutoRect.AutoValue(leftBottomReticle.width / 2)), (Sniper.lockAreaRect.yMax - AutoRect.AutoValue(leftBottomReticle.height / 2)), AutoRect.AutoValue(leftBottomReticle.width), AutoRect.AutoValue(leftBottomReticle.height)), leftBottomReticle);
                            GUI.DrawTexture(new Rect((Sniper.lockAreaRect.xMax - AutoRect.AutoValue(rightBottomReticle.width / 2)), (Sniper.lockAreaRect.yMax - AutoRect.AutoValue(rightBottomReticle.height / 2)), AutoRect.AutoValue(rightBottomReticle.width), AutoRect.AutoValue(rightBottomReticle.height)), rightBottomReticle);


                            Sniper sniper = (Sniper)weapon;
                            List <NearestEnemyInfo> neis = sniper.GetNearestEnemyInfoList();
                            foreach (NearestEnemyInfo info in neis)
                            {
                                GUI.DrawTexture(new Rect(info.currentScreenPos.x - AutoRect.AutoValue((reticle.width * 0.5f)), info.currentScreenPos.y - AutoRect.AutoValue((reticle.height * 0.5f)), AutoRect.AutoValue(reticle.width), AutoRect.AutoValue(reticle.height)), reticle);
                            }
                        }
                        else
                        {
                            //Debug.Log(reticlePosition.x);
                            GUI.DrawTexture(new Rect(reticlePosition.x - AutoRect.AutoValue(reticle.width * 0.5f * mutipleSizeReticle), reticlePosition.y - AutoRect.AutoValue((reticle.height * 0.5f * mutipleSizeReticle)), AutoRect.AutoValue(reticle.width * mutipleSizeReticle), AutoRect.AutoValue(reticle.height * mutipleSizeReticle)), reticle);
                        }
                    }
                }
            }
        }
    }
Пример #29
0
        public void TestMethod2()
        {
            BaseUnitType gUnit = new Infantry();
            var          inf1  = new Infantry();
            var          inf2  = new Infantry();
            var          inf3  = new Infantry();

            var eng1 = new Engineer();
            var eng2 = new Engineer();
            var eng3 = new Engineer();

            var scout1 = new Scout();
            var scout2 = new Scout();
            var scout3 = new Scout();

            var mar1 = new Marine();
            var mar2 = new Marine();
            var mar3 = new Marine();

            var light1 = new Light();
            var light2 = new Light();
            var light3 = new Light();

            var heavy1 = new Heavy();
            var heavy2 = new Heavy();
            var heavy3 = new Heavy();

            var mort1 = new Mortar();
            var mort2 = new Mortar();
            var mort3 = new Mortar();

            var art1 = new Artillery();
            var art2 = new Artillery();
            var art3 = new Artillery();

            var air1 = new Airborn();
            var air2 = new Airborn();
            var air3 = new Airborn();

            var snip1 = new Sniper();
            var snip2 = new Sniper();
            var snip3 = new Sniper();

            inf1.Dispose();
            eng2.Dispose();
            scout1.Dispose();
            mar3.Dispose();
            light2.Dispose();
            heavy1.Dispose();
            mort3.Dispose();
            art2.Dispose();
            air3.Dispose();
            snip1.Dispose();

            inf1.DisplayString();
            inf2.DisplayString();
            inf3.DisplayString();
            eng1.DisplayString();
            eng2.DisplayString();
            eng3.DisplayString();
            scout1.DisplayString();
            scout2.DisplayString();
            scout3.DisplayString();
            mar1.DisplayString();
            mar2.DisplayString();
            mar3.DisplayString();
            light1.DisplayString();
            light2.DisplayString();
            light3.DisplayString();
            heavy1.DisplayString();
            heavy2.DisplayString();
            heavy3.DisplayString();
            mort1.DisplayString();
            mort2.DisplayString();
            mort3.DisplayString();
            art1.DisplayString();
            art2.DisplayString();
            art3.DisplayString();
            air1.DisplayString();
            air2.DisplayString();
            air3.DisplayString();
            snip1.DisplayString();
            snip2.DisplayString();
            snip3.DisplayString();
        }
Пример #30
0
    protected void GiveItemWeapon(ItemBox.ItemType type, int amount)
    {
        CmdHit(gameObject);

        // Create a weapon reference
        Weapon currentWeapon = null;

        // Check if we already have an instance of this weapon
        for (int i = 0; i < weapons.Count; i++)
        {
            if (type == ItemBox.ItemType.Pistol && weapons[i] is Pistol)
            {
                currentWeapon = weapons[i];
            }
            else if (type == ItemBox.ItemType.MachineGun && weapons[i] is MachineGun)
            {
                currentWeapon = weapons[i];
            }
            else if (type == ItemBox.ItemType.Shotgun && weapons[i] is Shotgun)
            {
                currentWeapon = weapons[i];
            }
            else if (type == ItemBox.ItemType.Sniper && weapons[i] is Sniper)
            {
                currentWeapon = weapons[i];
            }
            else if (type == ItemBox.ItemType.RocketLauncher && weapons[i] is RocketLauncher)
            {
                currentWeapon = weapons[i];
            }
        }

        // If we don't have a weapon of this type, create one and
        // add it to the weapon list
        if (currentWeapon == null)
        {
            if (type == ItemBox.ItemType.Pistol)
            {
                currentWeapon = new Pistol();
            }
            else if (type == ItemBox.ItemType.MachineGun)
            {
                currentWeapon = new MachineGun();
            }
            else if (type == ItemBox.ItemType.Shotgun)
            {
                currentWeapon = new Shotgun();
            }
            else if (type == ItemBox.ItemType.Sniper)
            {
                currentWeapon = new Sniper();
            }
            else if (type == ItemBox.ItemType.RocketLauncher)
            {
                currentWeapon = new RocketLauncher();
            }
            weapons.Add(currentWeapon);
            weapons.Sort();
        }

        // Automatically equip if weapon still not available
        if (weapon == null)
        {
            SwitchWeapon(0);
        }

        currentWeapon.AddAmmunition(amount);
        currentWeapon.LoadClip();

        if (currentWeapon == weapon)
        {
            hud.UpdateWeapon(weapon);
        }
    }
Пример #31
0
 // Use this for initialization
 void Start()
 {
     Sniper defaultWeapon = new Sniper();
 }