Example #1
0
    public AuroraObject Nearest(AuroraLocation loc, Type t, int nth)
    {
        List <AuroraObject> objs = new List <AuroraObject>();

        foreach (List <AuroraObject> list in auroraObjects.Values)
        {
            foreach (AuroraObject obj in list)
            {
                if (obj.GetType() == t || obj.GetType().IsSubclassOf(t))
                {
                    objs.Add(obj);
                }
            }
        }

        if (nth >= objs.Count)
        {
            return(null);
        }

        objs.Sort(
            (x, y) => Vector3.Distance(loc.GetVector(), x.transform.position).CompareTo(Vector3.Distance(loc.GetVector(), y.transform.position))
            );

        return(objs[nth]);
    }
Example #2
0
 public override Vector3 TargetPosition()
 {
     return(loc.GetVector());
 }
Example #3
0
 public override void RunAction()
 {
     owner.transform.position = loc.GetVector();
 }