示例#1
0
 public FireStation(FireStationData data) : base(data)
 {
     Game.LogTrivialDebug("Loaded " + data.Name);
     EngineSpawn    = new RotatedVector3(data.EngineSpawn.ToVector3(), new Rotator(0f, 0f, data.EngineSpawn.W));
     BattalionSpawn = new RotatedVector3(data.BattalionSpawn.ToVector3(), new Rotator(0f, 0f, data.BattalionSpawn.W));
     RescueSpawn    = new RotatedVector3(data.RescueSpawn.ToVector3(), new Rotator(0f, 0f, data.RescueSpawn.W));
 }
示例#2
0
        public BackupUnit(Vector3 position, float heading, BlipSprite blipSprite, string blipName, Color blipColor)
        {
            SpawnLocation = new RotatedVector3(position, heading);

            VehicleBlipSprite = blipSprite;
            VehicleBlipColor  = blipColor;
            VehicleBlipName   = blipName;

            ReCreate();

            AI = new AIBackupUnitController(this);
        }
示例#3
0
        public static void SendFirefightersUnit(Vector3 position, FirefighterBackupTask task)
        {
            RotatedVector3 spawn = Util.GetSpawnLocationAroundPlayer(true);

            FirefightersBackupUnit[] currentUnits = BackupUnit.GetAllBackupUnitsOfType <FirefightersBackupUnit>();

            FirefightersBackupUnit unit = (currentUnits == null || currentUnits.Length == 0) ?
                                          null :
                                          currentUnits.Where(u => !u.IsDismissedOrDeleted && !u.IsResponding).OrderBy(u => Vector3.DistanceSquared(u.Vehicle.Position, position)).FirstOrDefault();

            if (unit == null)
            {
                unit = new FirefightersBackupUnit(spawn.Position, spawn.Heading);
            }
            else
            {
                unit.AI.AbortAllTasks();
            }

            unit.AI.DriveToPosition(position, true, 15f, 20.0f, VehicleDrivingFlags.Emergency);
            unit.IsResponding = true;
            switch (task)
            {
            case FirefighterBackupTask.ExtinguishFireInArea:
                unit.AI.ExtinguishFireInArea(position, 125.0f, false);
                break;
            }

            AIBackupUnitTask unitTask = unit.AI.DriveToPosition(FireStationsManager.Instance.Buildings.OrderBy(s => Vector3.DistanceSquared(s.Entrance, spawn.Position)).First().Entrance, false, 8f, 50.0f, VehicleDrivingFlags.Normal, false);

            unitTask.Started += (t) =>
            {
                unit.IsResponding = false;
            };
            unitTask.Finished += (t, aborted) =>
            {
                if (!aborted)
                {
                    if (Vector3.DistanceSquared(Game.LocalPlayer.Character.Position, unit.Vehicle) > 70.0f * 70.0f)
                    {
                        unit.Delete();
                    }
                    else
                    {
                        unit.Dismiss();
                    }
                }
            };
        }
示例#4
0
        public Hospital(HospitalData data) : base(data)
        {
            Game.LogTrivialDebug("Loaded " + data.Name);
            AmbulanceSpawn = new RotatedVector3(data.AmbulanceSpawn.ToVector3(), new Rotator(0f, 0f, data.AmbulanceSpawn.W));

            DropOffLocation = data.DropOffLocation.ToVector3();

            if (DropOffLocation != Vector3.Zero) // some hospitals don't have a drop off
            {
                DropOffBlip        = new Blip(DropOffLocation);
                DropOffBlip.Sprite = BlipSprite.Health;
                DropOffBlip.Color  = Color.White;
                DropOffBlip.Name   = "Emergency Room";
                NativeFunction.Natives.SetBlipAsShortRange(DropOffBlip, true);
            }
        }
示例#5
0
        public FireStationRoleSelectionScreen(FireStation station)
        {
            Game.LogTrivial("Entered role selection screen in station " + station);
            Station = station;

            RotatedVector3 loc = Station.GetVehicleLocationForRole(FirefighterRole.Engine);

            tempCam = new Camera(false);

            cam          = new Camera(true);
            cam.Position = loc.Position + Vector3.WorldUp * 13.0f + (loc.Rotation.ToVector() * 4.0f);
            cam.SetRotationPitch(-90.0f);
            cam.SetRotationRoll(loc.Heading);
            cam.Active = true;

            InitUI();

            Game.LocalPlayer.HasControl = false;
        }
示例#6
0
        private void MoveCamForRole(FirefighterRole role)
        {
            RotatedVector3 objectiveLoc = Station.GetVehicleLocationForRole(role);

            tempCam.Position = cam.Position;
            tempCam.Rotation = cam.Rotation;

            cam.Position = objectiveLoc.Position + Vector3.WorldUp * 13.0f + (objectiveLoc.Rotation.ToVector() * 4.0f);
            cam.SetRotationPitch(-90.0f);
            cam.SetRotationRoll(objectiveLoc.Heading);

            tempCam.Active = true;

            MoveUISelection(role);
            GameFiber.StartNew(() =>
            {
                interpolating = true;
                NativeFunction.Natives.SetCamActiveWithInterp(cam, tempCam, 850, 1, 1);
                GameFiber.Sleep(850);
                cam.Active    = true;
                interpolating = false;
            });
        }
示例#7
0
 public AIBackupUnitTask DriveToPositionAndPark(RotatedVector3 parkingLocation, bool considerTaskPriority = true) => GiveTask <AIBackupUnitDriveToParkingLocationAndParkTask>(considerTaskPriority, Unit, parkingLocation);
示例#8
0
 public bool Equals(RotatedVector3 spawnPoint)
 {
     return(this.Position == spawnPoint.Position && this.Rotation == spawnPoint.Rotation);
 }
示例#9
0
 protected AIBackupUnitDriveToParkingLocationAndParkTask(BackupUnit unit, RotatedVector3 parkingLocation) : base(unit)
 {
     targetParkingLocation = parkingLocation;
 }