//return -1 for left, 1 for right and 0 equals forward
    override public float GetRotation()
    {
        float input = Input.GetAxis(moveAxis);

        if (input != 0)
        {
            input = Mathf.Sign(input);
        }

        if (isSavingData)
        {
            if (managePlayers.nbrPlayerDead > 0)
            {
                isSavingData = false;
                float nbLinesToDelete = timeNotSavedBeforeDeath / (countBetweenCapture * Time.fixedDeltaTime);
                DataWriter.instance.DeleteLastLines((int)nbLinesToDelete);
            }
            else if (countSinceLastCapture > countBetweenCapture)
            {
                DataWriter.instance.Write(readerDataGame.Read() + input);
                countSinceLastCapture = 0;
            }
        }
        countSinceLastCapture++;

        return(input);
    }
Пример #2
0
    public override float GetRotation()
    {
        string res = runPredict(dataGameReader.Read());

        if (string.IsNullOrEmpty(res))
        {
            print("No Prediction");
            return(-1);
        }
        return(int.Parse(res));
    }