using UnityEngine; // Sci-Fi Ship Controller. Copyright (c) 2018-2023 SCSM Pty Ltd. All rights reserved. namespace SciFiShipController { /// /// A data class to pass a query to the radar system. /// /// [Unity.VisualScripting.Inspectable] public class SSCRadarQuery { #region Static Read-only valiables /// /// Don't consider factionId when performing a query /// public static readonly int IGNOREFACTION = -1; // Static optimised enum lookups public static readonly int querySortOrderNoneInt = (int)QuerySortOrder.None; public static readonly int querySortOrderDistanceAsc2DInt = (int)QuerySortOrder.DistanceAsc2D; public static readonly int querySortOrderDistanceAsc3DInt = (int)QuerySortOrder.DistanceAsc3D; public static readonly int querySortOrderDistanceDesc2DInt = (int)QuerySortOrder.DistanceDesc2D; public static readonly int querySortOrderDistanceDesc3DInt = (int)QuerySortOrder.DistanceDesc3D; #endregion #region Enumerations public enum QuerySortOrder : int { None = 0, DistanceAsc2D = 1, DistanceAsc3D = 2, DistanceDesc2D = 11, DistanceDesc3D = 12 } #endregion #region Public variables // IMPORTANT - when changing this section also update SetClassDefault() // Also update ClassName(ClassName className) Clone Constructor (if there is one) /// /// This is the world-space position around which the radar query emits. /// /// [Unity.VisualScripting.Inspectable] public Vector3 centrePosition; /// /// The radar range in metres from the centrePosition /// /// [Unity.VisualScripting.Inspectable] public float range; /// /// Uses 3D distances to determine range when querying the radar data. /// /// [Unity.VisualScripting.Inspectable] public bool is3DQueryEnabled; /// /// The sort order of the results. None is the fastest option and has /// the lowest performance impact. /// /// [Unity.VisualScripting.Inspectable] public QuerySortOrder querySortOrder; /// /// The faction or alliance the item belongs to. This can be used to identify if an item is friend or foe. /// 0 = neutral. -1 means not set (ignore factionId in query). /// /// [Unity.VisualScripting.Inspectable] public int factionId; /// /// [Optional] An array of factionIds to include from the query results. Only considered /// sscRadarQuery.factionId is -1. /// /// [Unity.VisualScripting.Inspectable] public int[] factionsToInclude; /// /// [Optional] An array of factionIds to exclude from the query results /// /// [Unity.VisualScripting.Inspectable] public int[] factionsToExclude; /// /// [Optional] An array of squadronIds to include from the query results /// /// [Unity.VisualScripting.Inspectable] public int[] squadronsToInclude; /// /// [Optional] An array of squadronIds to exclude from the query results /// /// [Unity.VisualScripting.Inspectable] public int[] squadronsToExclude; // Uncomment, set, then create Debug.Logs in SSCRadar.GetRadarResults(..) //public int queryDebugTag; #endregion #region Constructors public SSCRadarQuery() { SetClassDefault(); } #endregion #region Public Member Methods public void SetClassDefault() { centrePosition = Vector3.zero; range = 100f; is3DQueryEnabled = true; querySortOrder = QuerySortOrder.None; // -1 means don't consider in query factionId = IGNOREFACTION; factionsToExclude = null; squadronsToInclude = null; squadronsToExclude = null; } #endregion } }