Created
December 2, 2025 16:54
-
-
Save sabresaurus/bdd18a2ccf09ba02f23f6d6f7f781fec to your computer and use it in GitHub Desktop.
Cover Query from Revengard
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // MIT License | |
| // | |
| // Copyright (c) 2025 Sabresaurus | |
| // | |
| // Permission is hereby granted, free of charge, to any person obtaining a copy | |
| // of this software and associated documentation files (the "Software"), to deal | |
| // in the Software without restriction, including without limitation the rights | |
| // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
| // copies of the Software, and to permit persons to whom the Software is | |
| // furnished to do so, subject to the following conditions: | |
| // | |
| // The above copyright notice and this permission notice shall be included in all | |
| // copies or substantial portions of the Software. | |
| // | |
| // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |
| // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |
| // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | |
| // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | |
| // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | |
| // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | |
| // SOFTWARE. | |
| using UnityEngine; | |
| using UnityEngine.Serialization; | |
| using System.Collections; | |
| public enum AgentDestination | |
| { | |
| SquadPatrolTarget, | |
| PlayerPosition, | |
| PlayerFlank, | |
| }; | |
| [CreateAssetMenu] | |
| public class CoverQuery : ScriptableObject | |
| { | |
| [Tooltip("Allows user naming of queries.")] | |
| [FormerlySerializedAs("Description")] | |
| public string Name = ""; | |
| [Tooltip("Minimum weight for a cover position to be considered viable. This allows a low cutoff to exclude cover nodes that are practicable to reach but not practical or sensible.")] | |
| public float MinimumWeight = 0.2f; | |
| [Header("Directness")] | |
| [Tooltip("0 means don't consider directness to preferred destination, 1 means consider directness fully. Values in between are supported and can be used to vary influence.")] | |
| [Range(0, 1)] | |
| public float DirectnessInfluence = 1f; | |
| [Header("Ideal Distance To Cover")] | |
| [Tooltip("0 means don't consider distance to cover, 1 means consider distance fully. Values in between are supported and can be used to vary influence.")] | |
| [Range(0,1)] | |
| public float IdealDistanceToCoverInfluence = 1f; | |
| [Tooltip("Ideal distance from current position to a cover node")] | |
| public float IdealDistanceToCover = 10; | |
| [Header("Ideal Distance To Player")] | |
| [Range(0, 1)] | |
| public float IdealDistanceToPlayerInfluence = 1f; | |
| public float IdealDistanceToPlayer = 10; | |
| [Header("Filter Squad Radius")] | |
| [Tooltip("If True cover nodes further than a certain distance from the squad centroid will be ignored")] | |
| public bool FilterOutsideSquad = false; | |
| public float OutsideSquadDistance = 10; | |
| [Header("Other")] | |
| public AgentDestination IntendedDestination = AgentDestination.SquadPatrolTarget; | |
| public bool FilterAwayFromEnemy = true; | |
| public bool FilterAwayFromIntended = true; | |
| [CoverQueryAttribute] | |
| [SerializeField] | |
| public string FallbackQueryName = ""; | |
| } |
Author
sabresaurus
commented
Dec 2, 2025





Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment