Пример #1
0
        // Update is called once per frame
        protected override void FixedUpdate()
        {
            evaluate();

            List <float> res = weapon.evaluate(inputs);
            Vector3      vel = new Vector3(res[1], 0f, res[0]);

            apply(vel);
        }
Пример #2
0
        public List <float> evaluate(List <float> inputs)
        {
            int inNodesN = node_gene.Where(node => node.property == GENES.NODE.IN).Count();

            if (inputs.Count != inNodesN)
            {
                return(null);
            }

            return(network.evaluate(inputs));
        }
Пример #3
0
        public static List <Vector3> simulateNet(NN.Net net)
        {
            float          dt   = Time.fixedDeltaTime;
            List <Vector3> path = new List <Vector3>(100);

            path.Add(new Vector3(0f, 0f, 0f));
            List <float> inputs = new List <float>()
            {
                0f, 0f, 0f, 1f
            };

            for (int i = 0; i < 50; ++i)
            {
                List <float> res = net.evaluate(inputs);
                Vector3      v   = new Vector3(50 * res[1], 0f, 50 * res[0]);

                path.Add(path[path.Count - 1] + v * dt);

                inputs[0] = path[path.Count - 1].z;
                inputs[1] = path[path.Count - 1].x;
                inputs[2] = Vector3.Distance(Vector3.zero, path[path.Count - 1]);
            }
            return(path);
        }