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


C# Ped.Exists方法代码示例

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


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

示例1: preparePed

 public void preparePed(Ped ped)
 {
     if (ped.Exists())
     {
         ped.Invincible = true;
         ped.WillFlyThroughWindscreen = false;
         ped.PreventRagdoll = true;
     }
 }
开发者ID:andrefsantos,项目名称:gta-iv-multiplayer,代码行数:9,代码来源:Positioners.cs

示例2: StartEntry

 public void StartEntry(int entryPoint, Ped[] team)
 {
     float heading = 0f;
     switch (entryPoint)
     {
         case 0: // Water
             var entryPos = new Vector3(3098.805f, -4801.487f, 2.037071f);
             heading = 14.18145f;
             Ped lastped = new Ped(0);
             for (int index = 0; index < team.Length; index++)
             {
                 team[index].Position = entryPos;
                 if (lastped.Exists()) team[index].Position -= lastped.ForwardVector*2;
                 team[index].Heading = heading;
                 lastped = team[index];
             }
             var enforcermodel = new Model(VehicleHash.Dinghy2);
             enforcermodel.Request(10);
             var enforcer = World.CreateVehicle(enforcermodel, new Vector3(3094.513f, -4802.502f, 0.1324978f), 15.62522f);
             CleanupBag.Add(enforcer);
             EntryComplete = true;
             break;
         case 1: // Plane
             planeEntry = new PlaneEntry(new Vector3(-1598.288f, -2992.517f, 14.87434f), 241.2218f, new Vector3(2541.847f, -3829.26f, 115.3642f),
                 new Vector3(3002.718f, -4602.471f, 15.26161f), new Vector3(3049.975f, -4704.251f, 15.25679f));
             foreach (Ped ped in team)
             {
                 planeEntry.AddPassenger(ped);
             }
             planeEntry.Start();
             break;
         case 2: // Rappel
             Vector3[] rappelpads = new[]
             {
                 new Vector3(-1114.415f, -2884.573f, 14.04894f),
                 new Vector3(-1145.432f, -2864.025f, 14.05568f),
             };
             for (int i = 0; i < Convert.ToInt32(team.Length/2); i++)
             {
                 var rappel = new RappelEntry(rappelpads[i], new Vector3(3079.936f, -4649.66f, 23.87023f));
                 var team2 = team.Reverse().ToList();
                 for (int d = 0 + (2*i); d < 2 + (2*i); d++)
                 {
                     Ped t = team2[d];
                     rappel.AddPassenger(t);
                 }
                 rappelUpdates.Add(rappel);
             }
             break;
     }
 }
开发者ID:Guad,项目名称:NOOSE,代码行数:51,代码来源:AircraftCarrier.cs

示例3: StartEntry

        public void StartEntry(int entryPoint, Ped[] team)
        {
            float heading = 0f;
            switch (entryPoint)
            {
                case 0: // Front
                    var entryPos = new Vector3(-74.42314f, 6271.079f, 31.3722f);
                    heading = 216.744f;
                    for (int index = 0; index < team.Length; index++)
                    {
                        team[index].Position = entryPos;
                        team[index].Heading = heading;
                    }
                    var enforcermodel = new Model(VehicleHash.Riot);
                    enforcermodel.Request(10);
                    var enforcer = World.CreateVehicle(enforcermodel, new Vector3(-79.03268f, 6277.942f, 31.11718f), 32.41939f);
                    enforcer.SirenActive = true;
                    enforcer.OpenDoor(VehicleDoor.BackLeftDoor, false, true);
                    enforcer.OpenDoor(VehicleDoor.BackRightDoor, false, true);
                    CleanupBag.Add(enforcer);

                    var polmodel2 = new Model(VehicleHash.Police2);
                    polmodel2.Request(10);
                    var polcar = World.CreateVehicle(polmodel2, new Vector3(-83.34383f, 6274.731f, 30.95424f), 324.9319f);
                    var polcar3 = World.CreateVehicle(polmodel2, new Vector3(-76.00045f, 6281.345f, 31.03065f), 270.7873f);
                    polcar.SirenActive = true;
                    polcar3.SirenActive = true;
                    CleanupBag.Add(polcar);
                    CleanupBag.Add(polcar3);

                    EntryComplete = true;
                    break;
                case 1: // Back
                    var entryPosBack = new Vector3(-133.1731f, 6133.387f, 31.43232f);
                    heading = 43.69439f;

                    Ped lastpedback = new Ped(0);
                    for (int index = 0; index < team.Length; index++)
                    {
                        team[index].Position = entryPosBack;
                        if (lastpedback.Exists()) team[index].Position -= lastpedback.ForwardVector * 2;
                        team[index].Heading = heading;
                        lastpedback = team[index];
                    }
                    var enforcermodelb = new Model(VehicleHash.Riot);
                    enforcermodelb.Request(10);
                    var enforcerb = World.CreateVehicle(enforcermodelb, new Vector3(-127.5568f, 6144.007f, 31.25361f), 335.7838f);
                    enforcerb.SirenActive = true;
                    enforcerb.OpenDoor(VehicleDoor.BackLeftDoor, false, true);
                    enforcerb.OpenDoor(VehicleDoor.BackRightDoor, false, true);
                    CleanupBag.Add(enforcerb);

                    var polmodel = new Model(VehicleHash.Police2);
                    polmodel.Request(10);
                    var polcar1 = World.CreateVehicle(polmodel, new Vector3(-143.3609f, 6126.71f, 31.22926f), 252.053f);
                    polcar1.SirenActive = true;
                    CleanupBag.Add(polcar1);

                    EntryComplete = true;
                    break;
                case 2: // Back2
                    var entryPos2 = new Vector3(-182.2727f, 6166.434f, 31.35259f);
                    heading = 221.0143f;
                    for (int index = 0; index < team.Length; index++)
                    {
                        team[index].Position = entryPos2;
                        team[index].Heading = heading;
                    }
                    var enforcermodel2 = new Model(VehicleHash.Riot);
                    enforcermodel2.Request(10);
                    var enforcer2 = World.CreateVehicle(enforcermodel2, new Vector3(-187.0582f, 6171.55f, 31.13244f), 43.85089f);
                    enforcer2.SirenActive = true;
                    enforcer2.OpenDoor(VehicleDoor.BackLeftDoor, false, true);
                    enforcer2.OpenDoor(VehicleDoor.BackRightDoor, false, true);
                    CleanupBag.Add(enforcer2);

                    EntryComplete = true;
                    break;
            }
        }
开发者ID:Guad,项目名称:NOOSE,代码行数:80,代码来源:CluckingBell.cs

示例4: Meteoat_Tick

        private void Meteoat_Tick(object sender, EventArgs e)
        {
            if (rnd.Next(0, 100) < 1)
            {
                GC.Collect();
            }

            if (AllF == true && Player.Character.isAlive)
            {
               //         lc.CountDown();
                T = (T + 17) % 360;
                if (Exists(A)) { A.Delete(); }  //一回前の処理で作ったAさんを消す

                if (F_Probability >= 0) { Probability = F_Probability; MeteoInterval = 0; }
                else
                {
                    if (--MeteoInterval < 0)
                    {
                        MeteoInterval = rnd.Next(25, 101);
                        ProbabilityChangedTime = 50;

                        if (Easy)
                        {
                            Probability = rnd.Next(0, 6) * 10;

                        }
                        else
                        {
                            Probability = rnd.Next(0, 11) * 10;
                        }
                    }
                }

                /*
                Random rnd2 = new Random(((int)Player.Character.Position.X / 80 + (int)Player.Character.Position.Y / 80) + seed + (GTA.World.CurrentDayTime.Minutes / 10));

                //rnd2からその場所での降爆確率を求める
                if (Easy)
                {
                    Probability = rnd2.Next(0, 51);

                }
                else
                {
                    Probability = rnd2.Next(0, 101);
                }
                if (F_Probability >= 0) { Probability = F_Probability; }

                */

                //  降爆確率を元にメテオを1つ降らすか決める
                if (rnd.Next(0, 101) > Probability)
                {
                    return;
                }
                //

                Vector3 posit, playpos;  // posit: Aさんの位置(メテオ落下位置)   playpos:主人公の位置
                Vector3 POS;            // 落下エフェクト描画位置

                playpos = Player.Character.Position;
                posit = playpos;
                posit = posit.Around(rnd.Next(150));    //Aさんの出現位置を150mでランダムに決める
                posit.Z = playpos.Z + 50.0f;            //主人公より50m高い位置にAさんを配置する
                A = GTA.World.CreatePed(posit);         //Aさん召喚

                if (Exists(A))
                {
                    //Aさんの召喚に成功したなら

                    if (IsMeteoOut() && A.Position.DistanceTo2D(Player.Character.Position) < 15.0f)
                    {
                        //メテオがそれる条件を満たしている時に近くにメテオが振りそうならAさんの位置をズラす
                        A.Position = new Vector3(playpos.X + rnd.Next(20, 50), playpos.Y + rnd.Next(20, 50), 50);
                    }

                    POS = A.Position;
                    POS.Z = playpos.Z;
                    A.Visible = false;  //Aさんの姿を透明にする

                    float PlayerVelo = 0;
                    if (Player.Character.isInVehicle())
                    {
                        PlayerVelo = Player.Character.CurrentVehicle.Speed * 3;
                    }

                    //メテオ落下予定地点にエフェクトを描画
                    //車で移動している時は描画範囲を広げる
                    if (Player.Character.Position.DistanceTo2D(POS) < 20.0f + PlayerVelo) {
                        if (Player.Character.Position.Z - World.GetGroundZ(Player.Character.Position) > 2)
                        {
                            GTA.Native.Function.Call("TRIGGER_PTFX", "qub_lg_explode_red", POS.X, POS.Y, POS.Z, 0, 0, 0, 2.5f);
                        }
                        else
                        {
                            GTA.Native.Function.Call("TRIGGER_PTFX", "qub_lg_explode_red", POS.X, POS.Y, World.GetGroundZ(POS)+1.0f, 0, 0, 0, 2.5f);
                        }
                   //     this.lc.AddLights(Color.Red, 10.0f, 15.0f, new Vector3(POS.X,POS.Y,World.GetGroundZ(POS)+1.0f), 5);
                    }

//.........这里部分代码省略.........
开发者ID:TORISOUP,项目名称:GTA4-Inferno-scripts,代码行数:101,代码来源:Meteo_kai.cs

示例5: StartEntry

        public void StartEntry(int entryPoint, Ped[] team)
        {
            float heading = 0f;
            switch (entryPoint)
            {
                case 0: // Front
                    var entryPos = new Vector3(-1793.309f, -1196.424f, 12.017f);
                    heading = 51.61f;
                    Ped lastped = new Ped(0);
                    for (int index = 0; index < team.Length; index++)
                    {
                        team[index].Position = entryPos;
                        if (lastped.Exists()) team[index].Position -= lastped.ForwardVector*2;
                        team[index].Heading = heading;
                        lastped = team[index];
                    }
                    var enforcermodel = new Model(VehicleHash.Riot);
                    enforcermodel.Request(10);
                    var enforcer = World.CreateVehicle(enforcermodel, new Vector3(-1794.152f, -1188.071f, 12.74f), 9.35f);
                    enforcer.SirenActive = true;
                    enforcer.OpenDoor(VehicleDoor.BackLeftDoor, false, true);
                    enforcer.OpenDoor(VehicleDoor.BackRightDoor, false, true);
                    CleanupBag.Add(enforcer);
                    EntryComplete = true;
                    break;
                case 1: // Water
                    var model = new Model(VehicleHash.Predator);
                    model.Request(10);
                    var car = World.CreateVehicle(model, new Vector3(-1799.512f, -1230.37f, 0.568f), 139.47f
                        );
                    CleanupBag.Add(car);

                    entryPos = new Vector3(-1800.013f, -1227.414f, 1.66f);
                    heading = 149.15f;
                    foreach (Ped ped in team)
                    {
                        ped.Position = entryPos;
                        ped.Heading = heading;
                    }
                    EntryComplete = true;
                    break;
                case 2: // Rappel
                    for (int i = 0; i < Convert.ToInt32(team.Length/2); i++)
                    {
                        var rappel = new RappelEntry(new Vector3(-1492.215f, -1230.166f, 2.87f).Around(20f), new Vector3(-1837.12f, -1254.43f, 20.18f));
                        var team2 = team.Reverse().ToList();
                        for (int d = 0 + (2*i); d < 2 + (2*i); d++)
                        {
                            Ped t = team2[d];
                            rappel.AddPassenger(t);
                        }
                        rappelUpdates.Add(rappel);
                    }
                    break;
            }
        }
开发者ID:Guad,项目名称:NOOSE,代码行数:56,代码来源:PierAssault.cs


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