コード例 #1
0
ファイル: CustomMission.cs プロジェクト: Guad/NOOSE
        public void StartEntry(int entryPoint, Ped[] team)
        {
            var entry = _entryData[entryPoint];

            switch (entry.Type)
            {
            case EntryTypes.Teleport:
                foreach (var ped in team)
                {
                    ped.Position = entry.Position;
                    ped.Heading  = entry.Heading;
                }
                break;

            case EntryTypes.Rappel:
                if (team.Length == 1)
                {
                    var rappel = new RappelEntry(entry.Helipads[0], entry.Position);
                    rappel.AddPassenger(team[0]);
                    _rappelUpdates.Add(rappel);
                }
                else
                {
                    var rappel = new RappelEntry(entry.Helipads[0], entry.Position);
                    foreach (Ped ped in team)
                    {
                        rappel.AddPassenger(ped);
                    }
                    _rappelUpdates.Add(rappel);
                }
                break;

            case EntryTypes.Plane:
                _planeEntry = new PlaneEntry(entry.PlaneSpawn, entry.PlaneSpawnHeading, entry.Approach, entry.RunwayStart, entry.RunwayEnd);
                foreach (Ped ped in team)
                {
                    _planeEntry.AddPassenger(ped);
                }
                _planeEntry.Start();
                break;
            }
            foreach (var source in _decorativeVehicles.Where(x => x.EntryPoint == entryPoint))
            {
                var tmpMod  = new Model(source.Model);
                int counter = 0;
                do
                {
                    tmpMod.Request();
                    Script.Yield();
                    counter++;
                } while (!tmpMod.IsLoaded && counter < 10000);
                var tmpVeh = Function.Call <Vehicle>(Hash.CREATE_VEHICLE, tmpMod.Hash, source.Position.X, source.Position.Y, source.Position.Z, source.Heading, false, false);
                tmpVeh.SirenActive = source.SirenActive;
                foreach (VehicleDoor door in source.OpenDoors)
                {
                    tmpVeh.OpenDoor(door, false, false);
                }
                CleanupBag.Add(tmpVeh);
            }
        }
コード例 #2
0
ファイル: CustomMission.cs プロジェクト: Guad/NOOSE
 public void StartEntry(int entryPoint, Ped[] team)
 {
     var entry = _entryData[entryPoint];
     switch (entry.Type)
     {
         case EntryTypes.Teleport:
             foreach (var ped in team)
             {
                 ped.Position = entry.Position;
                 ped.Heading = entry.Heading;
             }
             break;
         case EntryTypes.Rappel:
             if (team.Length == 1)
             {
                 var rappel = new RappelEntry(entry.Helipads[0], entry.Position);
                 rappel.AddPassenger(team[0]);
                 _rappelUpdates.Add(rappel);
             }
             else
             {
                 var rappel = new RappelEntry(entry.Helipads[0], entry.Position);
                 foreach (Ped ped in team)
                 {
                     rappel.AddPassenger(ped);
                 }
                 _rappelUpdates.Add(rappel);
             }
             break;
         case EntryTypes.Plane:
             _planeEntry = new PlaneEntry(entry.PlaneSpawn, entry.PlaneSpawnHeading, entry.Approach, entry.RunwayStart, entry.RunwayEnd);
             foreach (Ped ped in team)
             {
                 _planeEntry.AddPassenger(ped);
             }
             _planeEntry.Start();
             break;
     }
     foreach (var source in _decorativeVehicles.Where(x => x.EntryPoint == entryPoint))
     {
         var tmpMod = new Model(source.Model);
         int counter = 0;
         do
         {
             tmpMod.Request();
             Script.Yield();
             counter++;
         } while (!tmpMod.IsLoaded && counter < 10000);
         var tmpVeh = Function.Call<Vehicle>(Hash.CREATE_VEHICLE, tmpMod.Hash, source.Position.X, source.Position.Y, source.Position.Z,source.Heading, false, false);
         tmpVeh.SirenActive = source.SirenActive;
         foreach (VehicleDoor door in source.OpenDoors)
         {
             tmpVeh.OpenDoor(door, false, false);
         }
         CleanupBag.Add(tmpVeh);
     }
 }