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]); }
public override Vector3 TargetPosition() { return(loc.GetVector()); }
public override void RunAction() { owner.transform.position = loc.GetVector(); }