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


C# Entity.AfterDelay方法代码示例

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


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

示例1: KickPlayer

 // Some functions below - Might move to seperate file? (functions.cs)
 public void KickPlayer(Entity player)
 {
     player.AfterDelay(100, entity =>
     {
         Call("kick", player.Call<int>("getentitynumber"));
     });
 }
开发者ID:iConnorM,项目名称:iw5m-zombies,代码行数:8,代码来源:main.cs

示例2: OnPlayerKilled

        public override void OnPlayerKilled(Entity player, Entity inflictor, Entity attacker, int damage, string mod, string weapon, Vector3 dir, string hitLoc)
        {
            // update the own score
            if (attacker.HasField("bohud_created"))
            {
                attacker.AfterDelay(10, entity =>
                {
                    var scoreText = entity.GetField<HudElem[]>("bohud_messageText")[1];
                    scoreText.SetText(entity.GetField<int>("score").ToString());
                });
            }

            // update all players' ranking
            UpdateScores();
        }
开发者ID:bobolo,项目名称:iw5m-scripts,代码行数:15,代码来源:BOHud.cs

示例3: OnPlayerSpawend

 public void OnPlayerSpawend(Entity player)
 {
     player.AfterDelay(0, delegate (Entity ent)
     {
         if ((((player != null) && player.IsPlayer) && player.IsAlive) && (player.GetField<string>("sessionteam") != "allies"))
         {
             foreach (string str in this.fixWeapons)
             {
                 if (player.CurrentWeapon.Contains(str) && (player.CurrentWeapon.Contains("tactical") || player.CurrentWeapon == "iw5_usp45_mp"))
                 {
                     player.Call("setweaponammoclip", new Parameter[] { player.CurrentWeapon, 0 });
                     player.Call("setweaponammostock", new Parameter[] { player.CurrentWeapon, 0 });
                     break;
                 }
             }
         }
     });
 }
开发者ID:A2ON,项目名称:CHINA-Magic-Infect,代码行数:18,代码来源:DeleteAmmo.cs

示例4: usedDoor

 private void usedDoor(Entity door, Entity player)
 {
     if (!player.IsAlive) return;
     // has repair weapon. do repair door
     if (player.CurrentWeapon.Equals("defaultweapon_mp"))
     {
         repairDoor(door, player);
         return;
     }
     if (door.GetField<int>("hp") > 0)
     {
         if (Unitily.GetPlayerTeam(player) == "allies")
         {
             if (door.GetField<string>("state") == "open")
             {
                 door.Call(33399, new Parameter(door.GetField<Vector3>("close")), 1); // moveto
                 AfterDelay(300, () =>
                 {
                     door.SetField("state", "close");
                 });
             }
             else if (door.GetField<string>("state") == "close")
             {
                 door.Call(33399, new Parameter(door.GetField<Vector3>("open")), 1); // moveto
                 AfterDelay(300, () =>
                 {
                     door.SetField("state", "open");
                 });
             }
         }
         else
         {
             if (door.GetField<string>("state") == "close")
             {
                 if (player.GetField<int>("attackeddoor") == 0)
                 {
                     int hitchance = 0;
                     switch (player.Call<string>("getstance"))
                     {
                         case "prone":
                             hitchance = 20;
                             break;
                         case "couch":
                             hitchance = 45;
                             break;
                         case "stand":
                             hitchance = 90;
                             break;
                         default:
                             break;
                     }
                     if (_rng.Next(100) < hitchance)
                     {
                         door.SetField("hp", door.GetField<int>("hp") - 1);
                         player.Call("iprintlnbold", "HIT: " + door.GetField<int>("hp") + "/" + door.GetField<int>("maxhp"));
                     }
                     else
                     {
                         player.Call("iprintlnbold", "^1MISS");
                     }
                     player.SetField("attackeddoor", 1);
                     player.AfterDelay(1000, (e) => player.SetField("attackeddoor", 0));
                 }
             }
         }
     }
     else if (door.GetField<int>("hp") == 0 && door.GetField<string>("state") != "broken")
     {
         if (door.GetField<string>("state") == "close")
             door.Call(33399, new Parameter(door.GetField<Vector3>("open")), 1f); // moveto
         door.SetField("state", "broken");
     }
 }
开发者ID:China-PubX,项目名称:LSDZombie-Extreme,代码行数:73,代码来源:MapEdit.cs

示例5: usedZipline

 public void usedZipline(Entity box, Entity player)
 {
     Action<Entity> function = null;
     if (player.IsAlive && box.GetField<string>("state") != "using")
     {
         Vector3 startorigin = box.Origin;
         box.SetField("state", "using");
         box.Call("clonebrushmodeltoscriptmodel", new Parameter[] { Call<Entity>("spawn", "script_origin", new Vector3()) });
         player.Call("playerlinkto", new Parameter[] { box });
         box.Call("moveto", new Parameter[] { box.GetField<Vector3>("endorigin"), 5 });
         box.AfterDelay(5000, delegate (Entity ent)
         {
             if (player.Call<int>("islinked", new Parameter[0]) != 0)
             {
                 player.Call("unlink", new Parameter[0]);
                 player.Call("setorigin", new Parameter[] { box.GetField<Vector3>("endorigin") });
             }
             box.Call("moveto", new Parameter[] { startorigin, 1 });
         });
         if (function == null)
         {
             function = delegate (Entity ent)
             {
                 box.Call("clonebrushmodeltoscriptmodel", new Parameter[] { _airdropCollision });
                 box.SetField("state", "idle");
             };
         }
         box.AfterDelay(6100, function);
     }
 }
开发者ID:A2ON,项目名称:CHINA-Magic-Infect,代码行数:30,代码来源:MapEdit.cs

示例6: usedZipline

 public void usedZipline(Entity box, Entity player)
 {
     if (!player.IsAlive)
         return;
     /*if (this.Call<int>("getdvarint", new Parameter[1]
       {
     (Parameter) "power"
       }) != 1 || box.GetField<string>("state") == "using")
         return;*/
     Vector3 startorigin = box.Origin;
     box.SetField("state", (Parameter)"using");
     box.Call("clonebrushmodeltoscriptmodel", new Parameter[1]
       {
     (Parameter) this._nullCollision
       });
     player.Call("playerlinkto", new Parameter[1]
       {
     (Parameter) box
       });
     box.Call("moveto", (Parameter)box.GetField<Vector3>("endorigin"), (Parameter)5);
     box.AfterDelay(5000, (Action<Entity>)(ent =>
     {
         if (player.Call<int>("islinked") != 0)
         {
             player.Call("unlink");
             player.Call("setorigin", new Parameter[1]
       {
     (Parameter) box.GetField<Vector3>("endorigin")
       });
         }
         box.Call("moveto", (Parameter)startorigin, (Parameter)1);
     }));
     box.AfterDelay(6100, (Action<Entity>)(ent =>
     {
         box.Call("clonebrushmodeltoscriptmodel", new Parameter[1]
     {
       (Parameter) this._airdropCollision
     });
         box.SetField("state", (Parameter)"idle");
     }));
 }
开发者ID:ahmad009,项目名称:MyShop,代码行数:41,代码来源:MyMapedit.cs

示例7: HandleUseables

        public void HandleUseables(Entity player)
        {
            foreach (Entity ent in usables)
            {
                if (player.Origin.DistanceTo(ent.Origin) < ent.GetField<int>("range"))
                {
                    string team = player.GetField<string>("sessionteam");

                    switch (ent.GetField<string>("usabletype"))
                    {
                        case "door":
                            usedDoor(ent, player);
                            break;
                        case "zipline":
                            this.usedZipline(ent, player);
                            break;
                        case "ammobag":
                            if (team == "allies")
                            {
                                this.usedAmmo(ent, player);
                            }
                            break;
                        case "turret":
                            if (team == "axis")
                            {
                                player.AfterDelay(100, entity =>
                                {
                                    player.Call("iprintlnbold", "^1 just for humans.");
                                    player.Call("suicide");
                                });
                            }
                            continue;
                        default:
                            break;
                    }
                }
            }
        }
开发者ID:ahmad009,项目名称:MyShop,代码行数:38,代码来源:MyMapedit.cs

示例8: 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

示例9: 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

示例10: DoRandom


//.........这里部分代码省略.........
         case 13:
             rollname = "^2Knife Runner";
             player.Call(33395);
             player.SetPerk("specialty_longersprint", true, true);
             player.SetPerk("specialty_lightweight", true, true);
             player.SetPerk("specialty_fastermelee", true, true);
             OnInterval(100, () => Weapon(player, "iw5_44magnum_mp_tactical", "", null));
             OnInterval(100, () => Speed(player, 1.2f));
             OnInterval(100, () => Ammo(player, 0));
             OnInterval(100, () => Stock(player, 0));
             break;
         case 14:
             rollname = "^1Turtle";
             OnInterval(100, () => Speed(player, 0.4f));
             break;
         case 15:
             rollname = "^1Supermodel 1887";
             player.Call(33395);
             player.SetPerk("specialty_bulletaccuracy", true, true);
             OnInterval(100, () => Weapon(player, "iw5_1887_mp", "", null));
             break;
         case 16:
             rollname = "^1Fallout";
             OnInterval(100, () => Vision(player, "mpnuke", false));
             break;
         case 17:
             rollname = "^2Unlimited Ammo";
             OnInterval(100, () => Ammo(player, 99));
             OnInterval(100, () => Stock(player, 99));
             break;
         case 18:
             rollname = "^2Wallhack for 40 seconds";
             player.Call("thermalvisionfofoverlayon");
             player.AfterDelay(40000, entity =>
                                           {
                                              player.Call("thermalvisionfofoverlayoff");
                                              player.Call("iprintlnbold", "Wallhack Off");
                                          });
             break;
         case 19:
             rollname = "^2Double HP and roll again!";
             player.SetField("maxhealth", player.Health*2);
             player.Health = player.Health*2;
             player.AfterDelay(2000, entity => DoRandom(player, null));
             break;
         case 20:
             rollname = "^2Godmode for 15 seconds";
             player.Health = -1;
             player.AfterDelay(15000, entity =>
                                          {
                                              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));
开发者ID:bobolo,项目名称:iw5m-scripts,代码行数:67,代码来源:RollTheDice.cs

示例11: OnPlayerSpawn

 public void OnPlayerSpawn(Entity entity)
 {
     if (PlayerStop.Contains(entity.GetField<string>("name")))
         PlayerStop.Remove(entity.GetField<string>("name"));
     entity.TakeAllWeapons();
     entity.GiveWeapon(Settings.MainWeapon);
     entity.AfterDelay(10, entity1 =>
                               {
                                   entity.SwitchToWeapon(Settings.MainWeapon);
                                   entity.Call("givemaxammo", Settings.MainWeapon);
                               });
     if (Settings.AntiHardscope)
     {
         entity.OnInterval(50, entity1 =>
                                   {
                                       if (PlayerStop.Contains(entity.GetField<string>("name")))
                                           return false;
                                       if (!PlayerADSCount.ContainsKey(entity.GetField<string>("name")))
                                           PlayerADSCount.Add(entity.GetField<string>("name"), 0);
                                       if (entity.Call<float>("playerads") >= 1)
                                           PlayerADSCount[entity.GetField<string>("name")]++;
                                       if (PlayerADSCount[entity.GetField<string>("name")] >=
                                           Settings.MaxScopeTime/0.15)
                                       {
                                           PlayerADSCount[entity.GetField<string>("name")] = 0;
                                           entity.Call("allowads", false);
                                           OnInterval(50, () =>
                                                              {
                                                                  if (entity.Call<float>("playerads") > 0)
                                                                      return true;
                                                                  entity.Call("allowads", true);
                                                                  return false;
                                                              });
                                       }
                                       return true;
                                   });
     }
     if (Settings.ThrowingKnife)
     {
         entity.Call("SetOffhandPrimaryClass", "throwingknife");
         entity.GiveWeapon("throwingknife_mp");
         entity.Call("setweaponammoclip", "throwingknife_mp", 1);
     }
     if (Settings.RemoveAllPerks)
     {
         entity.Call(33395);
     }
     if (Settings.DefaultSniperPerks)
     {
         entity.SetPerk("specialty_bulletpenetration", true, false);
         entity.SetPerk("specialty_longersprint", true, false);
         entity.SetPerk("specialty_fastreload", true, false);
         entity.SetPerk("specialty_holdbreathwhileads", true, false);
         entity.SetPerk("specialty_lightweight", true, false);
         entity.SetPerk("specialty_moredamage", true, false);
         entity.SetPerk("specialty_quickdraw", true, false);
         entity.SetPerk("specialty_quickswap", true, false);
         entity.SetPerk("specialty_fastmantle", true, false);
     }
     if (!Settings.EnableFallDamage)
         entity.SetPerk("specialty_falldamage", true, false);
     if (Settings.UseSecondary)
     {
         entity.GiveWeapon(Settings.SecondaryWeapon);
         if (!Settings.SecondaryHasAmmo)
         {
             entity.Call("setweaponammoclip", Settings.SecondaryWeapon, 0);
             entity.Call("setweaponammostock", Settings.SecondaryWeapon, 0);
         }
     }
     //entity.SetField("maxhealth", Settings.PlayerMaxHealth);
     //entity.Health = Settings.PlayerMaxHealth;
     //entity.Notify("joined_spectators");
     //entity.SetField("usingRemote", "remote_remote");
     OnInterval(10, () =>
                        {
                            entity.Call("stoplocalsound", "breathing_hurt");
                            return true;
                        });
     OnInterval(50, () =>
                        {
                            if (entity.CurrentWeapon != Settings.MainWeapon)
                                entity.SwitchToWeapon(Settings.MainWeapon);
                            return true;
                        });
 }
开发者ID:bobolo,项目名称:iw5m-scripts,代码行数:86,代码来源:SnipeMod.cs


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