Ejemplo n.º 1
0
    public override void AgentAction(float[] vectorAction, string textAction)
    {
        AddRewards();

        if (m_Reward.Kill)
        {
            Debug.Log("Done");
            Done();
            AgentReset();
        }

        // Actions, size = 3

        float force = Mathf.Clamp(vectorAction[0], -1, 1);

        m_Controller.Throttle(force);

        float steer = Mathf.Clamp(vectorAction[1], -1, 1);;

        m_Controller.Steer(steer);

        float breakForce = Mathf.Clamp(vectorAction[2], 0, 1);

        m_Controller.Break(breakForce);
    }
Ejemplo n.º 2
0
    private void Update()
    {
        if (m_isPlayerInputBlocked)
        {
            return;
        }

        float horizontal = Input.GetAxis("Horizontal");
        float vertical   = Input.GetAxis("Vertical");
        float _break     = Input.GetAxis("Break");

        if (Mathf.Abs(vertical) > k_verticalMoveThreshold)
        {
            m_carController.MoveFrontal(vertical);
        }
        if (Mathf.Abs(horizontal) > k_horizontalMoveThreshold)
        {
            m_carController.MoveLateral(horizontal);
        }
        if (Mathf.Abs(_break) > k_breakMoveThreshold)
        {
            m_carController.Break(_break);
        }
    }