protected void Patrol() { if (CurrentPatrolRoute is null || !CurrentPatrolRoute.Any()) { CurrentPatrolRoute = new Stack <Vector2i>(PatrolRoute); } if (TargetPosition.IsInvalid() || TargetPosition.Equals(Owner.Coords)) { TargetPosition = CurrentPatrolRoute.Pop(); } if (!TargetPosition.IsInvalid()) { if (Path != null && !Path.Any()) { Path = null; } Path ??= GeneratePath(Owner.CurrentRegion.GetNodesInRegion(), Owner.CurrentRegion.ConvertMapCoordsToRegionFieldCoords(Owner.Coords), Owner.CurrentRegion.ConvertMapCoordsToRegionFieldCoords(TargetPosition)); NextAction = Path == null ? null : GetActionFromNextCoords(Path.Pop().Position + Owner.CurrentRegion.Coords * Owner.CurrentRegion.FieldsInLine); } else { NextAction = null; } }
public bool Equals(SimpleVariables other) { if (other == null) { return(false); } return(CurrentLevel.Equals(other.CurrentLevel) && CurrentArea.Equals(other.CurrentArea) && Language.Equals(other.Language) && MillisecondsPerGameMinute.Equals(other.MillisecondsPerGameMinute) && LastClockTick.Equals(other.LastClockTick) && GameClockHours.Equals(other.GameClockHours) && GameClockMinutes.Equals(other.GameClockMinutes) && GameClockSeconds.Equals(other.GameClockSeconds) && TimeInMilliseconds.Equals(other.TimeInMilliseconds) && TimeScale.Equals(other.TimeScale) && TimeStep.Equals(other.TimeStep) && TimeStepNonClipped.Equals(other.TimeStepNonClipped) && FramesPerUpdate.Equals(other.FramesPerUpdate) && FrameCounter.Equals(other.FrameCounter) && OldWeatherType.Equals(other.OldWeatherType) && NewWeatherType.Equals(other.NewWeatherType) && ForcedWeatherType.Equals(other.ForcedWeatherType) && WeatherTypeInList.Equals(other.WeatherTypeInList) && WeatherInterpolationValue.Equals(other.WeatherInterpolationValue) && CameraPosition.Equals(other.CameraPosition) && CameraModeInCar.Equals(other.CameraModeInCar) && CameraModeOnFoot.Equals(other.CameraModeOnFoot) && ExtraColor.Equals(other.ExtraColor) && IsExtraColorOn.Equals(other.IsExtraColorOn) && ExtraColorInterpolation.Equals(other.ExtraColorInterpolation) && Brightness.Equals(other.Brightness) && DisplayHud.Equals(other.DisplayHud) && ShowSubtitles.Equals(other.ShowSubtitles) && RadarMode.Equals(other.RadarMode) && BlurOn.Equals(other.BlurOn) && UseWideScreen.Equals(other.UseWideScreen) && MusicVolume.Equals(other.MusicVolume) && SfxVolume.Equals(other.SfxVolume) && RadioStation.Equals(other.RadioStation) && StereoOutput.Equals(other.StereoOutput) && PadMode.Equals(other.PadMode) && InvertLook.Equals(other.InvertLook) && UseVibration.Equals(other.UseVibration) && SwapNippleAndDPad.Equals(other.SwapNippleAndDPad) && HasPlayerCheated.Equals(other.HasPlayerCheated) && AllTaxisHaveNitro.Equals(other.AllTaxisHaveNitro) && TargetIsOn.Equals(other.TargetIsOn) && TargetPosition.Equals(other.TargetPosition) && PlayerPosition.Equals(other.PlayerPosition) && TrailsOn.Equals(other.TrailsOn) && TimeStamp.Equals(other.TimeStamp) && Unknown78hPS2.Equals(other.Unknown78hPS2) && Unknown7ChPS2.Equals(other.Unknown7ChPS2) && Unknown90hPS2.Equals(other.Unknown90hPS2) && UnknownB8hPSP.Equals(other.UnknownB8hPSP) && UnknownD8hPS2.Equals(other.UnknownD8hPS2) && UnknownD9hPS2.Equals(other.UnknownD9hPS2)); }
protected override void DecideOnNextAction() { if (CanDoAction() && Owner.CurrentRegion != null) { if (CanSeePlayerInUnobstructedLine || (CanSeeActivityInUnobstructedLine && Owner.CurrentRegion != null && Owner.CurrentRegion.HasDestructibleActivity)) { NextAction = KeyActionType.Shoot; } else { Vector2i currentPlayerPosition = GamestateManager.Instance.Player.Coords; if (LastPlayerPosition != currentPlayerPosition || !GamestateManager.Instance.Map.GetFieldFromRegion(TargetPosition).IsTraversible()) { LastPlayerPosition = currentPlayerPosition; TargetPosition = GetValidStandGroundPosition(); Path = null; } if (!IsPlayerWithinChaseRadius() && !TargetPosition.Equals(HomePosition)) { NextAction = null; } else { if (!TargetPosition.IsInvalid()) { if (Path != null && Path.Count == 0) { Path = null; } Path ??= GeneratePath(GamestateManager.Instance.Map.GetNodesInRadius(Owner.Coords, SightDistance), new Vector2i(SightDistance, SightDistance), new Vector2i(SightDistance, SightDistance) + TargetPosition - Owner.Coords); NextAction = Path == null ? null : GetActionFromNextCoords(Path.Pop().Position + Owner.Coords - new Vector2i(SightDistance, SightDistance)); } else { NextAction = null; } } } } else { NextAction = null; } }
protected override void DecideOnNextAction() { if (CanDoAction() && Owner.CurrentRegion != null) { PatrolRoute ??= Owner.CurrentRegion.GetNodesInRegion().SelectMany(node => node).ToList().FindAll(node => node.Walkable).Select(node => node.Position).OrderBy(node => Guid.NewGuid()).ToList(); if (CanSeePlayerInUnobstructedLine || (CanSeeActivityInUnobstructedLine && Owner.CurrentRegion.HasDestructibleActivity)) { NextAction = KeyActionType.Shoot; } else { if (CurrentPatrolRoute is null || CurrentPatrolRoute.Count == 0) { CurrentPatrolRoute = new Stack <Vector2i>(PatrolRoute); } if (Path != null && !Path.Any()) { Path = null; } if (CurrentPatrolRoute != null && CurrentPatrolRoute.Any() && (Path == null || TargetPosition.IsInvalid() || TargetPosition.Equals(Owner.CurrentRegion.ConvertMapCoordsToRegionFieldCoords(Owner.Coords)))) { SetCooldown(0.05); TargetPosition = CurrentPatrolRoute.Pop(); Path ??= GeneratePath(Owner.CurrentRegion.GetNodesInRegion(), Owner.CurrentRegion.ConvertMapCoordsToRegionFieldCoords(Owner.Coords), TargetPosition); } NextAction = Path == null ? null : GetActionFromNextCoords(Path.Pop().Position + Owner.CurrentRegion.Coords * Owner.CurrentRegion.FieldsInLine); } } else { NextAction = null; } }