示例#1
0
    public void FixedUpdate()
    {
        if (!dead)
        {
            // The number of frames is used as the runner's fitness
            framesAlive++;

            // Get next rotation from NN
            float[] inputs = GetSurroundingDistances();
            turnRotation = neuralNetwork.GetOutputValue(inputs) - 0.5f;

            // Move player forward and rotate them
            transform.position += transform.forward * Time.deltaTime * speed;
            transform.rotation  = GetNextRotation();
        }
    }