Пример #1
0
        public override void OnAction(AISController ctrl)
        {
            base.OnAction(ctrl);

            AISVarList l = (AISVarList)ctrl.GetVar(listKey);

            l.PassToSingle((AISVarSingle)ctrl.GetVar(best), GetBest(ctrl, l));
        }
Пример #2
0
        float Score(AISController ctrl, AISVarList l, int idx)
        {
            float scor = 0;

            foreach (var v in varScorers)
            {
                scor += v.Score(ctrl, l, idx);
            }

            return(scor);
        }
Пример #3
0
        public static List <Vector3> GetListVector3(AISController ctrl, AISVariable key)
        {
            if (!ctrl.ContainsKey(key))
            {
                return(null);
            }

            AISVarList vars = (AISVarList)ctrl.GetVar(key);

            return(vars.vector3);
        }
Пример #4
0
        public static List <float> GetListFloat(AISController ctrl, AISVariable key)
        {
            if (!ctrl.ContainsKey(key))
            {
                return(null);
            }

            AISVarList vars = (AISVarList)ctrl.GetVar(key);

            return(vars.@float);
        }
Пример #5
0
        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);
        }
Пример #6
0
        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);
        }
Пример #7
0
 public int Score(AISController controller, AISVarList var, int idx)
 {
     return(Score(controller, var.@object[idx] as Character));
 }