// System using System; using System.Reflection; // Unity using UnityEngine; // GUPS - AntiCheat - Core using GUPS.AntiCheat.Core.Punisher; namespace GUPS.AntiCheat.Punisher { /// /// The exit game punisher is a very drastic punishment. It closes the game. /// [Serializable] [Obfuscation(Exclude = true)] public class ExitGamePunisher : MonoBehaviour, IPunisher { // Name #region Name /// /// The name of the punisher. /// public String Name => "Exit Game Punisher"; #endregion // Platform #region Platform /// /// Is supported on all platforms. /// public bool IsSupported => true; /// /// Gets or sets whether the punisher is active and can administer punitive actions (Default: true). /// [SerializeField] [Header("Punisher - Settings")] [Tooltip("Gets or sets whether the punisher is active and can administer punitive actions (Default: true).")] private bool isActive = true; /// /// Gets or sets whether the punisher is active and can administer punitive actions (Default: true). /// public bool IsActive { get => this.isActive; set => this.isActive = value; } #endregion // Threat Rating #region Threat Rating /// /// Is a very drastic punishment, so the threat rating is set to a high value (Default: 850). /// [SerializeField] [Tooltip("Is a very drastic punishment, so the threat rating is set to a high value (Default: 850).")] private uint threatRating = 850; /// /// Is a very drastic punishment, so the threat rating is set to a high value (Default: 850). /// public uint ThreatRating => this.threatRating; #endregion // Punishment #region Punishment /// /// Returns if the punisher should only administer punitive actions once or any time the threat level exceeds the threat rating. /// public bool PunishOnce => true; /// /// Returns if the punisher has administered punitive actions. /// public bool HasPunished { get; private set; } = false; /// /// As the name says, close the game! /// public void Punish() { // Has punished. this.HasPunished = true; // Close the game. Application.Quit(); } #endregion } }