コード例 #1
0
    private List <SampleContainer> WriteSamplesToAsset()
    {
        if (m_generateSimpleData == null || m_generateSimpleData.Count == 0)
        {
            return(null);
        }

        List <SampleContainer> data = new List <SampleContainer>();

        int   width        = m_width == 0 ? m_sampleManager.GetCaptureWidth() : m_width;
        int   height       = m_height == 0 ? m_sampleManager.GetCaptureHeight() : m_height;
        float playerHeight = m_sampleManager.GetPlayerHeight();

        int obstacleLength = width * height;
        int playerLength   = m_sampleManager.GetInputLayerLengthPlayer(width, playerHeight);
        int dataLength     = obstacleLength + playerLength;

        foreach (SampleGenerationBase sampleGeneration in m_generateSimpleData)
        {
            List <SampleContainer> simpleData = sampleGeneration.GenerateSamples(width, height, obstacleLength, playerLength);
            for (int i = 0; i < simpleData.Count; i++)
            {
                data.Add(simpleData[i]);
            }
        }

        if (data.Count == 0)
        {
            Debug.Log("No data has been writen! Data length was 0. (Post)");
            return(null);
        }

        return(data);
    }