// Use this for initialization
    public override void InitializeAgent()
    {
        m_PlayerCar.CarHitAction += CarHit;
        m_AgentCam = GetComponentInChildren <AgentCamera1>();
        if (m_AgentCam == null)
        {
            Debug.LogError("Can't find Agent Camera!");
        }
        m_AgentObservationCache = new float[m_AgentCam.m_iResWidth * m_AgentCam.m_iResHeight];

        m_fRewardIncrement = 1.0f / (float)agentParameters.maxStep;
    }
Exemple #2
0
    public override void InitializeAgent()
    {
        m_RoadManager = GetComponentInChildren <InfiniteRoadManager>();
        if (m_RoadManager == null)
        {
            Debug.LogError("Can't find RoadManager");
        }
        m_RoadManager.IsTrainMode = brain.brainType == BrainType.External;
        m_PlayerCar = GetComponentInChildren <PlayerCar>();
        if (m_PlayerCar == null)
        {
            Debug.LogError("Can't find PlayerCar!");
        }
        m_PlayerCar.CarHitAction += CarHit;
        m_AgentCam = GetComponentInChildren <AgentCamera1>();
        if (m_AgentCam == null)
        {
            Debug.LogError("Can't find Agent Camera!");
        }
        m_AgentObservationCache = new float[m_AgentCam.m_iResWidth * m_AgentCam.m_iResHeight];
        brain.brainParameters.vectorObservationSize = m_AgentCam.m_iResWidth * m_AgentCam.m_iResHeight;

        m_fRewardIncrement = 1.0f / (float)agentParameters.maxStep;
    }