Ejemplo n.º 1
0
    public static bool GetHostileTargets(Unit targeter, float distance = 40)
    {
        if (targeter.character.PreviousTargets.Count > 20)
        {
            targeter.character.PreviousTargets.Clear();
        }

        var uniqueTarget = ArenaUnits.Find(unit => unit.IsHostileTo(targeter) && Vector3.Distance(targeter.transform.position, unit.transform.position) <= distance &&
                                           !targeter.character.PreviousTargets.Contains(unit.Character.Id));

        if (uniqueTarget == null)
        {
            targeter.character.PreviousTargets.Clear();
            uniqueTarget = ArenaUnits.Find(unit => unit.IsHostileTo(targeter) && Vector3.Distance(targeter.transform.position, unit.transform.position) <= distance);
        }

        if (uniqueTarget != null)
        {
            targeter.character.PreviousTargets.Add(uniqueTarget.Character.Id);
            PlayerInterface.CheckTargetSelection(uniqueTarget);
            return(true);
        }


        PlayerInterface.ClearTargetSelection();
        return(false);
    }
Ejemplo n.º 2
0
 public static Unit FindUnit(Guid id)
 {
     return(ArenaUnits.Find(unit => unit.Character.Id == id));
 }