public void Update() { if (!interpolating) { if (Game.IsKeyDown(System.Windows.Forms.Keys.Left)) { int newSelectionIndex = Array.IndexOf(possibleSelections, currentSelection) - 1; if (newSelectionIndex < 0) { newSelectionIndex = possibleSelections.Length - 1; } CurrentSelection = possibleSelections[newSelectionIndex]; } else if (Game.IsKeyDown(System.Windows.Forms.Keys.Right)) { int newSelectionIndex = Array.IndexOf(possibleSelections, currentSelection) + 1; if (newSelectionIndex >= possibleSelections.Length) { newSelectionIndex = 0; } CurrentSelection = possibleSelections[newSelectionIndex]; } else if (Game.IsKeyDown(System.Windows.Forms.Keys.Enter)) { OnRoleSelected(CurrentSelection); } } }
public RotatedVector3 GetVehicleLocationForRole(FirefighterRole role) { switch (role) { default: case FirefighterRole.None: return(new RotatedVector3()); case FirefighterRole.Engine: return(EngineSpawn); case FirefighterRole.Battalion: return(BattalionSpawn); case FirefighterRole.Rescue: return(RescueSpawn); } }
private Rectangle GetUIRectangleForRole(FirefighterRole role) { switch (role) { default: case FirefighterRole.None: return(null); case FirefighterRole.Engine: return(uiEngineRectangle); case FirefighterRole.Battalion: return(uiBattalionRectangle); case FirefighterRole.Rescue: return(uiRescueRectangle); } }
public Vehicle GetVehicleForRole(FirefighterRole role) { switch (role) { default: case FirefighterRole.None: return(null); case FirefighterRole.Engine: return(Engine); case FirefighterRole.Battalion: return(Battalion); case FirefighterRole.Rescue: return(Rescue); } }
private void OnFirefighterRoleSelected(FirefighterRole role) { Game.LogTrivial("Player selected firefighter role: " + role); PlayerManager.Instance.FirefighterRole = role; if (roleSelectionScreen != null) { Vehicle v = roleSelectionScreen.Station.GetVehicleForRole(role); if (v) { Game.LocalPlayer.Character.Position = v.FrontPosition + v.ForwardVector * 5.0f; Game.LocalPlayer.Character.Heading = MathHelper.ConvertDirectionToHeading((v.Position - Game.LocalPlayer.Character.Position).ToNormalized()); } roleSelectionScreen.CleanUp(); } roleSelectionScreen = null; FireCalloutsManager.Instance.StartNewCalloutsAutomatically = true; }
private void MoveUISelection(FirefighterRole role) { GameFiber.StartNew(() => { PointF origLoc = uiSelectionRectangle.Location; Rectangle objRect = GetUIRectangleForRole(role); PointF objLoc = new PointF(objRect.Location.X - 5, objRect.Location.Y - 5); float percent = 0.0f; while (percent < 1.0f) { GameFiber.Sleep(5); float x = MathHelper.Lerp(origLoc.X, objLoc.X, percent); uiSelectionRectangle.Location = new PointF(x, uiSelectionRectangle.Location.Y); percent += 0.0425f; } uiSelectionRectangle.Location = objLoc; }); }
public void SetPlayerToState(PlayerStateType type) { if (playerState == type) { return; } switch (type) { default: case PlayerStateType.Normal: Game.MaxWantedLevel = 5; Game.LocalPlayer.Model = normalStateModel; FirefighterRole = FirefighterRole.None; break; case PlayerStateType.Firefighter: Game.MaxWantedLevel = 0; normalStateModel = Game.LocalPlayer.Model; Game.LocalPlayer.Model = Plugin.UserSettings.PEDS.FIREFIGHTER_MODEL; FirefighterRole = FirefighterRole.Engine; FireCalloutsManager.Instance.LoadCallouts(); FireCalloutsManager.Instance.ResetNextCalloutTimer(); break; case PlayerStateType.EMS: Game.MaxWantedLevel = 0; normalStateModel = Game.LocalPlayer.Model; Game.LocalPlayer.Model = Plugin.UserSettings.PEDS.EMS_MODEL; FirefighterRole = FirefighterRole.None; EMSCalloutsManager.Instance.LoadCallouts(); EMSCalloutsManager.Instance.ResetNextCalloutTimer(); break; } API.Functions.OnPlayerStateChanged(type, playerState); playerState = type; }
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; }); }
public FireCalloutInfoAttribute(string calloutName, FirefighterRole role, CalloutProbability probability) : base(calloutName, probability) { Role = role; }
public static Vehicle CreateFirefighterVehicle(Vector3 position, float heading, FirefighterRole role) { Model model; Settings.ColorData primaryColor, secondaryColor; switch (role) { default: case FirefighterRole.None: return(null); case FirefighterRole.Engine: { model = Plugin.UserSettings.VEHICLES.ENGINE_MODEL; primaryColor = Plugin.UserSettings.VEHICLES.ENGINE_PRIMARY_COLOR; secondaryColor = Plugin.UserSettings.VEHICLES.ENGINE_SECONDARY_COLOR; } break; case FirefighterRole.Battalion: { model = Plugin.UserSettings.VEHICLES.BATTALION_MODEL; primaryColor = Plugin.UserSettings.VEHICLES.BATTALION_PRIMARY_COLOR; secondaryColor = Plugin.UserSettings.VEHICLES.BATTALION_SECONDARY_COLOR; } break; case FirefighterRole.Rescue: { model = Plugin.UserSettings.VEHICLES.RESCUE_MODEL; primaryColor = Plugin.UserSettings.VEHICLES.RESCUE_PRIMARY_COLOR; secondaryColor = Plugin.UserSettings.VEHICLES.RESCUE_SECONDARY_COLOR; } break; } Vehicle veh = new Vehicle(model, position, heading); if (primaryColor != null) { veh.PrimaryColor = primaryColor.ToColor(); } if (secondaryColor != null) { veh.SecondaryColor = secondaryColor.ToColor(); } return(veh); }
protected void OnRoleSelected(FirefighterRole role) { RoleSelected?.Invoke(role); }
public FireRegisteredCalloutData(Type calloutType, string internalName, FirefighterRole role, CalloutProbability probability) : base(calloutType, internalName, probability) { Role = role; }
public static void RegisterFirefighterCallout(Type calloutType, string name, FirefighterRole role, CalloutProbability probability) { FireCalloutsManager.Instance.RegisterCallout(new FireRegisteredCalloutData(calloutType, name, role, probability)); }