Exemple #1
0
 void FixedUpdate()
 {
     if (Side == Player.Player1)
     {
         _grid.DebugDraw(v => Color.Lerp(Color.black, Color.white, v / 250f));
         QAIManager.GetAction(GetState())();
     }
 }
Exemple #2
0
 public void FixedUpdate()
 {
     if (_testModel)
     {
         Instantiate(Resources.Load <ModelTest>("ModelTest"));
         _testModel = false;
     }
     _grid.DebugDraw(value => value == 0 ? Color.red : value == 1 ? Color.gray : Color.yellow);
     if (QAIManager.CurrentMode != QAIMode.Imitating)
     {
         var state = GetState();
         QAIManager.GetAction(state)();
         ArchiveState(state);
     }
     else
     {
         Action currentAction = null;
         if (Key(KeyCode.UpArrow, KeyCode.W))
         {
             currentAction = MoveUp;
         }
         if (Key(KeyCode.DownArrow, KeyCode.S))
         {
             currentAction = MoveDown;
         }
         if (Key(KeyCode.RightArrow, KeyCode.D))
         {
             currentAction = MoveRight;
         }
         if (Key(KeyCode.LeftArrow, KeyCode.A))
         {
             currentAction = MoveLeft;
         }
         if (currentAction != null)
         {
             QAIManager.Imitate(this, GetState(), currentAction);
         }
     }
 }
Exemple #3
0
    // Update is called once per frame
    void FixedUpdate()
    {
        if (_onTrack)
        {
            if (AiControlled)
            {
                QAIManager.GetAction(GetState())();
            }

            UpdatePosistion();
        }
        LapNumber = (int)((_distanceTravelled - StartPosition) / Track.length);
        if (LapNumber != PrevLap && LapNumber != 0)
        {
            PrevLap = LapNumber;
            Debug.Log("Time: " + LapTime);
            Debug.Log("Score: " + Track.length / LapTime);
            LapTime = 0;
        }
        else
        {
            LapTime += Time.deltaTime;
        }
    }
Exemple #4
0
 void CarOffTrack(int dir)
 {
     _onTrack = false;
     QAIManager.GetAction(GetState())();
     StartCoroutine(DerailAnimation(dir));
 }