当前位置: 首页>>代码示例>>C#>>正文


C# Entity.SwitchToWeaponImmediate方法代码示例

本文整理汇总了C#中System.Entity.SwitchToWeaponImmediate方法的典型用法代码示例。如果您正苦于以下问题:C# Entity.SwitchToWeaponImmediate方法的具体用法?C# Entity.SwitchToWeaponImmediate怎么用?C# Entity.SwitchToWeaponImmediate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Entity的用法示例。


在下文中一共展示了Entity.SwitchToWeaponImmediate方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: usedBox

 public void usedBox(Entity box, Entity player)
 {
     if (player.GetField<string>("sessionteam") == "axis") return;
     if (box.GetField<string>("state").Equals("inuse") && box.GetField<Entity>("player").Equals(player))
     {
         player.TakeWeapon(player.CurrentWeapon);
         string name = Utilities.BuildWeaponName(weaponNames[box.GetField<int>("giveweapon")], "", "", 0, 0);
         player.GiveWeapon(name);
         player.SwitchToWeaponImmediate(name);
         box.GetField<Entity>("weaponent").Call("delete");
         box.SetField("_destroyed", true);
         box.SetField("state", "idle");
         return;
     }
     if (!box.GetField<string>("state").Equals("idle")) return;
     box.SetField("state", "inuse");
     Entity weapon = Call<Entity>("spawn", "script_model", new Parameter(new Vector3(box.Origin.X, box.Origin.Y, box.Origin.Z + 10)));
     box.SetField("weaponent", new Parameter(weapon));
     weapon.Call("setmodel", weaponModels[0]);
     int timecount = 0;
     int weapnum = 0;
     OnInterval(50, () =>
     {
         weapnum = _rng.Next(weaponModels.Length);
         weapon.Call("setmodel", weaponModels[weapnum]);
         Vector3 origin = weapon.Origin;
         weapon.Call("moveto", new Parameter(new Vector3(origin.X, origin.Y, origin.Z + 0.37f)), .05f); // moveto
         timecount++;
         if (timecount == 60) return false;
         return true;
     });
     AfterDelay(3000, () =>
     {
         box.SetField("state", "waiting");
         box.SetField("giveweapon", weapnum);
         weapon.Call("moveto", new Parameter(new Vector3(box.Origin.X, box.Origin.Y, box.Origin.Z + 10)), 10); // moveto
         box.SetField("player", new Parameter(player));
     });
     AfterDelay(13000, () =>
     {
         if (box.GetField<string>("state") != "idle")
         {
             if (!box.GetField<bool>("_destroyed"))
             {
                 weapon.Call("delete");
                 box.SetField("state", "idle");
             }
             box.SetField("_destroyed", false);
         }
     });
 }
开发者ID:ahmad009,项目名称:MyShop,代码行数:51,代码来源:MyMapedit.cs

示例2: usedMysteryBox

 public void usedMysteryBox(Entity box, Entity player)
 {
     if (player.IsAlive && (Utility.GetPlayerTeam(player) != "axis"))
     {
         if (player.CurrentWeapon.Contains("killstreak") || player.CurrentWeapon.Contains("airdrop"))
         {
             return;
         }
         if (player.GetField<int>("inf2_money") < 500)
         {
             player.Call("iprintln", new Parameter[] { "^1Mystery box need $500." });
             return;
         }
         else
         {
             player.SetField("inf2_money", player.GetField<int>("inf2_money") - 500);
             Weapon weapon = Weapon.GetRandomWeapon();
             if (player.HasWeapon(weapon.Text))
             {
                 if (weapon.Text == "defaultweapon_mp")
                 {
                     player.Call("setweaponammoclip", weapon.Text, 0);
                     player.Call("setweaponammostock", weapon.Text, 0);
                 }
                 else
                 {
                     player.Call("givemaxammo", new Parameter[] { weapon.Text });
                 }
                 player.SwitchToWeapon(weapon.Text);
                 player.Call("iprintlnbold", weapon.Name);
                 Call("iprintln", player.Name + " buy weapon - " + weapon.Name);
             }
             else
             {
                 if (player.GetField<string>("secondweapon") != "none")
                 {
                     if (player.GetField<string>("firstweapon") == player.CurrentWeapon)
                     {
                         player.SetField("firstweapon", weapon.Text);
                     }
                     else if (player.GetField<string>("secondweapon") == player.CurrentWeapon)
                     {
                         player.SetField("secondweapon", weapon.Text);
                     }
                     player.TakeWeapon(player.CurrentWeapon);
                 }
                 else
                 {
                     player.SetField("secondweapon", weapon.Text);
                 }
                 player.GiveWeapon(weapon.Text);
                 if (weapon.Text == "defaultweapon_mp")
                 {
                     player.Call("setweaponammoclip", weapon.Text, 0);
                     player.Call("setweaponammostock", weapon.Text, 0);
                 }
                 else
                 {
                     player.Call("givemaxammo", new Parameter[] { weapon.Text });
                 }
                 AfterDelay(300, () => player.SwitchToWeaponImmediate(weapon.Text));
                 player.Call("iprintlnbold", weapon.Name);
                 Call("iprintln", player.Name + " buy weapon - " + weapon.Name);
             }
         }
     }
 }
开发者ID:A2ON,项目名称:CHINA-Magic-Infect,代码行数:67,代码来源:MapEdit.cs

示例3: DoRandom

 public void DoRandom(Entity player)
 {
     int? roll = new Random().Next(NumOfRolls);
     var rollname = "";
     switch (roll)
     {
         case 0:
             rollname = "None";
             break;
         case 1:
             rollname = "^2One Ammo XM25";
             player.TakeWeapon(player.CurrentWeapon);
             player.GiveWeapon("xm25_mp");
             player.Call("setweaponammoclip", "xm25_mp", 1);
             player.Call("setweaponammostock", "xm25_mp", 0);
             AfterDelay(300, () => player.SwitchToWeaponImmediate("xm25_mp"));
             break;
         case 2:
             rollname = "^2Extra Speed";
             OnInterval(100, () => Speed(player, 1.5));
             break;
         case 3:
             rollname = "^1You are a one hit kill";
             player.SetField("maxhealth", 1);
             player.Health = 1;
             break;
         case 4:
             rollname = "^2Juggernaut";
             player.SetField("maxhealth", player.Health * 3);
             player.Health = player.Health * 3;
             player.Call("setmodel", "mp_fullbody_opforce_juggernaut");
             player.Call("setviewmodel", "viewhands_juggernaut_opforce");
             break;
         case 5:
             rollname = "^2Juggernaut";
             player.SetField("maxhealth", player.Health * 3);
             player.Health = player.Health * 3;
             player.Call("setmodel", "mp_fullbody_opforce_juggernaut");
             player.Call("setviewmodel", "viewhands_juggernaut_opforce");
             break;
         case 6:
             rollname = "^1You are a one hit kill";
             player.SetField("maxhealth", 1);
             player.Health = 1;
             break;
         case 7:
             rollname = "^2SMAW";
             player.TakeWeapon(player.CurrentWeapon);
             player.GiveWeapon("iw5_smaw_mp");
             AfterDelay(300, () => player.SwitchToWeaponImmediate("iw5_smaw_mp"));
             break;
         case 8:
             rollname = "^1Stinger";
             player.TakeWeapon(player.CurrentWeapon);
             player.GiveWeapon("stinger_mp");
             AfterDelay(300, () => player.SwitchToWeaponImmediate("stinger_mp"));
             break;
         case 9:
             rollname = "^2Extra Speed";
             OnInterval(100, () => Speed(player, 1.5));
             break;
         case 10:
             rollname = "^2Extra Speed";
             OnInterval(100, () => Speed(player, 1.5));
             break;
         case 11:
             rollname = "^2Juggernaut";
             player.SetField("maxhealth", player.Health * 3);
             player.Health = player.Health * 3;
             player.Call("setmodel", "mp_fullbody_opforce_juggernaut");
             player.Call("setviewmodel", "viewhands_juggernaut_opforce");
             break;
         case 12:
             rollname = "^2AA12";
             player.TakeWeapon(player.CurrentWeapon);
             player.GiveWeapon("iw5_aa12_mp_xmags_camo11");
             player.Call("setweaponammostock", "iw5_aa12_mp_xmags_camo11", 0);
             AfterDelay(300, () => player.SwitchToWeaponImmediate("iw5_aa12_mp_xmags_camo11"));
             break;
         case 13:
             rollname = "^2Juggernaut";
             player.SetField("maxhealth", player.Health * 3);
             player.Health = player.Health * 3;
             player.Call("setmodel", "mp_fullbody_opforce_juggernaut");
             player.Call("setviewmodel", "viewhands_juggernaut_opforce");
             break;
         case 14:
             rollname = "^1You are a one hit kill";
             player.SetField("maxhealth", 1);
             player.Health = 1;
             break;
         case 15:
             rollname = "^1Turtle";
             OnInterval(100, () => Speed(player, 0.4f));
             break;
         case 16:
             rollname = "^1Turtle";
             OnInterval(100, () => Speed(player, 0.4f));
             break;
         case 17:
//.........这里部分代码省略.........
开发者ID:A2ON,项目名称:CHINA-Magic-Infect,代码行数:101,代码来源:ZombieRollTheDice.cs

示例4: upgradeWeapon

        public static string upgradeWeapon(Entity player)
        {
            string weapon = player.CurrentWeapon;
            string basenewweapon = "";
            string basename = WeaponUtils.weapon_getBasename(weapon);
            int camo = player.GetField<int>("camo");
            int reticle = player.GetField<int>("reticle");

            if (weapon.StartsWith("iw5_pp90m1"))
            {
                player.Call("iprintlnbold", "^3IS SMG");
                player.TakeWeapon(weapon);
                basenewweapon = WeaponUtils.getRandomAR(camo, reticle);
            }

            if (Array.IndexOf(WeaponUtils._smgList, basename) > 0)
            {
                player.TakeWeapon(weapon);
                player.Call("iprintlnbold", "^3IS SMG");
                basenewweapon = WeaponUtils.getRandomAR(camo, reticle);
            }

            else if (Array.IndexOf(WeaponUtils._arList, basename) > 0)
            {
                player.TakeWeapon(weapon);
                basenewweapon = WeaponUtils.getRandomLMG(camo, reticle);
            }
            else if (Array.IndexOf(WeaponUtils._pistolList, basename) > 0)
            {
                player.TakeWeapon(weapon);
                basenewweapon = WeaponUtils.getRandomAutoPistol(camo, reticle);
            }
            else
            {
                return "You cannot upgrade this weapon!";
            }

            string[] newattach = WeaponUtils.weapon_getAttachments(weapon);
            string newweapon = WeaponUtils.weapon_getWeaponName(basenewweapon, newattach, player.GetField<int>("camo"), player.GetField<int>("reticle"));
            player.GiveWeapon(newweapon);

            player.AfterDelay(100, entity =>
            {
                player.SwitchToWeaponImmediate(newweapon);
                player.Call("iprintlnbold", "Upgraded Weapon!");
            });

            return "";
        }
开发者ID:ahmad009,项目名称:MyShop,代码行数:49,代码来源:WeaponUtils.cs

示例5: DoRandom


//.........这里部分代码省略.........
                                          {
                                              player.Call("iprintlnbold", "Godmode Off");
                                              player.Health = player.GetField<int>("maxhealth");
                                              player.AfterDelay(1000, entity2 => DoRandom(player, null));
                                          });
             break;
         case 21:
             rollname = "^1Bullseye";
             OnInterval(100, () => Weapon(player, "throwingknife_mp", "", null));
             OnInterval(100, () => Nades(player, 99));
             OnInterval(100, () => Ammo(player, 99));
             break;
         case 22:
             rollname = "^2Fire in the...";
             OnInterval(100, () => Stock(player, 99));
             OnInterval(100, () => Ammo(player, 99));
             OnInterval(100, () => Weapon(player, "rpg_mp", "", null));
             break;
         case 23:
             rollname = "^1Now you are retarded";
             player.Call("allowads", false);
             player.Call("allowsprint", false);
             player.Call("allowjump", false);
             break;
         case 24:
             rollname = "AZUMOOB's Sub Setup";
             player.TakeAllWeapons();
             player.Call(33395);
             player.SetPerk("specialty_fastermelee", true, true);
             player.SetPerk("specialty_bulletaccuracy", true, true);
             player.SetPerk("specialty_bulletdamage", true, true);
             player.GiveWeapon("iw5_ump45_mp_silencer_xmags");
             player.GiveWeapon("iw5_aa12_mp_xmags_grip_akimbo");
             player.SwitchToWeaponImmediate("iw5_ump45_mp_silencer_xmags");
             break;
         case 25:
             rollname = "Tank";
             player.SetPerk("specialty_fastermelee", true, true);
             player.SetPerk("specialty_lightweight", true, true);
             player.TakeAllWeapons();
             player.GiveWeapon("riotshield_mp");
             player.SwitchToWeaponImmediate("riotshield_mp");
             player.Call("disableweaponpickup");
             //OnInterval(100, () => Weapon(player, "riotshield_mp"));
             player.AfterDelay(150,
                               entity =>
                               player.Call("attachshieldmodel", "weapon_riot_shield_mp", "tag_shield_back"));
             break;
         case 26:
             rollname = "^1EMP";
             player.Call("setempjammed", true);
             break;
         case 27:
             rollname = "Morpheus";
             player.Call(33395);
             player.SetPerk("specialty_longersprint", true, true);
             player.SetPerk("specialty_lightweight", true, true);
             player.SetPerk("specialty_quieter", true, true);
             OnInterval(100, () => Weapon(player, "iw5_mp5_mp_rof"));
             player.AfterDelay(150, entity => player.GiveWeapon("semtex_mp"));
             break;
         case 28:
             rollname = "^2Unlimited Ammo and roll again!";
             OnInterval(100, () => Nades(player, 99));
             OnInterval(100, () => Ammo(player, 99));
             player.AfterDelay(2000, entity => DoRandom(player, null));
开发者ID:bobolo,项目名称:iw5m-scripts,代码行数:67,代码来源:RollTheDice.cs

示例6: GiveWeapon

 public void GiveWeapon(Entity player, params string[] weapons)
 {
     player.TakeAllWeapons();
     foreach (var weapon in weapons)
         player.GiveWeapon(weapon);
     player.SwitchToWeaponImmediate(weapons[0]);
     player.Call("disableweaponpickup");
     Stock(player, 99);
 }
开发者ID:bobolo,项目名称:iw5m-scripts,代码行数:9,代码来源:RollTheDice.cs

示例7: OnPlayerSpawned

        public void OnPlayerSpawned(Entity player)
        {
            if (Utility.GetPlayerTeam(player) == "allies")
            {
                player.SetField("firstweapon", Call<string>("getdvar", "scr_inf2_initweapon"));
                player.SetField("secondweapon", "none");
                player.TakeAllWeapons();
                player.GiveWeapon(Call<string>("getdvar", "scr_inf2_initweapon"));
                player.Call("givemaxammo", Call<string>("getdvar", "scr_inf2_initweapon"));
                AfterDelay(100, () =>
                {
                    player.GiveWeapon("trophy_mp");
                    player.GiveWeapon("claymore_mp");
                    player.Call("givemaxammo", "trophy_mp");
                    player.Call("givemaxammo", "claymore_mp");
                });
                AfterDelay(300, () => player.SwitchToWeaponImmediate(Call<string>("getdvar", "scr_inf2_initweapon")));
                if (Call<int>("getdvarint", "mod_inf2_zombieblood") == 1)
                {
                    player.Call("hide");
                }
                player.SetPerk("specialty_holdbreathwhileads", true, false);
                player.SetPerk("specialty_fastermelee", true, false);
                player.SetPerk("specialty_bulletaccuracy", true, false);
                player.SetPerk("specialty_fastoffhand", true, false);
                player.SetPerk("specialty_quickdraw", true, false);
                player.SetPerk("specialty_longerrange", true, false);

                player.Call("setviewmodel", new Parameter[] { "viewmodel_base_viewhands" });

                player.SetClientDvar("g_compassshowenemies", "0");
            }
            else
            {
                SetModel(player);
                player.SetPerk("specialty_falldamage", true, false);
                player.SetPerk("specialty_lightweight", true, false);
                player.SetPerk("specialty_longersprint", true, false);
                //player.SetPerk("specialty_grenadepulldeath", true, false);
                player.SetPerk("specialty_fastoffhand", true, false);
                player.SetPerk("specialty_fastreload", true, false);
                player.SetPerk("specialty_paint", true, false);
                player.SetPerk("specialty_autospot", true, false);
                player.SetPerk("specialty_stalker", true, false);
                player.SetPerk("specialty_marksman", true, false);
                player.SetPerk("specialty_quickswap", true, false);
                player.SetPerk("specialty_quickdraw", true, false);
                player.SetPerk("specialty_fastermelee", true, false);
                player.SetPerk("specialty_selectivehearing", true, false);
                player.SetPerk("specialty_steadyaimpro", true, false);
                player.SetPerk("specialty_sitrep", true, false);
                player.SetPerk("specialty_detectexplosive", true, false);
                player.SetPerk("specialty_fastsprintrecovery", true, false);
                player.SetPerk("specialty_fastmeleerecovery", true, false);
                player.SetPerk("specialty_bulletpenetration", true, false);
                player.SetPerk("specialty_bulletaccuracy", true, false);

                player.SetClientDvar("g_compassshowenemies", "1");

                if (Call<int>("getteamscore", "axis") <= 1)
                {
                    player.Call("givemaxammo", player.CurrentWeapon);
                    player.SetField("maxhealth", 1000);
                    player.Health = 1000;
                }
                else
                {
                    player.SetField("maxhealth", 100);
                    player.Health = 100;
                }
            }
        }
开发者ID:A2ON,项目名称:CHINA-Magic-Infect,代码行数:72,代码来源:INF2.cs


注:本文中的System.Entity.SwitchToWeaponImmediate方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。