I recently came up with idea of creating priority based targeting (determining unit weight)
I thought of some poor way:
1. Created array of checks, 0 index being most relevant,
2. the weight starts at float.MaxValue and for each check returning false is lowered by 1,
3. If all check fails the value gets lowered even further by HP+Distance related weight check,
4. Then i use that function to order units in List<WoWUnit>
The major flaw is that it's too inflexible, simple -1 for each check and nothing else.
Ideally for each check in the array it should lower total by amount determined by this check (and some fixed value for failed check).
Any ideas how to implement that so it would be simple to edit such priority table?
Yea i'm a bit lazy right now, just don't want to make people wait till i find the way myself.
I thought of some poor way:
1. Created array of checks, 0 index being most relevant,
2. the weight starts at float.MaxValue and for each check returning false is lowered by 1,
PHP:
public static float GetAdvancedPriority( this WoWUnit u, bool[] priorityTable )
{
float ret = float.MaxValue;
foreach(bool c in priorityTable)
{
if(c)
return ret;
ret--;
}
return
ret - (float)HPDistanceWeightCheck(u);
}
4. Then i use that function to order units in List<WoWUnit>
The major flaw is that it's too inflexible, simple -1 for each check and nothing else.
Ideally for each check in the array it should lower total by amount determined by this check (and some fixed value for failed check).
Any ideas how to implement that so it would be simple to edit such priority table?
Yea i'm a bit lazy right now, just don't want to make people wait till i find the way myself.
Last edited: