public override void OnAction(AISController ctrl) { base.OnAction(ctrl); AISVarList l = (AISVarList)ctrl.GetVar(listKey); l.PassToSingle((AISVarSingle)ctrl.GetVar(best), GetBest(ctrl, l)); }
float Score(AISController ctrl, AISVarList l, int idx) { float scor = 0; foreach (var v in varScorers) { scor += v.Score(ctrl, l, idx); } return(scor); }
public static List <Vector3> GetListVector3(AISController ctrl, AISVariable key) { if (!ctrl.ContainsKey(key)) { return(null); } AISVarList vars = (AISVarList)ctrl.GetVar(key); return(vars.vector3); }
public static List <float> GetListFloat(AISController ctrl, AISVariable key) { if (!ctrl.ContainsKey(key)) { return(null); } AISVarList vars = (AISVarList)ctrl.GetVar(key); return(vars.@float); }
int GetBest(AISController ctrl, AISVarList l) { float maxPoints = float.MinValue; int idx = -1; for (int i = 0; i < [email protected]; ++i) { float s = Score(ctrl, l, i); if (s > maxPoints) { idx = i; maxPoints = s; } } return(idx); }
public static List <T> GetListObject <T>(AISController ctrl, AISVariable key) where T : Object { if (!ctrl.ContainsKey(key)) { return(null); } AISVarList vars = (AISVarList)ctrl.GetVar(key); List <T> list = [email protected](x => x is T).Select(x => (T)x).ToList(); if (list == null || list.Count == 0) { return(null); } return(list); }
public int Score(AISController controller, AISVarList var, int idx) { return(Score(controller, var.@object[idx] as Character)); }